Access tokens

Make a token

The answer holds the value once; only its SHA-256 is kept. The new token gets the scopes you name, each of which the calling token must hold (403 otherwise), the calling token's rate limit, and an end within a year that is not after the calling token's own end (a year from now, or the calling token's end if sooner, when none is sent). It is never the primary token, and revoking the calling token later revokes it too.

post/access-tokens

Request

  • Base URL
    https://gorest.co.in/public/v3
  • URL
    https://gorest.co.in/public/v3/access-tokens
  • Auth
    HTTP bearer

Headers

Idempotency-Keystring

A unique key (a UUID is fine) that makes a POST safe to retry for 24 hours. A retry with the same key, path and body gets the first answer again with Idempotent-Replayed: true and creates nothing; a retry while the first is still running gets 409 conflict with Retry-After: 1. The same key with another request gets 422 idempotency_key_mismatch. Only a 2xx answer is kept, so after an error the retry runs again. An answer over 64 KiB, or one that holds a new token's value, is not kept: its retry gets 409 conflict with the Location of what the first request made.

Request body

expires_atstring date-time

When the token stops working; within a year, and not after the calling token's own end.

labelstring required

A name to remember the token by; unique among your tokens.

scopesScope[] required

Example request

{
  "label": "CI deploy",
  "scopes": [
    "posts:read",
    "posts:write"
  ]
}

Response

The new token, with its value. Not stored by any cache.

created_atstring date-time required
expires_atstring date-time nullable required

When the token stops working; null for an older token with no end.

idstring uuid required
is_primaryboolean required

The account's first token; it cannot be revoked.

labelstring required
last4string required

The last 4 characters of the value.

made_bystring uuid nullable required

The token that made this one here; revoking that token revokes this one too. null for a token made on the site.

rate_limitinteger required

Calls a minute.

scopesScope[] required
valuestring required

The token itself, shown only in this answer. Send it as Authorization: Bearer <value>.

Example response

{
  "label": "My app"
}

Changes

No recorded changes to this operation across all 1 revision of this API.