The access tokens API allows you to list, create, modify, and delete access tokens programmatically.
When using access tokens to manage access tokens, the following restrictions apply:
Several of the endpoints in the access tokens API require an access token ID. The access token ID is returned as part of the Create access token and List access tokens responses. It is the _id
field, or the _id
field of each element in the items
array.
To learn more about access tokens, read API access tokens.
Fetch a list of all access tokens.
Access tokens collection response
Invalid access token
Forbidden
Rate limited
{- "items": [
- {
- "_id": "string",
- "ownerId": "string",
- "memberId": "string",
- "_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": 0,
- "lastModified": 0,
- "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": 20220603,
- "lastUsed": 0
}
], - "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}, - "totalCount": 0
}
Create a new access token.
name | string A human-friendly name for the access token |
description | string A description for the access token |
role | string Built-in role for the token |
customRoleIds | Array of strings A list of custom role IDs to use as access limits for the access token |
Array of objects (StatementPost) A JSON array of statements represented as JSON objects with three attributes: effect, resources, actions. May be used in place of a built-in or custom role. | |
serviceToken | boolean Whether the token is a service token https://docs.launchdarkly.com/home/account/api#service-tokens |
defaultApiVersion | integer The default API version for this token |
Access token response
Invalid request
Invalid access token
Forbidden
Rate limited
{- "role": "reader"
}
{- "_id": "string",
- "ownerId": "string",
- "memberId": "string",
- "_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": 0,
- "lastModified": 0,
- "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": 20220603,
- "lastUsed": 0
}
Get a single access token by ID.
Access token response
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "_id": "string",
- "ownerId": "string",
- "memberId": "string",
- "_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": 0,
- "lastModified": 0,
- "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": 20220603,
- "lastUsed": 0
}
Update an access token's settings. Updating an access token uses a JSON patch representation of the desired changes. To learn more, read Updates.
Access token response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Status conflict
Invalid patch content
Rate limited
[- {
- "op": "replace",
- "path": "/role",
- "value": "writer"
}
]
{- "_id": "string",
- "ownerId": "string",
- "memberId": "string",
- "_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": 0,
- "lastModified": 0,
- "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": 20220603,
- "lastUsed": 0
}
Delete an access token by ID.
Action succeeded
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "code": "unauthorized",
- "message": "Invalid access token"
}
Reset an access token's secret key with an optional expiry time for the old key.
Access token response
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "_id": "string",
- "ownerId": "string",
- "memberId": "string",
- "_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": 0,
- "lastModified": 0,
- "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": 20220603,
- "lastUsed": 0
}