### Getting Started Path Structure Source: https://docs.readme.com/main/docs/structuring-your-docs A hierarchical structure for a 'Getting Started' section, prioritizing a smooth onboarding experience. ```tree Getting Started/ ├── Quick Start Guide ├── Authentication ├── Core Concepts └── First API Call ``` -------------------------------- ### Using MDX Tab Components in ReadMe Source: https://docs.readme.com/main/docs/creating-and-managing-guides Demonstrates how to use the built-in MDX tab components to present code examples in different languages within a single guide. Ensure you have MDX enabled for your project. ```javascript const client = new ReadMeAPI(apiKey); ``` ```python client = ReadMeAPI(api_key) ``` ```ruby client = ReadMeAPI.new(api_key) ``` -------------------------------- ### Install Required Libraries for C# Source: https://docs.readme.com/main/docs/amazon-api-gateway-webhook Install the ReadMe Metrics SDK and the AWS SDK for API Gateway using the .NET CLI. ```shell dotnet add package ReadMe.Metrics dotnet add package AWSSDK.APIGateway ``` -------------------------------- ### Install ReadMe Metrics for Django Source: https://docs.readme.com/main/docs/python-django-api-metrics Install the package using pip. This can also be added to your requirements.txt file. ```bash pip install "readme-metrics[Django]" ``` -------------------------------- ### Apply Style Guide to Underperforming Content Source: https://docs.readme.com/main/docs/readmes-mcp-use-cases Improve underperforming documentation by applying a previously created style guide. This prompt uses ReadMe MCP tools to find low-performing pages, fetch their content, rewrite them according to the style guide, and publish the updated version. ```text Now use the style guide you just created to improve my worst-performing page. 1. Use `search` to find my lowest-rated or least-viewed page 2. Use `fetch` to get its current content 3. Rewrite it following the style guide: match the structure, tone, and formatting patterns from the top-performing pages 4. Use `update-docs` to publish the improved version ``` -------------------------------- ### Markdown File Frontmatter Example Source: https://docs.readme.com/main/docs/rdme This is an example of the required YAML frontmatter for Markdown files used with the `rdme` CLI, specifically for the Guides section. Ensure all required attributes are present for successful syncing. ```markdown --- title: Syncing Docs via CLI / GitHub category: uri: Syncing Your Content content: excerpt: Update your docs automatically with `rdme`, ReadMe's official CLI and GitHub Action! --- With ReadMe's support for... ``` -------------------------------- ### Install readmeio Package Source: https://docs.readme.com/main/docs/sending-logs-to-readme-with-nodejs Install the `readmeio` package using npm. This is a prerequisite for integrating with ReadMe Metrics. ```bash npm install readmeio --save ``` -------------------------------- ### Install Required Libraries for Python Source: https://docs.readme.com/main/docs/amazon-api-gateway-webhook Install the readme-metrics package and the boto3 library for AWS interaction using pip. ```shell pip install readme-metrics pip install boto3 ``` -------------------------------- ### Install Gems with Bundler Source: https://docs.readme.com/main/docs/ruby-api-metrics-set-up Run bundle install after adding the gem to your Gemfile to install the new dependency. ```bash bundle install ``` -------------------------------- ### Link Custom Code Samples to Response Examples Source: https://docs.readme.com/main/docs/openapi-extensions Associate a custom code sample with a specific response example by using the `correspondingExample` field. This ensures that when a user selects the linked code sample, the corresponding response example is automatically displayed. This requires defining response examples using the `examples` map in the OpenAPI specification. ```yaml responses: '200': description: OK content: application/json: examples: TestExample: # the identifier is on this line! summary: An example of a cat value: name: Fluffy petType: Cat color: White gender: male breed: Persian ``` -------------------------------- ### Install Required Libraries for Node.js Source: https://docs.readme.com/main/docs/amazon-api-gateway-webhook Install the readmeio npm package and the AWS SDK for API Gateway using npm. ```shell npm install --save readmeio npm install --save @aws-sdk/client-api-gateway ``` -------------------------------- ### Install readme-metrics for Flask Source: https://docs.readme.com/main/docs/python-flask-api-metrics Install the Flask variant of the `readme-metrics` package using pip. This can also be added to your `requirements.txt` file. ```bash pip install "readme-metrics[Flask]" ``` -------------------------------- ### Example User Data for Email Source: https://docs.readme.com/main/docs/personalized-docs Demonstrates how to pass custom user data, such as an email address, into the documentation. This example shows a default value for logged-out users. ```string user@example.com, which is an actual example of a Personalized Docs-powered variable with a default value of user\@example for logged-out users ``` -------------------------------- ### Install ReadMe.Metrics NuGet Package Source: https://docs.readme.com/main/docs/net-setup Use this command to add the ReadMe.Metrics package to your .NET project. ```bash dotnet add package ReadMe.Metrics ``` -------------------------------- ### Install ReadMe Metrics Package Source: https://docs.readme.com/main/docs/sending-logs-to-readme-with-php-laravel Install the `readme/metrics` Composer package for your Laravel application. ```bash composer require readme/metrics ``` -------------------------------- ### Define Custom Code Samples with OpenAPI Extension Source: https://docs.readme.com/main/docs/openapi-extensions Use the `x-readme.code-samples` extension within your OpenAPI specification to provide custom code snippets. This is useful for specific formatting or when auto-generated samples are insufficient. The extension accepts an array of objects, each defining a code sample with its language, code, and optional name, install command, and corresponding response example. ```json "x-readme": { "code-samples": [ { "language": "curl", "code": "curl -X POST https://api.example.com/v2/alert", "name": "Custom cURL snippet", "install": "brew install curl", "correspondingExample": "TestExample" }, { "language": "php", "code": "", "name": "Custom PHP snippet" } ] } ``` -------------------------------- ### JavaScript API Client Example Source: https://docs.readme.com/main/docs/creating-and-managing-guides Demonstrates initializing a ReadMe API client and fetching user data with error handling. Use this pattern for making authenticated requests to your API. ```javascript // Good example - with meaningful comments and clear variable names const apiKey = 'your_api_key_here'; // Initialize the client with your API key const client = new ReadMeAPI(apiKey); // Fetch user data and handle potential errors try { const userData = await client.getUser(userId); console.log(`Found user: ${userData.name}`); } catch (error) { console.error(`Error fetching user: ${error.message}`); } ``` -------------------------------- ### Install Required Libraries for Ruby Source: https://docs.readme.com/main/docs/amazon-api-gateway-webhook Add the readme-metrics gem and the aws-sdk gem to your project's Gemfile. ```shell gem "readme-metrics" gem "aws-sdk" ``` -------------------------------- ### Example HTTP Request from ReadMe Source: https://docs.readme.com/main/docs/personalized-docs-webhook This is an example of the POST request ReadMe sends to your webhook endpoint when a user logs in. It includes the user's email in the JSON body. ```http POST /webhook HTTP/1.1 Content-Type: application/json Host: yourapi.com User-Agent: ReadMe ReadMe-Signature: example-signature (see step 2) { "email": "loggedinuser@site.com" } ``` -------------------------------- ### Synced Branch Example Source: https://docs.readme.com/main/docs/bi-directional-sync Shows the correct naming convention for ReadMe and GitHub branches to ensure successful synchronization. ```text ReadMe: v2.0_new-branch GitHub: v2.0_new-branch ``` -------------------------------- ### Install rdme@10 Globally Source: https://docs.readme.com/main/docs/upgrading-to-rdme10 Use this command to update your globally installed `rdme` CLI to version 10. ```sh npm install -g rdme@10 ``` -------------------------------- ### Example: Customize 'Try It' Button Background for Dark Mode Source: https://docs.readme.com/main/docs/custom-css-with-dark-mode This example demonstrates how to change the background color of the 'Try It' button for both system-detected dark mode and manually selected dark mode. It includes a default style and specific overrides for dark themes. ```css .App .rm-TryIt { --TryIt-background: yellow; } @media (prefers-color-scheme: dark) { [data-color-mode="system"] .App .rm-TryIt { --TryIt-background: purple; } } [data-color-mode="dark"] .App .rm-TryIt { --TryIt-background: purple; } ``` -------------------------------- ### Extract Style Guide from Top Performing Pages Source: https://docs.readme.com/main/docs/readmes-mcp-use-cases Analyze your best-performing documentation pages to extract patterns in structure, tone, and formatting. This prompt uses ReadMe MCP tools to fetch content from top pages and identify common elements for creating a style guide. ```text Use the ReadMe MCP tools to analyze my best-performing documentation. 1. Use `search` to find my top 10 most-viewed or highest-rated pages 2. Use `fetch` to pull the full content of each one 3. Analyze what they have in common: structure, tone, heading patterns, code example placement, length, use of callouts, etc. 4. Write a concise style guide based on these patterns ``` -------------------------------- ### Example Redirects Source: https://docs.readme.com/main/docs/error-pages Define URL redirects using a simple 'oldurl -> newurl' format. Supports regular expressions for dynamic redirection. ```text /docs/top-feature-requests -> /docs/feature-requests /docs/getting-started -> /docs/get-started /docs/ios-sdk -> https://github.com/company/ios-sdk /old/(\S+) -> /new/$1 /([^/\s]+)/([^/\s]+) -> /docs/$2 ``` -------------------------------- ### Configure ReadMe MCP Server in Windsurf Source: https://docs.readme.com/main/docs/skill.md Add this configuration to your Windsurf setup to integrate with the ReadMe MCP server. Replace `` with your actual API key. ```json { "mcpServers": { "readme": { "serverUrl": "https://docs.readme.com/mcp", "headers": { "Authorization": "Basic " } } } } ``` -------------------------------- ### Example OpenAPI Path with Tags Source: https://docs.readme.com/main/docs/openapi-categories-pages-subpages Demonstrates how tags in an OpenAPI document are used to group operations into pages. The first tag listed determines the page title. ```json { "/pet": { "post": { "tags": [ "pet" ], "summary": "Add a new pet to the store", "operationId": "addPet" } } } ``` -------------------------------- ### Upload OpenAPI Spec with GitLab CI Source: https://docs.readme.com/main/docs/rdme Sync your OpenAPI specification with ReadMe using GitLab CI. This example demonstrates how to use the `rdme` CLI and access your API key stored as a CI/CD variable. ```yaml image: node:20 sync-via-rdme: script: - npx rdme@v10 openapi upload [url-or-local-path-to-file] --key=$README_API_KEY ``` -------------------------------- ### Configure Readme::Metrics Middleware (Production) Source: https://docs.readme.com/main/docs/ruby-api-metrics-set-up Configure the Readme::Metrics middleware in config/environments/production.rb. This setup focuses on API key and user identification for production environments. ```ruby require "readme/metrics" options = { api_key: "API_KEY" } config.middleware.use Readme::Metrics, options do |env| current_user = env['warden'].authenticate if current_user.present? { api_key: current_user.id, label: current_user.name, email: current_user.email } else { api_key: "guest", label: "Guest User", email: "guest@example.com" } end end ``` -------------------------------- ### Upload OpenAPI Definition via GitHub Actions Source: https://docs.readme.com/main/docs/rdme This example shows how to translate a CLI command for uploading an OpenAPI definition into a GitHub Actions step. It uses secrets for API key management. ```yaml - uses: readmeio/rdme@v10 with: rdme: openapi upload [url-or-local-path-to-file] --key=${{ secrets.README_API_KEY }} ``` -------------------------------- ### Configure Readme::Metrics Middleware (Development) Source: https://docs.readme.com/main/docs/ruby-api-metrics-set-up Set up the Readme::Metrics middleware in config/environments/development.rb. This example includes API key, development mode flag, and user identification logic for authenticated and guest users. ```ruby require "readme/metrics" options = { api_key: "API_KEY", development: true } config.middleware.use Readme::Metrics, options do |env| current_user = env['warden'].authenticate if current_user.present? { api_key: current_user.id, label: current_user.name, email: current_user.email } else { api_key: "guest", label: "Guest User", email: "guest@example.com" } end end ``` -------------------------------- ### Configure ReadMe MCP Server in Cursor Source: https://docs.readme.com/main/docs/skill.md Add this configuration to your `.cursor/mcp.json` file to set up the ReadMe MCP server. Replace `` with your actual API key. ```json { "mcpServers": { "readme": { "url": "https://docs.readme.com/mcp", "headers": { "Authorization": "Basic " } } } } ``` -------------------------------- ### Initialize ReadMeMetrics with Configuration Source: https://docs.readme.com/main/docs/python-flask-api-metrics Instantiate the ReadMeMetrics extension with various configuration options to control API log behavior. This includes setting the API key, defining a custom grouping function, adjusting buffer length, and specifying allowlisted fields. ```python metrics_extension = ReadMeMetrics( MetricsApiConfig( api_key="KEYS:USER", grouping_function=path.to.your.grouping_function, buffer_length=1, background_worker_mode=False, allowlist=["city", "state", "postal_code", "country"], timeout=15 ) ) ``` -------------------------------- ### Unsynced Branch Example Source: https://docs.readme.com/main/docs/bi-directional-sync Illustrates a naming mismatch between ReadMe and GitHub branches that will prevent synchronization. ```text ReadMe: v2.0_new-branch GitHub: v2-new-branch ``` -------------------------------- ### Configure ReadMe Settings in appsettings.json Source: https://docs.readme.com/main/docs/net-setup Configure your ReadMe API key and logging options in the `appsettings.json` file. This includes setting up allow/deny lists and specifying the development environment. ```json { "readme": { "apiKey": "", "options": { "allowList": [ "" ], "denyList": [ ""], "development": true, "baseLogUrl": "https://example.readme.io" } } } ``` -------------------------------- ### Disable Code Examples Source: https://docs.readme.com/main/docs/openapi-extensions Disable the auto-generation of code samples in API Reference documentation. This extension is no longer supported. ```json { "x-readme": { "samples-enabled": true } } ``` -------------------------------- ### Configure MCP Server with x-readme-auth Header (Password) Source: https://docs.readme.com/main/docs/your-projects-mcp-server This JSON configuration demonstrates setting up an MCP server with the 'x-readme-auth' header for password-protected projects. ```json { "mcpServers": { "My API": { "url": "https://your-project.readme.io/mcp", "headers": { "x-readme-auth": "your-site-password" } } } } ``` -------------------------------- ### Configure Metrics API Client Source: https://docs.readme.com/main/docs/python-django-api-metrics Instantiate the MetricsApiConfig with various parameters to control API key, grouping, buffering, and data allowlisting. ```python README_METRICS_CONFIG = MetricsApiConfig( api_key="API_KEY", grouping_function=path.to.your.grouping_function, buffer_length=1, background_worker_mode=False, allowlist=["city", "state", "postal_code", "country"], timeout=15 ) ``` -------------------------------- ### Configure Stainless for ReadMe Code Samples Source: https://docs.readme.com/main/docs/stainless Add this configuration to your `openapi.stainless.yml` file to enable code sample generation for ReadMe. ```yaml openapi: code_samples: readme ``` -------------------------------- ### Columns Component Example Source: https://docs.readme.com/main/docs/built-in-components Use the Columns component to create a multi-column layout for side-by-side content. The 'layout' prop controls the distribution. ```mdx Neque porro quisquam est qui dolorem ipsum quia *Lorem ipsum dolor sit amet, consectetur adipiscing elit* > Ut enim ad minim veniam, quis nostrud ullamco ``` -------------------------------- ### Accordion Component Example Source: https://docs.readme.com/main/docs/built-in-components Use the Accordion component to present information in collapsible sections. It accepts a 'title' and an optional 'icon' prop. ```mdx Lorem ipsum dolor sit amet, **consectetur adipiscing elit.** Ut enim ad minim veniam, quis nostrud exercitation ullamco. Excepteur sint occaecat cupidatat non proident! ``` -------------------------------- ### Example Server Variable Template Source: https://docs.readme.com/main/docs/personalized-docs This is a common template for APIs that use server variables for regional endpoints. Users can select their region from a dropdown. ```string https://{region}.api.example.com ``` -------------------------------- ### Tabs Component Example Source: https://docs.readme.com/main/docs/built-in-components Use the Tabs component to organize related content into navigable sections. Each Tab component must have a 'title' prop. ```mdx Welcome to the content that you can only see inside the first Tab. Here's content that's only inside the second Tab. Here's content that's only inside the third Tab. ``` -------------------------------- ### Example OpenAPI Path without Tags Source: https://docs.readme.com/main/docs/openapi-categories-pages-subpages Illustrates how endpoints are grouped under their URL when tags are not present in the OpenAPI document. Each method forms a subpage under the URL. ```json { "/pet": { "post": { "summary": "Add a new pet to the store", "operationId": "addPet" } } } ```