Access tokens

Create access token

POST
/api/v2/tokens

Create a new access token.

Authorization

ApiKey read, write
Authorization<token>

In: header

Scope: read, write

Request Body

application/json

name?string

A human-friendly name for the access token

description?string

A description for the access token

role?string

Base role for the token

Value in

  • "reader"
  • "writer"
  • "admin"
customRoleIds?array<string>

A list of custom role IDs to use as access limits for the access token

inlineRole?array<>

A JSON array of statements represented as JSON objects with three attributes: effect, resources, actions. May be used in place of a role.

serviceToken?boolean

Whether the token is a service token

defaultApiVersion?integer

The default API version for this token

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v2/tokens" \  -H "Content-Type: application/json" \  -d '{    "role": "reader"  }'
{  "_id": "61095542756dba551110ae21",  "ownerId": "569f514156e003339cfd3917",  "memberId": "569f514183f2164430000002",  "_member": {    "_links": {      "self": {        "href": "/api/v2/members/569f183514f4432160000007",        "type": "application/json"      }    },    "_id": "569f183514f4432160000007",    "firstName": "Ariel",    "lastName": "Flores",    "role": "admin",    "email": "ariel@acme.com"  },  "name": "Example reader token",  "description": "A reader token used in testing and examples",  "creationDate": "1628001602644",  "lastModified": "1628001602644",  "customRoleIds": [],  "inlineRole": [],  "role": "reader",  "token": "1234",  "serviceToken": false,  "_links": {    "parent": {      "href": "/api/v2/tokens",      "type": "application/json"    },    "self": {      "href": "/api/v2/tokens/61095542756dba551110ae21",      "type": "application/json"    }  },  "defaultApiVersion": 20240415,  "lastUsed": "0",  "expiry": "1735689600000"}