## Getting Started

ο»Ώ[Extensions](πŸ”—ο»Ώ) are properties added to an OpenAPI spec that customize your API Reference user experience. All of these properties are optional.

ReadMe extensions are defined by the `x-readme` object and most can be placed either on the root level of your spec, or on the operation level. See the [Extension Usage](πŸ”—ο»Ώ) section below for specific details.

Want to see a spec file that utilizes these extensions? Take a look at the example demo spec file [here](πŸ”—ο»Ώ).

## Usage

Unless otherwise noted below all of our custom OpenAPI extensions can be defined on the root level of your API definition within a `x-readme` object:

ο»Ώ

If you don't want to use `x-readme` in your spec, you can define each extension as `x-<extension_name>` instead:

ο»Ώ

### Operation-level usage

You can also define each extension on the operation-level to individually control their functionality on an operation-by-operation basis. If an extension is defined at both the operation and root levels, the operation-level extension takes presedence.

ο»Ώ

You can also define the extension using the `x-<extension_name>` format instead:

ο»Ώ

## Available Extensions

### Disable the API Explorer

Disables the API Explorer's "Try It" button, preventing users from making API requests from within your docs. Users will still be able to fill out any entry fields (path or query parameters, etc.), and code snippets will be auto-generated based on the user's input, however to interact with your API the user will need to copy the code snippet and execute it outside of your docs.

This **does not** disable your API Reference documentation.

<!-- prettier-ignore-start -->

ExtensionDefault value
`x-readme.explorer-enabled``true`

<!-- prettier-ignore-end -->

ο»Ώ

<!-- prettier-ignore-start -->

1161
ο»Ώ

Screenshot of the API Explorer with the "Try It" button disabled and omitted. Note that filled out fields will still update the code sample.

<!-- prettier-ignore-end -->

### Code sample languages

Toggles what languages are shown by default for code samples in the API Explorer. This only affects what languages are initially shown to the user; if the user picks another language from the three-dot menu, that language and the respective auto-generated code snippet will also appear as an option in the API Explorer.

ο»Ώ

We built a Node package called [`api`](πŸ”—ο»Ώ) that magically generates an SDK from an OpenAPI definition! To see `api` in action visit our [API documentation](πŸ”—ο»Ώ)!

<!-- prettier-ignore-start -->

ExtensionDefault value
`x-readme.samples-languages``['shell', 'node', 'ruby', 'javascript', 'python']`

<!-- prettier-ignore-end -->

ο»Ώ

These are the languages supported by way of the [httpsnippet](πŸ”—ο»Ώ) library:

<!--This table was grabbed from here: https://github.com/readmeio/oas-to-snippet#supported-languages -->

<!-- prettier-ignore-start -->

LanguageAvailable language mode(s)Libraries (if applicable)\*
C`c`ο»Ώ[Libcurl](πŸ”—ο»Ώ)ο»Ώ
Clojure`clojure`ο»Ώ[clj-http](πŸ”—ο»Ώ)ο»Ώ
C++`cplusplus`ο»Ώ[Libcurl](πŸ”—ο»Ώ)ο»Ώ
C#`csharp`ο»Ώ[HttpClient](πŸ”—ο»Ώ), [RestSharp](πŸ”—ο»Ώ)ο»Ώ
HTTP`http`ο»Ώ[HTTP/1.1](πŸ”—ο»Ώ)ο»Ώ
Go`go`ο»Ώ[NewRequest](πŸ”—ο»Ώ)ο»Ώ
Java`java`ο»Ώ[AsyncHttp](πŸ”—ο»Ώ), [java.net.http](πŸ”—ο»Ώ), [OkHttp](πŸ”—ο»Ώ), [Unirest](πŸ”—ο»Ώ)ο»Ώ
JavaScript`javascript`ο»Ώ[XMLHttpRequest](πŸ”—ο»Ώ), [Axios](πŸ”—ο»Ώ), [fetch](πŸ”—ο»Ώ), [jQuery](πŸ”—ο»Ώ)ο»Ώ
JSON`json`ο»Ώ[Native JSON](πŸ”—ο»Ώ)ο»Ώ
Kotlin`kotlin`ο»Ώ[OkHttp](πŸ”—ο»Ώ)ο»Ώ
Node.js`node`ο»Ώ[`api`](πŸ”—ο»Ώ), [HTTP](πŸ”—ο»Ώ), [Request](πŸ”—ο»Ώ), [Unirest](πŸ”—ο»Ώ), [Axios](πŸ”—ο»Ώ), [Fetch](πŸ”—ο»Ώ)ο»Ώ
Objective-C`objectivec`ο»Ώ[NSURLSession](πŸ”—ο»Ώ)ο»Ώ
OCaml`ocaml`ο»Ώ[CoHTTP](πŸ”—ο»Ώ)ο»Ώ
PHP`php`ο»Ώ[cURL](πŸ”—ο»Ώ), [Guzzle](πŸ”—ο»Ώ), [HTTP v1](πŸ”—ο»Ώ), [HTTP v2](πŸ”—ο»Ώ)ο»Ώ
Powershell`powershell`ο»Ώ[Invoke-WebRequest](πŸ”—ο»Ώ), [Invoke-RestMethod](πŸ”—ο»Ώ)ο»Ώ
Python`python`ο»Ώ[Requests](πŸ”—ο»Ώ)ο»Ώ
R`r`ο»Ώ[httr](πŸ”—ο»Ώ)ο»Ώ
Ruby`ruby`ο»Ώ[net::http](πŸ”—ο»Ώ)ο»Ώ
Shell`shell`ο»Ώ[cURL](πŸ”—ο»Ώ), [HTTPie](πŸ”—ο»Ώ), [Wget](πŸ”—ο»Ώ)ο»Ώ
Swift`swift`ο»Ώ[NSURLSession](πŸ”—ο»Ώ)ο»Ώ

<!-- prettier-ignore-end -->

\*This column documents any supported HTTP libraries for a given language mode. The `x-readme.samples-languages` array should contain language values (i.e. values from the second column like `node` or `php`) and **not** library names (i.e., values from the third column like `axios` or `guzzle`).

<!-- prettier-ignore-start -->

1160
ο»Ώ

Screenshot of the API Explorer with "x-readme.sample-languages" set to Swift; note the Swift language shows up first above the code snippet.

<!-- prettier-ignore-end -->

### Custom code samples

Enables custom-written code samples to be set for your operations. Use this if you have specific formatting that may not be followed by the auto-generated code samples.

ο»Ώ

Custom code samples are treated as static content, so it's not possible to populate a code sample with [enduser data from a custom login (JWT)](πŸ”—ο»Ώ).

ο»Ώ

This extension can only be set on the operation level

<!-- prettier-ignore-start -->

ExtensionDefault value
`x-readme.code-samples``[]`

<!-- prettier-ignore-end -->

This must be provided as an array of JSON objects containing:

<!-- prettier-ignore-start -->

KeyRequirementDescription
`language`**Required**The language of the code sample. See the list of supported languages [above](πŸ”—ο»Ώ).
`code`**Required**Your custom code. It should preferrably be neat and tidy.
`name`_Optional_A short name for your code sample. If none is provided we use the creative name `default`.
`install`_Optional_If an external library is required for your code sample to function this can be a single command your users can run to install that library. For example of your code sample requires a custom Ruby SDK you can set this as `gem install our-inhouse-sdk`.

<!-- prettier-ignore-end -->

ο»Ώ

<!-- prettier-ignore-start -->

1160
ο»Ώ

Screenshot of the API Explorer with an example spec utilizing the x-code-samples extension. Note the dropdown showing different snippets for the cURL (Shell) language.

<!-- prettier-ignore-end -->

### CORS proxy enabled

Toggles the CORS proxy used when making API requests from within your docs (via the "Try It" button). If your API is already set up to return CORS headers, you can safely disable this feature.

Disabling the CORS proxy will make the request directly from the user's browser and will prevent [Metrics](πŸ”—ο»Ώ) data from being logged by us unless [Metrics have already set up on your backend](πŸ”—ο»Ώ).

<!-- prettier-ignore-start -->

ExtensionDefault value
`x-readme.proxy-enabled``true`

<!-- prettier-ignore-end -->

ο»Ώ

### Static headers

Adds static headers to add to each request. Use this when there are specific headers unique to your API.

<!-- prettier-ignore-start -->

ExtensionDefault value
`x-readme.headers``[]`

<!-- prettier-ignore-end -->

Headers must be provided as an array of objects with `key` and `value` properties.

ο»Ώ

<!-- prettier-ignore-start -->

1159
ο»Ώ

Screenshot of the API Explorer with a custom static header "x-api-key" defined in its spec.

<!-- prettier-ignore-end -->

### Authentication defaults

Sets the default API Key or OAuth2 token used when making API requests from your docs. Other authentication types are not supported.

Unlike the other extensions we provide, authentication defaults are set using `x-default` in your `securitySchemes` object. Defaults can only be set for `oauth2` and `apiKey` authentication types.

ο»Ώ
ο»Ώ

### Disable API Metrics

Disables API requests from the API Explorer's "Try It" button from being sent into our [API Metrics](πŸ”—ο»Ώ) for you and your users. Additionally on any API endpoint that this is disabled on your users will not see lists or graphs of previous requests they've made against that API endpoint β€” either through the API Explorer's interactivity or through one of our [Metrics SDKs](πŸ”—ο»Ώ) (if you have those installed on your API).

<!-- prettier-ignore-start -->

ExtensionDefault value
`x-readme.metrics-enabled``true`

<!-- prettier-ignore-end -->

## Deprecated and Unsupported Extensions

The extensions below are deprecated or are no longer supported in the most recent version of the [API Reference Design](πŸ”—ο»Ώ). These are documented for reference purposes only.

### Send defaults

ο»Ώ

This extension is deprecated and all defaults will be sent via the API Explorer.

Whether to send the defaults specified in your OpenAPI document, or render them as placeholders.

<!-- prettier-ignore-start -->

ExtensionDefault value
`x-readme.send-defaults``false`

<!-- prettier-ignore-end -->

ο»Ώ

### Disable code examples

ο»Ώ

This extension is no longer supported in the [new API Reference Design](πŸ”—ο»Ώ).

Disable auto-generated code samples from appearing on your API Reference operation documentation.

<!-- prettier-ignore-start -->

ExtensionDefault value
`x-readme.samples-enabled``true`

<!-- prettier-ignore-end -->

ο»Ώ

## Support

Questions? [Contact Support](πŸ”—ο»Ώ), we don't bite!