Skip to main content
POST
/
pat
Create a Personal Access Token (PAT)
curl --request POST \
  --url https://{subdomain}.auth.{region}.nhost.run/v1/pat \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "expiresAt": "2023-11-07T05:31:56Z",
  "metadata": {
    "name": "my-pat",
    "used-by": "my-app-cli"
  }
}'
{
  "id": "2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24",
  "personalAccessToken": "2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24"
}

Authorizations

Authorization
string
header
required

Bearer authentication that requires elevated permissions. Used for sensitive operations that may require additional security measures such as recent authentication. For details see https://docs.nhost.io/guides/auth/elevated-permissions

Body

application/json

Personal Access Token creation request with expiration and metadata

expiresAt
string<date-time>
required

Expiration date of the PAT

metadata
object
Example:
{ "name": "my-pat", "used-by": "my-app-cli" }

Response

Successfully created a Personal Access Token

id
string
required

ID of the PAT

Example:

"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24"

personalAccessToken
string
required

PAT

Example:

"2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24"

I