Code references is an Enterprise feature
Code references is available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.
Use ld-find-code-refs
LaunchDarkly provides the ld-find-code-refs utility that creates repository connections, generates code reference data, and creates calls to the code references API. Most customers do not need to call this API directly.
The code references API provides access to all resources related to each connected repository, and associated feature flag code reference data for all branches. To learn more, read Code references.
Get a list of all extinctions. LaunchDarkly creates an extinction event after you remove all code references to a flag. To learn more, read About extinction events.
Extinction collection response
Invalid access token
Forbidden
Rate limited
{- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}, - "items": {
- "property1": [
- {
- "revision": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "message": "Remove flag for launched feature",
- "time": 0,
- "flagKey": "enable-feature",
- "projKey": "default"
}
], - "property2": [
- {
- "revision": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "message": "Remove flag for launched feature",
- "time": 0,
- "flagKey": "enable-feature",
- "projKey": "default"
}
]
}
}
Get a list of connected repositories. Optionally, you can include branch metadata with the withBranches
query parameter. Embed references for the default branch with ReferencesForDefaultBranch
. You can also filter the list of code references by project key and flag key.
Repository collection response
Invalid access token
Forbidden
Rate limited
{- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}, - "items": [
- {
- "name": "LaunchDarkly-Docs",
- "hunkUrlTemplate": "https://github.com/launchdarkly/LaunchDarkly-Docs/blob/${sha}/${filePath}#L${lineNumber}",
- "type": "github",
- "defaultBranch": "main",
- "enabled": true,
- "version": 3,
- "branches": [
- {
- "name": "main",
- "head": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "updateSequenceId": 25,
- "syncTime": 0,
- "references": [
- {
- "path": "/main/index.js",
- "hint": "javascript",
- "hunks": [
- null
]
}
], - "_links": {
- "property1": null,
- "property2": null
}
}
], - "_links": {
- "property1": null,
- "property2": null
}, - "_access": {
- "denied": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- null
], - "actions": [
- "*"
], - "notActions": [
- null
], - "effect": "allow",
- "role_name": "string"
}
}
], - "allowed": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- null
], - "actions": [
- "*"
], - "notActions": [
- null
], - "effect": "allow",
- "role_name": "string"
}
}
]
}
}
]
}
Create a repository with the specified name.
Repository response
Invalid request
Invalid access token
Forbidden
Status conflict
Rate limited
{- "name": "LaunchDarkly-Docs",
- "hunkUrlTemplate": "https://github.com/launchdarkly/LaunchDarkly-Docs/blob/${sha}/${filePath}#L${lineNumber}",
- "type": "github",
- "defaultBranch": "main"
}
{- "name": "LaunchDarkly-Docs",
- "hunkUrlTemplate": "https://github.com/launchdarkly/LaunchDarkly-Docs/blob/${sha}/${filePath}#L${lineNumber}",
- "type": "github",
- "defaultBranch": "main",
- "enabled": true,
- "version": 3,
- "branches": [
- {
- "name": "main",
- "head": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "updateSequenceId": 25,
- "syncTime": 0,
- "references": [
- {
- "path": "/main/index.js",
- "hint": "javascript",
- "hunks": [
- {
- "startingLineNumber": 45,
- "lines": "var enableFeature = 'enable-feature';",
- "projKey": "default",
- "flagKey": "enable-feature",
- "aliases": [
- "enableFeature",
- "EnableFeature"
]
}
]
}
], - "_links": {
- "property1": null,
- "property2": null
}
}
], - "_links": {
- "property1": null,
- "property2": null
}, - "_access": {
- "denied": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- "string"
], - "actions": [
- "*"
], - "notActions": [
- "string"
], - "effect": "allow",
- "role_name": "string"
}
}
], - "allowed": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- "string"
], - "actions": [
- "*"
], - "notActions": [
- "string"
], - "effect": "allow",
- "role_name": "string"
}
}
]
}
}
Get a single repository by name.
Repository response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "name": "LaunchDarkly-Docs",
- "hunkUrlTemplate": "https://github.com/launchdarkly/LaunchDarkly-Docs/blob/${sha}/${filePath}#L${lineNumber}",
- "type": "github",
- "defaultBranch": "main",
- "enabled": true,
- "version": 3,
- "branches": [
- {
- "name": "main",
- "head": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "updateSequenceId": 25,
- "syncTime": 0,
- "references": [
- {
- "path": "/main/index.js",
- "hint": "javascript",
- "hunks": [
- {
- "startingLineNumber": 45,
- "lines": "var enableFeature = 'enable-feature';",
- "projKey": "default",
- "flagKey": "enable-feature",
- "aliases": [
- "enableFeature",
- "EnableFeature"
]
}
]
}
], - "_links": {
- "property1": null,
- "property2": null
}
}
], - "_links": {
- "property1": null,
- "property2": null
}, - "_access": {
- "denied": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- "string"
], - "actions": [
- "*"
], - "notActions": [
- "string"
], - "effect": "allow",
- "role_name": "string"
}
}
], - "allowed": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- "string"
], - "actions": [
- "*"
], - "notActions": [
- "string"
], - "effect": "allow",
- "role_name": "string"
}
}
]
}
}
Update a repository's settings. Updating repository settings uses a JSON patch or JSON merge patch representation of the desired changes. To learn more, read Updates.
Repository response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
[- {
- "op": "replace",
- "path": "/defaultBranch",
- "value": "main"
}
]
{- "name": "LaunchDarkly-Docs",
- "hunkUrlTemplate": "https://github.com/launchdarkly/LaunchDarkly-Docs/blob/${sha}/${filePath}#L${lineNumber}",
- "type": "github",
- "defaultBranch": "main",
- "enabled": true,
- "version": 3,
- "branches": [
- {
- "name": "main",
- "head": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "updateSequenceId": 25,
- "syncTime": 0,
- "references": [
- {
- "path": "/main/index.js",
- "hint": "javascript",
- "hunks": [
- {
- "startingLineNumber": 45,
- "lines": "var enableFeature = 'enable-feature';",
- "projKey": "default",
- "flagKey": "enable-feature",
- "aliases": [
- "enableFeature",
- "EnableFeature"
]
}
]
}
], - "_links": {
- "property1": null,
- "property2": null
}
}
], - "_links": {
- "property1": null,
- "property2": null
}, - "_access": {
- "denied": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- "string"
], - "actions": [
- "*"
], - "notActions": [
- "string"
], - "effect": "allow",
- "role_name": "string"
}
}
], - "allowed": [
- {
- "action": "string",
- "reason": {
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "notResources": [
- "string"
], - "actions": [
- "*"
], - "notActions": [
- "string"
], - "effect": "allow",
- "role_name": "string"
}
}
]
}
}
Delete a repository with the specified name.
Action succeeded
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "code": "invalid_request",
- "message": "Invalid request body"
}
Asynchronously delete a number of branches.
Action succeeded
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
[- "branch-to-be-deleted",
- "another-branch-to-be-deleted"
]
{- "code": "invalid_request",
- "message": "Invalid request body"
}
Get a list of branches.
Branch collection response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}, - "items": [
- {
- "name": "main",
- "head": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "updateSequenceId": 25,
- "syncTime": 0,
- "references": [
- {
- "path": "/main/index.js",
- "hint": "javascript",
- "hunks": [
- {
- "startingLineNumber": 45,
- "lines": "var enableFeature = 'enable-feature';",
- "projKey": "default",
- "flagKey": "enable-feature",
- "aliases": [
- "enableFeature",
- "EnableFeature"
]
}
]
}
], - "_links": {
- "property1": null,
- "property2": null
}
}
]
}
Get a specific branch in a repository.
Branch response
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "name": "main",
- "head": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "updateSequenceId": 25,
- "syncTime": 0,
- "references": [
- {
- "path": "/main/index.js",
- "hint": "javascript",
- "hunks": [
- {
- "startingLineNumber": 45,
- "lines": "var enableFeature = 'enable-feature';",
- "projKey": "default",
- "flagKey": "enable-feature",
- "aliases": [
- "enableFeature",
- "EnableFeature"
]
}
]
}
], - "_links": {
- "property1": null,
- "property2": null
}
}
Create a new branch if it doesn't exist, or update the branch if it already exists.
Action succeeded
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Status conflict
Rate limited
{- "name": "main",
- "head": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "updateSequenceId": 25,
- "syncTime": 0,
- "references": [
- {
- "path": "/main/index.js",
- "hint": "javascript",
- "hunks": [
- {
- "startingLineNumber": 45,
- "lines": "var enableFeature = 'enable-feature';",
- "projKey": "default",
- "flagKey": "enable-feature",
- "aliases": [
- "enableFeature",
- "EnableFeature"
]
}
]
}
], - "commitTime": 0
}
{- "code": "invalid_request",
- "message": "Invalid request body"
}
Create a new extinction.
Action succeeded
Invalid request
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
[- {
- "revision": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
- "message": "Remove flag for launched feature",
- "time": 0,
- "flagKey": "enable-feature",
- "projKey": "default"
}
]
{- "code": "invalid_request",
- "message": "Invalid request body"
}
Get links for all projects that have code references.
Statistic root response
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "projects": [
- {
- "href": "/api/v2/code-refs/statistics/example-project-with-code-refs",
- "type": "application/json"
}
], - "self": {
- "href": "string",
- "type": "string"
}
}
Get statistics about all the code references across repositories for all flags in your project that have code references in the default branch, for example, main
. Optionally, you can include the flagKey
query parameter to limit your request to statistics about code references for a single flag. This endpoint returns the number of references to your flag keys in your repositories, as well as a link to each repository.
Statistic collection response
Invalid access token
Forbidden
Invalid resource identifier
Rate limited
{- "flags": {
- "property1": [
- {
- "name": "LaunchDarkly-Docs",
- "type": "github",
- "defaultBranch": "main",
- "enabled": true,
- "version": 3,
- "hunkCount": 0,
- "fileCount": 0,
- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}, - "latestCommitTime": 0
}
], - "property2": [
- {
- "name": "LaunchDarkly-Docs",
- "type": "github",
- "defaultBranch": "main",
- "enabled": true,
- "version": 3,
- "hunkCount": 0,
- "fileCount": 0,
- "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}, - "latestCommitTime": 0
}
]
}, - "_links": {
- "property1": {
- "href": "string",
- "type": "string"
}, - "property2": {
- "href": "string",
- "type": "string"
}
}
}