Everything an AI agent can do with the LaunchDarkly API.

A reference guide for building AI agents: every method, how to authenticate, and the permissions each one needs.

Endpoints44
API version20240415
Last updated23 June 2026
Orientation

How the LaunchDarkly API works.

The LaunchDarkly API is how an app or AI agent works with a LaunchDarkly account: listing feature flags, turning a flag on or off in an environment, editing the segments that decide who a flag targets, and reading experiments and the audit log. Access is granted through an access token whose role or policy sets which resources and actions a call can read or write, so a token can be scoped to toggle one set of flags and nothing else. Versions are dated, and LaunchDarkly can push each change to a registered webhook so an integration learns about activity without polling.

44Endpoints
11Capability groups
19Read
25Write
3Permissions
Authentication
Every call authenticates with an access token sent in the Authorization header. A token is either a service token, which is not tied to a person and is recommended for integrations, or a personal token tied to a member. SDK keys, mobile keys, and client-side IDs authenticate the SDKs that evaluate flags, not the REST API, and must never be used to call it. A token is shown only once, when it is created.
Permissions
A token's access comes from a base role, Reader, Writer, or Admin, or from a custom role or an inline policy. Reader can read everything, Writer can also change flags, segments, and most resources, and Admin can manage projects, members, teams, and tokens. A policy combines a resource, like a flag in one project's production environment, with an action, like updateOn, so a token can be scoped to toggle one set of flags and nothing else. A 403 means the token's role or policy does not allow the action.
Versioning
The API is versioned by date through the LD-API-Version header, currently 20240415, written as the release date in year-month-day form. A token also carries a default version used when the header is absent. Beta resources require the header set to the value beta, and calling a beta resource without it returns 403. The earlier 20220603 version reaches end of life on 31 December 2026.
Data model
LaunchDarkly is resource-oriented JSON over HTTPS at https://app.launchdarkly.com, with EU and Federal hosts. A project holds environments, and a flag has a separate configuration in each environment, so toggling a flag is a patch to one environment's targeting. Flags, segments, experiments, and metrics live inside a project; members, teams, tokens, webhooks, and the audit log live at the account level. A change emits an audit log entry, which webhooks can deliver.
Connect & authenticate

Connection & authentication methods.

How an app or AI agent connects to LaunchDarkly determines what it can reach. There is a route for making calls, a hosted server that exposes LaunchDarkly tools to agents, and a route for receiving events, and each is governed by the token behind it and the role or policy that token carries.

Ways to connect

REST API

The REST API answers at https://app.launchdarkly.com, with EU and Federal hosts at https://app.eu.launchdarkly.com and https://app.launchdarkly.us. A call authenticates with an access token in the Authorization header, and the LD-API-Version header pins the dated version, currently 20240415.

Best forConnecting an app or AI agent to LaunchDarkly.
Governed byThe access token and the role or policy it carries.
Docs ↗

MCP server, hosted (Model Context Protocol)

LaunchDarkly's hosted MCP server at https://mcp.launchdarkly.com/mcp/launchdarkly lets an agent call LaunchDarkly through the Model Context Protocol, authenticating with OAuth so no API key sits in a config file. It exposes feature management tools, and there are companion hosted servers for AgentControl configs and for observability at https://mcp.launchdarkly.com/mcp/observability.

Best forConnecting an AI agent to LaunchDarkly through MCP.
Governed byThe OAuth grant and the access it carries.
Docs ↗

MCP server, local (Model Context Protocol)

LaunchDarkly also ships a local MCP server, run with npx from the @launchdarkly/mcp-server package, that authenticates with a LaunchDarkly API access token passed as --api-key. It exposes tools for feature flags, environments, AI configs, code references, and the audit log. The source is at github.com/launchdarkly/mcp-server.

Best forRunning an agent's LaunchDarkly tools locally with an access token.
Governed byThe access token and the role or policy it carries.
Docs ↗

Webhooks

A webhook POSTs the events that match its policy to a receiver URL, so an integration learns about changes without polling. A signing secret on the webhook lets the receiver verify the payload came from LaunchDarkly.

Best forReceiving LaunchDarkly change events at an app or AI agent.
Governed byThe webhook's policy statements and signing secret.
Docs ↗
Authentication

Service access token

A service token is not tied to a person and is the recommended way to authenticate an integration. It is created with a base role of Reader, Writer, or Admin, or with a custom role or inline policy, and it is sent in the Authorization header. The token is shown only once, when it is created.

TokenService access token (api-...)
Best forAutomations and integrations that act on their own behalf
Docs ↗

Personal access token

A personal token is tied to a member and inherits that member's permissions, or a narrower role chosen at creation. It is useful for ad hoc scripts, but it stops working if the member loses access, which makes a service token the steadier choice for a long-running integration.

TokenPersonal access token (api-...)
Best forAd hoc scripts run by a single person
Docs ↗

OAuth (hosted MCP and session)

The hosted MCP server authenticates an AI client with OAuth, which removes the need to place an API key in a config file. The access it grants follows the signed-in member's permissions.

TokenOAuth grant
Best forConnecting an AI client to the hosted MCP server
Docs ↗
Capability map

What an AI agent can do in LaunchDarkly.

The LaunchDarkly API is split into areas an agent can act on, like feature flags, projects, environments, segments, and experiments. Each area has its own methods, and a write in production can switch a flag on or off for live traffic.

Feature flags

7 endpoints

List, read, create, update, copy, and delete feature flags, and read a flag's status across environments.

A write here changes real flag data, including turning a flag on or off for live traffic.
View endpoints

Projects

5 endpoints

List, read, create, update, and delete the projects that group flags and environments.

A write here changes real project data.
View endpoints

Environments

5 endpoints

List, read, create, update, and delete the environments inside a project, such as production and staging.

A write here changes real environment data, including resetting an SDK key.
View endpoints

Segments

5 endpoints

List, read, create, update, and delete the segments that group contexts for targeting.

A write here changes real segment data and who a flag targets.
View endpoints

Contexts

3 endpoints

Search and read the contexts (users, devices, and other entities) a flag is evaluated against, and delete a context instance.

A write here deletes real context instance data.
View endpoints

Experiments & metrics

4 endpoints

List, read, create, and update experiments and the metrics they measure.

A write here changes real experiment or metric data.
View endpoints

Account members

3 endpoints

List, read, invite, update, and remove the people in an account.

A write here changes real member data, including who has access.
View endpoints

Teams

3 endpoints

List, read, create, update, and delete teams, and add members to a team.

A write here changes real team data and access.
View endpoints

Access tokens

4 endpoints

List, read, create, update, reset, and delete the API access tokens that authenticate calls.

A write here mints or revokes credentials that can call the API.
View endpoints

Webhooks

3 endpoints

List, read, create, update, and delete the webhooks that deliver change events.

A write here changes where change events are delivered.
View endpoints

Audit log

2 endpoints

List, search, and read the audit log entries that record every change in an account.

These reads expose a full history of account activity.
View endpoints
Endpoint reference

Every LaunchDarkly API method.

Filter by method, access, or permission, or search any path. Select a row for version detail, rate limits, the related webhook event, and the source.

MethodEndpointWhat it doesAccessPermissionVersion

Feature flags

List, read, create, update, copy, and delete feature flags, and read a flag's status across environments.7

Needs the reader action getFeatureFlags on the flag resource. Any token with at least Reader can call it. Under 20240415 this returns 20 flags per page, up to 100.

Acts onfeature flag
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the reader action getFeatureFlag on the flag resource.

Acts onfeature flag
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action createFeatureFlag on the flag resource. A custom role or inline policy can grant this on specific projects only.

Acts onfeature flag
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventflag-changed
Rate limitStandard limits apply

Toggling a flag is a patch on this endpoint, setting the environment's on field, so it needs the writer action updateOn, or updateFeatureFlag for other fields. Production can be restricted with a custom role.

Acts onfeature flag
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventflag-changed
Rate limitStandard limits apply

Needs the writer action deleteFeatureFlag on the flag resource. Irreversible.

Acts onfeature flag
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventflag-changed
Rate limitStandard limits apply

Needs the writer action copyFeatureFlag, and write access to the target environment.

Acts onfeature flag
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventflag-changed
Rate limitStandard limits apply

Read-only. Status reports whether a flag is new, active, launched, or inactive.

Acts onfeature flag
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Projects

List, read, create, update, and delete the projects that group flags and environments.5

Needs the reader action getProjects on the project resource.

Acts onproject
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the reader action getProject on the project resource.

Acts onproject
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action createProject. The default Writer role cannot create projects; this is an Admin action or must be granted by a custom role.

Acts onproject
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action updateProject on the project resource.

Acts onproject
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action deleteProject. Removes every flag, environment, and segment in the project, so it is an Admin-level action.

Acts onproject
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Environments

List, read, create, update, and delete the environments inside a project, such as production and staging.5

Needs the reader action getEnvironment on the environment resource.

Acts onenvironment
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the reader action getEnvironment on the environment resource.

Acts onenvironment
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action createEnvironment on the environment resource.

Acts onenvironment
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action updateEnvironment on the environment resource.

Acts onenvironment
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action updateSdkKey. Rotates the credential that running SDKs use, so it can break live evaluations until they are updated.

Acts onenvironment
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Segments

List, read, create, update, and delete the segments that group contexts for targeting.5

Needs the reader action getSegments on the segment resource. Under 20240415 this returns 20 segments per page.

Acts onsegment
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the reader action getSegment on the segment resource.

Acts onsegment
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action createSegment on the segment resource.

Acts onsegment
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action updateSegment. Changing a segment changes which contexts a flag targets.

Acts onsegment
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action deleteSegment on the segment resource.

Acts onsegment
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Contexts

Search and read the contexts (users, devices, and other entities) a flag is evaluated against, and delete a context instance.3

A read despite the POST verb, used to query contexts. Needs the reader action getContextInstances.

Acts oncontext
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the reader action getContextInstances on the context resource.

Acts oncontext
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action deleteContextInstances on the context resource.

Acts oncontext
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Experiments & metrics

List, read, create, and update experiments and the metrics they measure.4

Needs the reader action getExperiment on the experiment resource.

Acts onexperiment
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action createExperiment on the experiment resource.

Acts onexperiment
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the reader action getMetric on the metric resource.

Acts onmetric
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action createMetric on the metric resource.

Acts onmetric
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Account members

List, read, invite, update, and remove the people in an account.3

Needs the reader action getMember on the member resource.

Acts onmember
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action createMember. Adding people to an account is an Admin-level action unless granted by a custom role.

Acts onmember
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action updateRole or updateCustomRole. Changing a member's role changes their access, so it is an Admin-level action.

Acts onmember
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Teams

List, read, create, update, and delete teams, and add members to a team.3

Needs the reader action getTeam on the team resource.

Acts onteam
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action createTeam. Teams carry custom roles, so creating one is an Admin-level action unless granted by a custom role.

Acts onteam
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action updateTeamMembers. Team membership confers the team's roles, so this changes access.

Acts onteam
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Access tokens

List, read, create, update, reset, and delete the API access tokens that authenticate calls.4

Needs the action getTokens. Listing all account tokens is an Admin-level action. Under 20240415 this returns 25 tokens per page.

Acts onaccess token
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action createAccessToken. A member can only mint a token at or below their own permissions, so minting an Admin or Writer token needs that level.

Acts onaccess token
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action resetAccessToken. Invalidates the old secret immediately.

Acts onaccess token
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the action deleteAccessToken. Revokes the token for good.

Acts onaccess token
Permission (capability)Admin
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Webhooks

List, read, create, update, and delete the webhooks that deliver change events.3

Needs the reader action getWebhook on the webhook resource.

Acts onwebhook
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action createWebhook. A statements field can scope the webhook to specific resources.

Acts onwebhook
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Needs the writer action deleteWebhook on the webhook resource.

Acts onwebhook
Permission (capability)Writer
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Audit log

List, search, and read the audit log entries that record every change in an account.2

Needs the reader action viewAuditLog. Returns who changed what, across the whole account.

Acts onaudit log entry
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

A read despite the POST verb, used to filter entries by resource and action. Needs the reader action viewAuditLog.

Acts onaudit log entry
Permission (capability)Reader
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply
No endpoints match those filters.
Webhooks

Webhook events.

LaunchDarkly can notify an app or AI agent when something changes, like a flag being toggled or a segment being edited. It posts the change to a webhook URL that has been registered, so an integration learns about activity without polling.

EventWhat it signalsTriggered by
Feature flag changeFires when a flag is created, updated, toggled on or off, or deleted. The payload carries the audit log entry describing the change, including who made it and the kind and key of what changed./api/v2/flags/{projectKey}
/api/v2/flags/{projectKey}/{featureFlagKey}
/api/v2/flags/{projectKey}/{featureFlagKey}/copy
/api/v2/flags/{projectKey}/{featureFlagKey}
Any policy-matched changeA LaunchDarkly webhook is not a fixed list of named events. It delivers every change whose resource and action match the webhook's policy statements, so it can be scoped to flags in one project, segments, members, or any other resource.In-app only
No events match that search.
Rate limits & pagination

Rate limits, pagination & request size.

LaunchDarkly limits how fast an app or AI agent can call, through a per-account quota measured over ten-second windows, with some routes carrying their own limit on top.

Request rate

LaunchDarkly meters requests over rolling ten-second windows rather than by a per-method cost. A global limit caps how many calls the whole account can make per ten seconds, and every personal and service token on the account shares it, so one busy token can slow the others. Some routes carry their own route-level limit on top, and a few use IP-based limiting. Going over returns HTTP 429. The response headers X-Ratelimit-Global-Remaining and X-Ratelimit-Route-Remaining report what is left in each window, X-Ratelimit-Reset gives the reset time, and an IP-limited route returns a Retry-After header. LaunchDarkly does not publish the exact numbers, and sets them per account, so an integration should read the headers and back off rather than assume a fixed ceiling.

Pagination

Under version 20240415, list endpoints are paginated with limit and offset query parameters, and the response carries an _links object with first, prev, next, and last links to follow rather than building URLs by hand. Default and maximum page sizes vary by endpoint: feature flags return 20 by default up to 100, segments 20 by default up to 50, access tokens 25 by default up to 1,000, and custom roles 20 by default up to 1,000. Several of these endpoints were unpaginated before 20240415.

Request size

Responses are JSON. There is no single documented payload size limit across the whole API; per-endpoint page-size caps, such as 100 for feature flags and 50 for segments, bound how much a single list call returns.

Errors

Status codes & error handling.

The status codes an agent should handle, and what to do about each.

StatusCodeMeaningWhat to do
400invalid_requestThe request cannot be understood, usually malformed JSON or an invalid body.Check the JSON syntax and the request body against the endpoint reference, then resend.
401unauthorizedThe access token is missing, invalid, or expired.Send a valid token in the Authorization header.
403forbiddenThe token is valid but its role or policy does not allow this action on this resource. A beta resource called without the LD-API-Version: beta header also returns 403.Grant the needed action on the resource through the token's role or policy, or add the beta version header.
404not_foundThe resource does not exist, or the token cannot see it.Confirm the project, environment, and resource keys in the path.
409conflictThe request conflicts with the current state, often a concurrent update to the same resource.Refetch the resource and retry the change.
422unprocessable_entityThe update description cannot be understood, usually a malformed patch or semantic patch instruction.Check the patch format and the field names, then resend.
429too_many_requestsA rate limit was exceeded, either the per-account global limit or a route-level limit.Wait for the time in the Retry-After header, or until the X-Ratelimit-Reset time, then retry.
Versioning & freshness

Version history.

LaunchDarkly versions its API by date through the LD-API-Version header. The current version is 20240415, and a request can opt into beta resources by sending the value beta instead.

Version history

What changed, and when

Latest version20240415
20240415Current version
Current version (released 15 April 2024)

Version 20240415 is the current dated version, set through the LD-API-Version header. It paginated several previously unpaginated list endpoints, removed the Users API in favour of the Contexts API, and tightened some response shapes. A request that omits the header uses the default version stored on the token.

What changed
  • List endpoints for access tokens, custom roles, feature flags, segments, and workflows became paginated with limit and offset
  • The Users API, Users (beta) API, and User settings API, deprecated in May 2023, were removed in favour of the Contexts API
  • The feature flags list endpoint dropped several filters, including codeReferences, contextKindTargeted, segmentTargeted, status, and targeting, and the compare query parameter
  • The teams API stopped supporting the projects and roles expansions, and the workflows API dropped the _conflicts field
20220603
Previous version (end of life 31 December 2026)

Version 20220603 is the prior dated version. It is still supported for existing integrations until 31 December 2026, after which calls pinned to it stop working and should move to 20240415. Most of the differences are the pagination and resource changes introduced by the newer version.

What changed
  • Several list endpoints returned all results without pagination
  • The Users API was still present, before its removal in 20240415
  • Supported until 31 December 2026, when integrations must move to 20240415

Pin a version and move up on a schedule that suits the integration.

LaunchDarkly API migration guide ↗
Questions

LaunchDarkly API, answered.

How do I turn a flag on or off through the API?+
Toggling a flag is a PATCH on the flag, not a separate endpoint. The patch sets the on field for a specific environment, since a flag has its own targeting in each environment, so the same flag can be on in staging and off in production. The token needs the writer action updateOn on that flag, and access to that environment. A custom role or inline policy can allow toggling in staging but not production.
What roles and permissions does an access token need?+
A token carries a base role of Reader, Writer, or Admin, or a custom role or inline policy. Reader can call every read endpoint, Writer can also create and change flags, segments, and most resources, and Admin actions like creating a project, inviting members, or managing tokens need Admin or an equivalent custom role. As a best practice, give a token the smallest scope its job needs, for example a policy that allows changes only outside production.
Which API version should I use, and how do I set it?+
Send the LD-API-Version header with the dated version an integration has tested against, currently 20240415. If the header is absent, the request uses the default version stored on the token, which can drift, so setting it explicitly is the steadier choice. To call a beta resource, set the header to beta; a beta resource called without it returns 403. The older 20220603 version is supported until 31 December 2026.
How do the rate limits work?+
LaunchDarkly meters requests over ten-second windows. A global limit applies to the whole account and is shared across every personal and service token, so a busy token can slow the others, and some routes add their own route-level limit. Going over returns HTTP 429. Read the X-Ratelimit-Global-Remaining, X-Ratelimit-Route-Remaining, and X-Ratelimit-Reset headers, or the Retry-After header on IP-limited routes, and back off, because LaunchDarkly does not publish fixed numbers and sets them per account.
How do I receive changes instead of polling?+
Register a webhook with a policy describing which resources and actions to watch, such as flag changes in one project. LaunchDarkly POSTs each matching change to the webhook's URL with the audit log entry for that change, and a signing secret lets the receiver verify the payload came from LaunchDarkly. A webhook is not a fixed list of named events; it delivers whatever its policy statements match.
What happened to the Users API?+
The Users API, the Users (beta) API, and the User settings API were deprecated in May 2023 and are removed in version 20240415. The Contexts API replaces them. A context is the entity a flag is evaluated against, like a user, a device, or an organization, and it is searched and read through the contexts endpoints rather than the old users endpoints.
Related

More developer API guides for agents

What is Bollard AI?

Control what every AI agent can do in LaunchDarkly.

Bollard AI sits between a team's AI agents and LaunchDarkly. Grant each agent exactly the access it needs, read or write, resource by resource, and every call is checked and logged.

  • Set read, write, or full access per agent, never a shared LaunchDarkly token.
  • Denied by default, so an agent reaches only what has been explicitly allowed.
  • Every call recorded in plain English: who, what, where, and the decision.
LaunchDarkly
Release Agent
Read feature flags ResourceOffReadFull use
Toggle flags in production ActionOffReadFull use
Segments ResourceOffReadFull use
Per-agent access, set in Bollard AI, not in LaunchDarkly