Skip to main content
POST
/
api-keys
Create a User API Key
curl --request POST \
  --url https://api.xata.tech/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "expiry": "2023-11-07T05:31:56Z",
  "scopes": [
    "<string>"
  ],
  "projects": [
    "<string>"
  ],
  "branches": [
    "<string>"
  ]
}
'
{
  "key": {
    "id": "<string>",
    "name": "<string>",
    "preview": "<string>",
    "scopes": [
      "<string>"
    ],
    "projects": [
      "<string>"
    ],
    "branches": [
      "<string>"
    ],
    "created_at": "2023-11-07T05:31:56Z",
    "expiry": "2023-11-07T05:31:56Z",
    "last_used": "2023-11-07T05:31:56Z",
    "token": "<string>",
    "created_by": "<string>",
    "created_by_key": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://xata.io/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json
name
string
required
expiry
string<date-time> | null

Expiration date for the API key, null for no expiry

scopes
string[]

Optional scopes assigned to the API key

Maximum array length: 50
projects
string[]

Limit access to these projects

Maximum array length: 50
branches
string[]

Limit access to these branches

Maximum array length: 50

Response

API Key created successfully

key
object
required