> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://mintlify.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://mintlify.manicule.dev/api/mcp.
> Every agent surface: https://mintlify.manicule.dev/.well-known/llms-manifest.json

# Add SDK examples (/api-playground/adding-sdk-examples)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 381 · updated: 2026-07-31 -->
Related: [API playground overview](/api-playground/overview.md), [OpenAPI setup](/api-playground/openapi-setup.md), [Complex data types](/api-playground/complex-data-types.md), [Manage page visibility](/api-playground/managing-page-visibility.md), [Multiple responses](/api-playground/multiple-responses.md), [Create manual API pages](/api-playground/mdx-setup.md)

> Add SDK code samples to your API documentation with autogenerated examples from Speakeasy and Stainless across multiple languages.

If your users interact with your API through an SDK rather than direct network requests, add SDK code samples with the `x-codeSamples` extension. Mintlify displays these samples on your OpenAPI pages.

Add this property to any request method. It has the following schema.

<ParamField body="lang" type="string" required>The language of the code sample.</ParamField>

<ParamField body="label" type="string">The label for the sample. This is useful when providing multiple examples for a single endpoint.</ParamField>

<ParamField body="source" type="string" required>The source code of the sample.</ParamField>

The following example shows code samples for a plant tracking app that has both a Bash CLI tool and a JavaScript SDK.

```yaml
paths:
  /plants:
    get:
      # ...
      x-codeSamples:
        - lang: bash
          label: List all unwatered plants
          source: |
            planter list -u
        - lang: javascript
          label: List all unwatered plants
          source: |
            const planter = require('planter');
            planter.list({ unwatered: true });
        - lang: bash
          label: List all potted plants
          source: |
            planter list -p
        - lang: javascript
          label: List all potted plants
          source: |
            const planter = require('planter');
            planter.list({ potted: true });
```
