For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • REST API overview
    • Access Tokens
      • POSTCreate access token
      • DELDelete access token
      • GETGet access token
      • GETList access tokens
      • PATCHPatch access token
      • POSTReset access token
    • Account Members
    • Account Usage Beta
    • AI Configs
    • Announcements
    • Applications Beta
    • Approvals
    • Approvals Beta
    • Audit Log
    • Code References
    • Contexts
    • Context Settings
    • Custom Roles
    • Data Export Destinations
    • Environments
    • Experiments
    • Feature Flags
    • Feature Flags Beta
    • Flag Import Configurations Beta
    • Flag Links Beta
    • Flag Triggers
    • Follow Flags
    • Holdouts Beta
    • Insights Charts Beta
    • Insights Deployments Beta
    • Insights Flag Events Beta
    • Insights Pull Requests Beta
    • Insights Repositories Beta
    • Insights Scores Beta
    • Integration Audit Log Subscriptions
    • Integration Delivery Configurations Beta
    • Integrations Beta
    • Layers
    • Metrics
    • Metrics Beta
    • OAuth2 Clients
    • Persistent Store Integrations Beta
    • Projects
    • Relay Proxy Configurations
    • Release Pipelines Beta
    • Releases Beta
    • Scheduled Changes
    • Segments
    • Tags
    • Teams
    • Teams Beta
    • Users
    • Users Beta
    • User Settings
    • Views Beta
    • Webhooks
    • Workflows
    • Workflow Templates
    • Other
Sign inTry it free
LogoLogo
REST API overviewAccess Tokens

Create access token

POST
/api/v2/tokens
POST
/api/v2/tokens
$curl -X POST https://app.launchdarkly.com/api/v2/tokens \
> -H "Authorization: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "role": "reader"
>}'
1{
2 "_id": "61095542756dba551110ae21",
3 "ownerId": "569f514156e003339cfd3917",
4 "memberId": "569f514183f2164430000002",
5 "creationDate": 1628001602644,
6 "lastModified": 1628001602644,
7 "_links": {
8 "parent": {
9 "href": "/api/v2/tokens",
10 "type": "application/json"
11 },
12 "self": {
13 "href": "/api/v2/tokens/61095542756dba551110ae21",
14 "type": "application/json"
15 }
16 },
17 "_member": {
18 "_links": {
19 "self": {
20 "href": "/api/v2/members/569f183514f4432160000007",
21 "type": "application/json"
22 }
23 },
24 "_id": "569f183514f4432160000007",
25 "role": "admin",
26 "email": "ariel@acme.com",
27 "firstName": "Ariel",
28 "lastName": "Flores"
29 },
30 "name": "Example reader token",
31 "description": "A reader token used in testing and examples",
32 "customRoleIds": [],
33 "inlineRole": [],
34 "role": "reader",
35 "token": "1234",
36 "serviceToken": false,
37 "defaultApiVersion": 20240415,
38 "lastUsed": 0
39}
Create a new access token.
Was this page helpful?
Previous

Delete access token

Next
Built with

Authentication

Authorizationstring
API Key authentication via header

Request

This endpoint expects an object.
namestringOptional

A human-friendly name for the access token

descriptionstringOptional
A description for the access token
roleenumOptional
Base role for the token
Allowed values:
customRoleIdslist of stringsOptional
A list of custom role IDs to use as access limits for the access token
inlineRolelist of objectsOptional

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

serviceTokenbooleanOptional
Whether the token is a service token
defaultApiVersionintegerOptional
The default API version for this token

Response

Access token response
_idstring
The ID of the access token
ownerIdstring
The ID of the owner of the account for the access token
memberIdstring
The ID of the member who created the access token
creationDatelong
Timestamp of when the access token was created
lastModifiedlong
Timestamp of the last modification of the access token
_linksmap from strings to objects
The location and content type of related resources
_memberobject
Details on the member who created the access token
namestring

A human-friendly name for the access token

descriptionstring
A description for the access token
customRoleIdslist of strings
A list of custom role IDs to use as access limits for the access token
inlineRolelist of objects

An array of policy statements, with three attributes: effect, resources, actions. May be used in place of a role.

rolestring
Base role for the token
tokenstring
The token value. When creating or resetting, contains the entire token value. Otherwise, contains the last four characters.
serviceTokenboolean
Whether this is a service token or a personal token
defaultApiVersioninteger
The default API version for this token
lastUsedlong
Timestamp of when the access token was last used

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
429
Too Many Requests Error