# API overview

Source: https://openpanel.sh/docs/api

The public API at openpanel.sh/api/v1: its address, requests and answers, lists, retries, limits, and the reference made from its OpenAPI file.

The OpenPanel API does over HTTP and JSON what you do with projects, services, deploys, variables, domains and API keys. The [CLI](/docs/cli) and the [MCP server](/docs/ai) are made from the same list of operations, so each command and each MCP tool is exactly one API call, with the same checks and the same answers.

```txt
https://openpanel.sh/api/v1
```

## Your first call [#your-first-call]

Make an API key (see [Authentication](/docs/api/authentication)), keep it in `OPENPANEL_TOKEN`, and ask who you are:

<Tabs items={["curl","TypeScript","Python"]}>
<Tab value="curl">
```sh
curl https://openpanel.sh/api/v1/me \
  -H "Authorization: Bearer $OPENPANEL_TOKEN"
```
</Tab>

<Tab value="TypeScript">
```ts
const response = await fetch("https://openpanel.sh/api/v1/me", {
  headers: { Authorization: `Bearer ${process.env.OPENPANEL_TOKEN}` },
})
if (!response.ok) throw new Error((await response.json()).detail)
const me = await response.json()
console.log(me.organization.name, me.credential.scope)
```
</Tab>

<Tab value="Python">
```python
import os
import requests

response = requests.get(
    "https://openpanel.sh/api/v1/me",
    headers={"Authorization": f"Bearer {os.environ['OPENPANEL_TOKEN']}"},
)
if not response.ok:
    raise RuntimeError(response.json()["detail"])
me = response.json()
print(me["organization"]["name"], me["credential"]["scope"])
```
</Tab>
</Tabs>

The answer names the person behind the key, the organization the call works in and what the key may do:

```json
{
  "user": { "id": "…", "name": "Rūta Kazlauskė", "email": "ruta@example.com" },
  "organization": { "id": "…", "name": "Shop", "slug": "shop", "logo": null, "role": "owner", "personal": false },
  "credential": { "kind": "key", "via": null, "keyId": "…", "scope": "deploy", "projectIds": null }
}
```

## Requests and answers [#requests-and-answers]

- Send bodies as JSON with `Content-Type: application/json`. A body is at most 256 KB.
- Answers are JSON. A change that returns nothing answers `204 No Content`; a create answers `201 Created` with what it made.
- Ids are UUIDs. Where a path takes `{projectId}` or `{serviceId}`, it is the id, not the name or slug; the CLI looks names up for you.
- Times are ISO 8601 in UTC, such as `2026-12-01T19:47:19.929Z`.
- Every answer carries `X-Request-Id`. Send it to us when you [ask for help](/docs/troubleshooting/get-help) with a request.
- A setting you change on a service takes effect at its next deploy. See [Deployments](/docs/concepts/deployments).

## Organizations [#organizations]

An API key belongs to the organization it was made in and works only there. The CLI's token from `openpanel login` is the person's own sign-in and works in every organization they belong to: send `OpenPanel-Organization` with the organization's id or slug to choose one. Without the header, the call works in the organization that sign-in last chose, or else in the person's own.

```sh
curl https://openpanel.sh/api/v1/projects \
  -H "Authorization: Bearer $OPENPANEL_TOKEN" \
  -H "OpenPanel-Organization: shop"
```

With an API key, the header may only name the key's own organization; any other answers `403`.

## Lists [#lists]

A list answers one page: `{ "data": [...], "nextCursor": "…" }`. Pass `nextCursor` back as `cursor` for the next page, until `nextCursor` is `null`. `limit` is 1 to 100, and 50 when you leave it out.

```sh
curl "https://openpanel.sh/api/v1/projects?limit=20&cursor=MjA6MDE5M2I3YTA…" \
  -H "Authorization: Bearer $OPENPANEL_TOKEN"
```

A cursor remembers the last item it returned, so a list that changes between two pages continues after the same item.

## Retries [#retries]

The calls that create something accept an `Idempotency-Key` header: creating an API key, a project, a service, a volume, a deployment, a rollback and a domain. Send any unique string of up to 255 characters. If the answer is lost and you send the same request with the same key again, the API returns the first answer, with `Idempotent-Replayed: true`, instead of creating a second one.

```sh
curl https://openpanel.sh/api/v1/services/$SERVICE_ID/deployments \
  -X POST \
  -H "Authorization: Bearer $OPENPANEL_TOKEN" \
  -H "Idempotency-Key: deploy-$GITHUB_SHA"
```

- A key is kept for 24 hours, and only after a success: when a create fails, the same key can be used again once you fix the request.
- The same key with a different request answers `422` with the code `idempotency_mismatch`.
- While the first request with a key is still running, a second one answers `409`.

## Rate limits [#rate-limits]

Each API key, and each person's token, may make 600 requests a minute. Requests without a working credential are limited to 60 a minute per address. Above the limit the API answers `429` with `Retry-After: 60`.

## Errors [#errors]

Every error is a problem detail (RFC 9457) with a stable `code` and a `detail` written for a person:

```json
{
  "type": "https://openpanel.sh/docs/api/errors#invalid",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid",
  "detail": "Turn on the load balancer to run more than one replica of a public service."
}
```

[Errors](/docs/api/errors) lists every code and what to do about it.

## Not offered yet [#not-offered-yet]

A few operations are in the reference but answer `501` with the code `not_implemented` and a sentence that says where to do it instead: inviting a member, and connecting or buying a server. Their pages say so at the top.

## The reference [#the-reference]

Every operation has its own page in the sidebar, grouped by what it works on, with its parameters, its body, its answers and a request in curl, TypeScript and Python. The reference is made from [openapi.yaml](https://openpanel.sh/openapi.yaml), an OpenAPI 3.1 file generated from the same list of operations the API runs, so the two cannot drift apart. Point a client generator at that file to make a typed client.

<Cards>
<Card href="/docs/api/authentication" title="Authentication" description="API keys, their scopes, and the other ways in." />

<Card href="/docs/api/errors" title="Errors" description="Every error code and what to do about it." />

<Card href="/docs/api/projects/create-a-project" title="Create a project" description="The first call of most scripts." />

<Card href="/docs/api/deployments/deploy-a-service" title="Deploy a service" description="Deploy what a service is set to now." />
</Cards>