All URIs are relative to https://app.launchdarkly.com
Method | HTTP request | Description |
---|---|---|
delete_token | DELETE /api/v2/tokens/{id} | Delete access token |
get_token | GET /api/v2/tokens/{id} | Get access token |
get_tokens | GET /api/v2/tokens | List access tokens |
patch_token | PATCH /api/v2/tokens/{id} | Patch access token |
post_token | POST /api/v2/tokens | Create access token |
reset_token | POST /api/v2/tokens/{id}/reset | Reset access token |
delete_token(id)
Delete access token
Delete an access token by ID.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import access_tokens_api
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = access_tokens_api.AccessTokensApi(api_client)
id = "id_example" # str | The ID of the access token to update
# example passing only required values which don't have defaults set
try:
# Delete access token
api_instance.delete_token(id)
except launchdarkly_api.ApiException as e:
print("Exception when calling AccessTokensApi->delete_token: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
id | str | The ID of the access token to update |
void (empty response body)
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | Action succeeded | - |
401 | Invalid access token | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Token get_token(id)
Get access token
Get a single access token by ID.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import access_tokens_api
from launchdarkly_api.model.token import Token
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = access_tokens_api.AccessTokensApi(api_client)
id = "id_example" # str | The ID of the access token
# example passing only required values which don't have defaults set
try:
# Get access token
api_response = api_instance.get_token(id)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling AccessTokensApi->get_token: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
id | str | The ID of the access token |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Access token response | - |
401 | Invalid access token | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Tokens get_tokens()
List access tokens
Fetch a list of all access tokens.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import access_tokens_api
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.tokens import Tokens
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = access_tokens_api.AccessTokensApi(api_client)
show_all = True # bool | If set to true, and the authentication access token has the 'Admin' role, personal access tokens for all members will be retrieved. (optional)
limit = 1 # int | The number of access tokens to return in the response. Defaults to 25. (optional)
offset = 1 # int | Where to start in the list. This is for use with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# List access tokens
api_response = api_instance.get_tokens(show_all=show_all, limit=limit, offset=offset)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling AccessTokensApi->get_tokens: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
show_all | bool | If set to true, and the authentication access token has the 'Admin' role, personal access tokens for all members will be retrieved. | [optional] |
limit | int | The number of access tokens to return in the response. Defaults to 25. | [optional] |
offset | int | Where to start in the list. This is for use with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Access tokens collection response | - |
401 | Invalid access token | - |
403 | Forbidden | - |
429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Token patch_token(id, json_patch)
Patch access token
Update an access token's settings. Updating an access token uses a JSON patch representation of the desired changes. To learn more, read Updates.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import access_tokens_api
from launchdarkly_api.model.token import Token
from launchdarkly_api.model.json_patch import JSONPatch
from launchdarkly_api.model.patch_failed_error_rep import PatchFailedErrorRep
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from launchdarkly_api.model.status_conflict_error_rep import StatusConflictErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = access_tokens_api.AccessTokensApi(api_client)
id = "id_example" # str | The ID of the access token to update
json_patch = JSONPatch([
PatchOperation(
op="replace",
path="/exampleField",
value=None,
),
]) # JSONPatch |
# example passing only required values which don't have defaults set
try:
# Patch access token
api_response = api_instance.patch_token(id, json_patch)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling AccessTokensApi->patch_token: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
id | str | The ID of the access token to update | |
json_patch | JSONPatch |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Access token response | - |
400 | Invalid request | - |
401 | Invalid access token | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
409 | Status conflict | - |
422 | Invalid patch content | - |
429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Token post_token(access_token_post)
Create access token
Create a new access token.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import access_tokens_api
from launchdarkly_api.model.token import Token
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.access_token_post import AccessTokenPost
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = access_tokens_api.AccessTokensApi(api_client)
access_token_post = AccessTokenPost(
name="name_example",
description="description_example",
role="reader",
custom_role_ids=[
"custom_role_ids_example",
],
inline_role=[
StatementPost(
resources=["proj/*:env/*:flag/*;testing-tag"],
not_resources=[
"not_resources_example",
],
actions=["*"],
not_actions=[
"not_actions_example",
],
effect="allow",
),
],
service_token=True,
default_api_version=1,
) # AccessTokenPost |
# example passing only required values which don't have defaults set
try:
# Create access token
api_response = api_instance.post_token(access_token_post)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling AccessTokensApi->post_token: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
access_token_post | AccessTokenPost |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | Access token response | - |
400 | Invalid request | - |
401 | Invalid access token | - |
403 | Forbidden | - |
429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Token reset_token(id)
Reset access token
Reset an access token's secret key with an optional expiry time for the old key.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import access_tokens_api
from launchdarkly_api.model.token import Token
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = access_tokens_api.AccessTokensApi(api_client)
id = "id_example" # str | The ID of the access token to update
expiry = 1 # int | An expiration time for the old token key, expressed as a Unix epoch time in milliseconds. By default, the token will expire immediately. (optional)
# example passing only required values which don't have defaults set
try:
# Reset access token
api_response = api_instance.reset_token(id)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling AccessTokensApi->reset_token: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Reset access token
api_response = api_instance.reset_token(id, expiry=expiry)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling AccessTokensApi->reset_token: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
id | str | The ID of the access token to update | |
expiry | int | An expiration time for the old token key, expressed as a Unix epoch time in milliseconds. By default, the token will expire immediately. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Access token response | - |
401 | Invalid access token | - |
403 | Forbidden | - |
404 | Invalid resource identifier | - |
429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]