x-codeSamples extension, or pull them from Speakeasy.
Choose example languages
Setapi.examples.languages in your docs.json to choose which languages appear in generated examples. Languages display in the order you list them.
docs.json
defaults to required to leave optional parameters out of generated examples. The default, all, includes them.
All supported languages
All supported languages
api.examples.autogenerate to false. Endpoint pages then show only x-codeSamples from your specification, or <RequestExample> components on MDX pages.
Write your own examples
Add thex-codeSamples property to any operation. It has the following schema.
The label for the sample. This is useful when providing multiple examples for a single endpoint.
Generate examples with Speakeasy
If you generate your SDKs with Speakeasy, you can pull its autogenerated snippets into your API reference instead of maintaining them by hand. The snippets appear in the interactive playground alongside your endpoints.1
Get the combined spec URL from the registry
Go to your Speakeasy Dashboard and open the API Registry tab. Open the 
From the registry entry’s page, copy the provided public URL.
*-with-code-samples entry for your API.
If the entry is not labeled Combined Spec, ensure that your API has an automated code sample URL configured.
2
Add the combined spec URL to your docs.json file
Add the combined spec URL to an anchor or a tab in the
navigation object of your docs.json file.3
Verify the integration
After you redeploy your documentation, open any endpoint in your API reference and confirm that language snippets appear in the playground. The set of available languages matches the SDK targets configured in your Speakeasy project.If snippets do not appear, check that:
- The
openapiURL indocs.jsonpoints to the*-with-code-samplescombined spec entry, not the source OpenAPI file. - The combined spec URL is publicly reachable from the browser.
- Your Speakeasy project has an automated code sample URL configured and at least one SDK target enabled.