Skip to content
Skip to Content

Create an API key

POST
/api-keys

The key acts as you, never with more than your own access, capped by its scope and optionally limited to some projects. The key is in this answer only.

Authorization

bearer
headerAuthorizationBearer <token>

An API key (opk_…) or a CLI token (opc_…).

Request body

application/json
  1. body
name*string

Where the key is used, such as "GitHub Actions".

Length1 <= length <= 60
scope*string

The most the key may do: view, deploy or admin. It never does more than its creator's own access.

Value in"view""deploy""admin"
projectIds?array<>|

Limit the key to these projects.

expiresAt?|null

Response body

Create an API key

application/json
  1. response
apiKey*
key*string

The key itself (opk_…). Shown only in this answer; store it now.

Example request
curl -X POST "https://openpanel.sh/api/v1/api-keys" \  -H "Authorization: Bearer $OPENPANEL_TOKEN" \  -H "Content-Type: application/json" \  -d '{  "name": "string",  "scope": "view"}'
Example response
{  "apiKey": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "prefix": "string",    "scope": "view",    "projectIds": [      "b2d9859a-b2e9-4f49-b393-9a25d0eff2f8"    ],    "expiresAt": "2019-08-24T14:15:22Z",    "lastUsedAt": "2019-08-24T14:15:22Z",    "revokedAt": "2019-08-24T14:15:22Z",    "createdAt": "2019-08-24T14:15:22Z",    "createdBy": "string",    "creatorName": "string",    "creatorEmail": "string"  },  "key": "string"}