security

Create a Personal Access Token (PAT)

Changed on

Generate a new Personal Access Token for programmatic API access. PATs are long-lived tokens that can be used instead of regular authentication for automated systems. Requires elevated permissions.

post/pat

Request

  • Base URL
    https://{subdomain}.auth.{region}.nhost.run/v1
  • URL
    https://{subdomain}.auth.{region}.nhost.run/v1/pat
  • Auth
    HTTP bearer

Request body

expiresAtstring date-time required

Expiration date of the PAT

metadataobject

Example request

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

Response

Successfully created a Personal Access Token

idstring required

ID of the PAT

personalAccessTokenstring required

PAT

Example response

{
  "id": "2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24",
  "personalAccessToken": "2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24"
}

Changes

    • warning

      added the new otp-too-many-attempts enum value to the response property for the response status

    • warning

      added the new user-already-exists enum value to the response property for the response status

    • info

      removed the email-already-in-use enum value from the response property for the response status