POST
/
pat
Create Personal Access Token (PAT)
curl --request POST \
  --url https://local.auth.nhost.run/v1/pat \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "expiresAt": null,
  "metadata": {}
}'
{
  "accessToken": "<string>",
  "accessTokenExpiresIn": 123,
  "refreshToken": "2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24",
  "user": {
    "activeMfaType": "totp",
    "avatarUrl": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "defaultRole": "user",
    "displayName": "John Smith",
    "email": "john.smith@nhost.io",
    "emailVerified": false,
    "id": "2c35b6f3-c4b9-48e3-978a-d4d0f1d42e24",
    "isAnonymous": false,
    "locale": "en",
    "metadata": {
      "firstName": "John",
      "lastName": "Smith"
    },
    "phoneNumber": "<string>",
    "phoneNumberVerified": false,
    "roles": [
      "me",
      "user"
    ]
  }
}

Authorizations

Authorization
string
header
required

JSON Web Token to authorize requests.

Body

application/json
expiresAt
string<date-time>
required

The expiration date and time of the personal access token

Example:

null

metadata
object

Additional metadata associated with the personal access token

Response

User successfully authenticated

accessToken
string
required
accessTokenExpiresIn
number
required
refreshToken
string
required

Refresh token during authentication or when refreshing the JWT

Example:

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

user
object