> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flexprice.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Swagger UI

> Explore the Flexprice API interactively: the built-in playground on this site, or a local Swagger UI against the spec or a self-hosted instance

You do not need to run anything to try the API. Every endpoint page in the [API Reference](/api-reference/introduction) has a playground: choose the region, paste an API key, edit the body, and send. This page covers running Swagger UI yourself for cases the playground does not reach, such as a self-hosted deployment on a private network or a spec build from a branch.

## Run Swagger UI locally

Swagger UI is a static site that renders any OpenAPI document. Run it in Docker against the published spec:

```sh theme={null}
curl -sSL https://docs.flexprice.io/api-reference/openapi.json -o flexprice-openapi.json

docker run --rm -p 8081:8080 \
  -e SWAGGER_JSON=/spec/flexprice-openapi.json \
  -v "$PWD:/spec" \
  swaggerapi/swagger-ui
```

Open `http://localhost:8081`, click **Authorize**, and enter your API key for `ApiKeyAuth`. The **Servers** dropdown lists the US and India regions from the spec.

<Warning>
  Requests from a local Swagger UI go straight to the Flexprice API with your key. Use a sandbox key while exploring.
</Warning>

## Running Swagger UI against a self-hosted instance

A self-hosted Flexprice backend ships the same spec at `docs/swagger/swagger-3-0.json` in the repository. Serve Swagger UI next to it and point the server URL at your deployment:

```sh theme={null}
docker run --rm -p 8081:8080 \
  -e SWAGGER_JSON=/spec/swagger-3-0.json \
  -v "$PWD/docs/swagger:/spec" \
  swaggerapi/swagger-ui
```

Then in the UI, replace the server with `http://localhost:8080/v1` (or your host) using the **Servers** dropdown's editable field. If the browser blocks the request, the backend's CORS setting needs to include the Swagger UI origin. See [Configuration](/docs/getting-started/configuration).

## Swagger UI, Postman, or the API reference?

| Tool                                       | Best for                                                                |
| ------------------------------------------ | ----------------------------------------------------------------------- |
| API Reference playground                   | Trying Flexprice Cloud endpoints with no setup                          |
| Swagger UI                                 | Self-hosted deployments, branch builds of the spec, air-gapped networks |
| [Postman](/developers/api-tooling/postman) | Saved requests, environments per region, sharing with a team            |
| [CLI](/docs/cli/overview)                  | Scripting and anything you want to repeat                               |

<CardGroup cols={2}>
  <Card icon="https://mintcdn.com/flexprice/G4Mu88HxYrwMrXoR/images/developers/icons/openapi.svg?fit=max&auto=format&n=G4Mu88HxYrwMrXoR&q=85&s=86c60dde91a4f53efc99608d54c919d0" title="OpenAPI spec" href="/developers/api-tooling/openapi-spec" width="32" height="32" data-path="images/developers/icons/openapi.svg" />

  <Card icon="https://mintcdn.com/flexprice/G4Mu88HxYrwMrXoR/images/developers/icons/server.svg?fit=max&auto=format&n=G4Mu88HxYrwMrXoR&q=85&s=72538ffa0b9dbc84bc1ddc60f0d0a266" title="Self-hosting guide" href="/docs/getting-started/self-hosting-guide" width="32" height="32" data-path="images/developers/icons/server.svg" />
</CardGroup>
