Reference · REST API v1
REST API
Everything the console does is available over HTTPS and JSON: flags, targeting, environments, segments, keys, tokens and webhooks. Every endpoint below shows its parameters, request body, responses and a copyable curl command.
Updated Oct 28, 2026 61 min read Edit this page on GitHub (opens in a new tab)
Generated from the OpenAPI documentThe endpoint index below is rendered at build time from the OpenAPI 3.1 document published by the API, so it cannot drift from the implementation. To try calls, browse schemas and copy code samples, open the interactive API explorer . The machine-readable spec is served at /openapi.json (on this site and on the API host). Spec: Darkship API v1.0.0.
Overview#
Base URL https://api.darkship.tech/v1 for management; https://sdk.darkship.tech/v1 for the SDK data plane.
Format JSON only. Fields are snake_case, timestamps are ISO-8601 in UTC, ids are opaque strings.
Versioning Breaking changes only ship under a new major path. Additive changes (new fields, new endpoints) happen within /v1, so ignore fields you don't know. Deprecations are announced with Deprecation and Sunset headers and in the changelog.
Spec /openapi.json: OpenAPI 3.1, linted in CI with Spectral. It covers both hosts (the SDK data plane is the SDK data plane tag), names every request and response schema, and lists the permission each operation needs in x-required-scope. Generate a client in any language from it.
Authentication#
Send a key in the Authorization header. Which key depends on the host and endpoint:
Credentials by use. Credential Prefix Calls Notes
API token ds_pat_Management API on api Scoped permissions; personal or service. Created in the console or here .
Server SDK key ds_srv_GET /v1/sdk/snapshot, GET /v1/sdk/stream, POST /v1/telemetry/countersSecret. One environment.
Client SDK key ds_cli_POST /v1/sdk/evaluate onlyPublic by design. Other routes return 403.
$ curl https://api.darkship.tech/v1/projects/web-app/flags \
-H "Authorization: Bearer $DARKSHIP_API_TOKEN"
SecretsKeys are shown once and stored only as a hash. Put ds_pat_ and ds_srv_ values in a secret store, never in source control; the prefixes are registered with secret scanners. A token can never hold more permissions than the person who created it, and stops working if they leave the organisation.
Scopes#
Every operation lists the permission it needs in x-required-scope. An API token carries a subset of these as its scopes; a console member gets them from their role (GET /v1/roles lists the catalogue). Operations marked session only cannot be called with an API token. The table is generated from the spec:
Permissions required per operation (x-required-scope). Permission API tokens Operations api_token:manageno (session only) GET /v1/api-tokens, POST /v1/api-tokens, DELETE /v1/api-tokens/{tokenId}audit:readyes GET /v1/audit-logbilling:manageno (session only) GET /v1/orgs/{orgId}/billing, POST /v1/orgs/{orgId}/billing/checkout, POST /v1/orgs/{orgId}/billing/portalenvironment:manageyes POST /v1/projects/{projectId}/environments, PUT /v1/projects/{projectId}/environments/order, PATCH /v1/projects/{projectId}/environments/{envId}, DELETE /v1/projects/{projectId}/environments/{envId}environment:readyes GET /v1/projects/{projectId}/environments, GET /v1/projects/{projectId}/environments/{envId}flag:deleteyes DELETE /v1/projects/{projectId}/flags/{flagKey}, POST /v1/projects/{projectId}/flags/{flagKey}/archive, POST /v1/projects/{projectId}/flags/{flagKey}/restoreflag:readyes GET /v1/projects/{projectId}/flags, GET /v1/projects/{projectId}/flags/{flagKey}, GET /v1/projects/{projectId}/flags/{flagKey}/history, GET /v1/projects/{projectId}/flags/{flagKey}/history/{historyId}, GET /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}, POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/evaluate-preview, GET /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/history, GET /v1/projects/{projectId}/segments, GET /v1/projects/{projectId}/segments/{segmentKey}, GET /v1/projects/{projectId}/segments/{segmentKey}/usageflag:writeyes POST /v1/projects/{projectId}/flags, PATCH /v1/projects/{projectId}/flags/{flagKey}, POST /v1/projects/{projectId}/flags/{flagKey}/history/{historyId}/restore, PUT /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}, PATCH /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}, POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/toggle, POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/targets/import/preview, POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/targets/import, POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/history/{historyId}/restoremember:manageno (session only) GET /v1/invitations, POST /v1/invitations, DELETE /v1/invitations/{invitationId}, PATCH /v1/members/{memberId}, DELETE /v1/members/{memberId}member:readno (session only) GET /v1/membersorg:manageno (session only) PATCH /v1/organizations/{orgId}, DELETE /v1/organizations/{orgId}, POST /v1/organizations/{orgId}/deletion, POST /v1/organizations/{orgId}/restoreorg:readyes GET /v1/organizations/{orgId}org:transferno (session only) POST /v1/organizations/{orgId}/transfer-ownershipproject:manageyes POST /v1/projects, PATCH /v1/projects/{projectId}, DELETE /v1/projects/{projectId}project:readyes GET /v1/projects, GET /v1/projects/{projectId}sdk_key:manageyes POST /v1/projects/{projectId}/environments/{envId}/sdk-keys, POST /v1/sdk-keys/{keyId}/rotate, DELETE /v1/sdk-keys/{keyId}sdk_key:readyes GET /v1/sdk-keys, GET /v1/projects/{projectId}/environments/{envId}/sdk-keyssegment:manageyes POST /v1/projects/{projectId}/segments, PATCH /v1/projects/{projectId}/segments/{segmentKey}, DELETE /v1/projects/{projectId}/segments/{segmentKey}, POST /v1/projects/{projectId}/segments/{segmentKey}/import/preview, POST /v1/projects/{projectId}/segments/{segmentKey}/importusage:readyes GET /v1/usage, GET /v1/projects/{projectId}/usage, GET /v1/projects/{projectId}/flags/{flagKey}/usagewebhook:manageyes GET /v1/webhooks/event-types, GET /v1/projects/{projectId}/webhooks, POST /v1/projects/{projectId}/webhooks, GET /v1/webhooks/{id}, PATCH /v1/webhooks/{id}, DELETE /v1/webhooks/{id}, POST /v1/webhooks/{id}/rotate-secret, POST /v1/webhooks/{id}/test, GET /v1/webhooks/{id}/deliveries, GET /v1/webhooks/{id}/deliveries/{deliveryId}, POST /v1/webhooks/{id}/deliveries/{deliveryId}/redeliver
Conventions#
List endpoints take limit (1 to 200, default 50) and an opaque cursor, and return data plus next_cursor (null on the last page).
Idempotency#
Mutations accept an Idempotency-Key header. The key is stored for 24 hours with a hash of the request body. Replaying the same request returns the original response; reusing the key with a different body returns 409.
Optimistic concurrency#
Flags and rulesets return an ETag. Send it back in If-Match when updating; if someone else changed the resource, you get 412 precondition_failed instead of silently overwriting their edit.
Errors#
Errors share one envelope. code is stable and machine-readable; message is for humans and may change. The request_id is also returned in the X-Request-Id header; include it when you contact support.
{
"error" : {
"code" : "flag_not_found" ,
"message" : "Flag 'checkout-v2' does not exist in project 'web-app'." ,
"request_id" : "req_01J9ZK3Q8M4V" ,
"details" : [{ "field" : "flag" , "issue" : "not_found" }],
"docs_url" : "https://docs.darkship.tech/errors/flag_not_found"
}
}
HTTP status codes. Status Meaning
400 Malformed request, e.g. invalid JSON.
401 Missing or invalid credentials.
403 Valid credentials, not allowed: insufficient scope, or wrong key type for the endpoint.
404 Resource does not exist (or you cannot see it).
409 Conflict: duplicate key, or Idempotency-Key reused with a different body.
412 If-Match did not match the current ETag.
422 Validation failed. See details for each field.
429 Rate limited. Honour Retry-After.
5xx Our fault. Retry idempotent requests with exponential backoff and jitter.
Plans never break evaluationOver-quota or past-due states restrict creating new things through this API (you'd see 402 plan_limit_reached on create calls). Evaluation endpoints keep serving in every state.
Rate limits#
Limits are per token (or per SDK key on the data plane) and per plan, and use separate buckets for management, ruleset fetch, evaluation and telemetry. Every response includes:
HTTP response headers CopyRateLimit-Limit : 600
RateLimit-Remaining : 598
RateLimit-Reset : 41
HTTP/1.1 429 Too Many Requests
Retry-After : 17
RateLimit-Reset is the number of seconds until the window resets. The numbers shown are placeholders until load data sets the plan limits. Data-plane limits are generous because a hit is a cache read.
Endpoints#
A searchable index of every operation, rendered at build time (it also works without JavaScript). For the full interactive reference with schemas, a request console and code samples, use the API explorer .
Account 7 endpoints # The signed-in user (console session).
GET /v1/me The signed-in user and their organizations The signed-in user and their organizations.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters No parameters.
Response 200 {
"user" : {
"id" : "string" ,
"email" : "string" ,
"name" : "string" ,
"email_verified" : true ,
"two_factor_enabled" : true ,
"deletion" : {
"requested_at" : "string" ,
"erase_after" : "string"
}
},
"organizations" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"slug" : "string" ,
"role" : "OWNER"
}
]
}Errors Errors for GET /v1/me Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/me' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/me/deletion Your account deletion request, if any Your account deletion request, if any.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for GET /v1/me/deletion Name In Type Description string optional
Response 200 {
"deletion" : {
"requested_at" : "string" ,
"erase_after" : "string"
}
}Errors Errors for GET /v1/me/deletion Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/me/deletion' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/me/deletion Schedule the deletion of your account (30-day regret window). Needs your typed email, your current password and, with MFA, a recent MFA sign-in. Refused while you are the only Owner of an organization. Schedule the deletion of your account (30-day regret window). Needs your typed email, your current password and, with MFA, a recent MFA sign-in. Refused while you are the only Owner of an organization.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/me/deletion Name In Type Description string optional confirm_email body string required See the request example.
Request body JSON application/json Copy{
"confirm_email" : "string" ,
"password" : "string"
}Response 202 {
"requested_at" : "string" ,
"erase_after" : "string"
}Errors Errors for POST /v1/me/deletion Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/me/deletion' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"confirm_email":"string","password":"string"}' DELETE /v1/me/deletion Cancel the scheduled deletion of your account Cancel the scheduled deletion of your account.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for DELETE /v1/me/deletion Name In Type Description string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/me/deletion Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/me/deletion' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/me/exports Your recent personal data exports Your recent personal data exports.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for GET /v1/me/exports Name In Type Description string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"status" : "queued" ,
"created_at" : "string" ,
"completed_at" : "string" ,
"expires_at" : "string" ,
"size_bytes" : -9007199254740991
}
]
}Errors Errors for GET /v1/me/exports Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/me/exports' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/me/exports Request a personal data export (JSON). A single-use download link is emailed when it is ready. Request a personal data export (JSON). A single-use download link is emailed when it is ready.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/me/exports Name In Type Description string optional
Response 202 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"status" : "queued" ,
"created_at" : "string" ,
"completed_at" : "string" ,
"expires_at" : "string" ,
"size_bytes" : -9007199254740991
}Errors Errors for POST /v1/me/exports Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/me/exports' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/me/exports/{exportId} /download Download a personal data export with the single-use token from the email (signed-in owner only) Download a personal data export with the single-use token from the email (signed-in owner only).
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/me/exports/{exportId}/download Name In Type Description exportId path string required The `exportId` path parameter. string optional token body string required See the request example.
Request body JSON application/json Copy{
"token" : "string"
}Response 200 {
"format" : "string" ,
"generated_at" : "string"
}Errors Errors for POST /v1/me/exports/{exportId}/download Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/me/exports/{exportId}/download' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"token":"string"}' Organizations 8 endpoints # Organizations you belong to: create, rename, delete and transfer ownership.
GET /v1/organizations List the organizations you belong to List the organizations you belong to.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters No parameters.
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"slug" : "string" ,
"role" : "OWNER" ,
"created_at" : "string" ,
"updated_at" : "string" ,
"state" : "active" ,
"deletion_requested_at" : "string" ,
"purge_after" : "string"
}
]
}Errors Errors for GET /v1/organizations Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/organizations' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/organizations Create an organization (you become its Owner) Create an organization (you become its Owner).
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/organizations Name In Type Description name body string required See the request example. slug body string required See the request example.
Request body JSON application/json Copy{
"name" : "Acme" ,
"slug" : "acme"
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"slug" : "string" ,
"role" : "OWNER" ,
"created_at" : "string" ,
"updated_at" : "string" ,
"state" : "active" ,
"deletion_requested_at" : "string" ,
"purge_after" : "string"
}Errors Errors for POST /v1/organizations Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 409 Conflict Conflict 422 Unprocessable Content Unprocessable 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/organizations' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"Acme","slug":"acme"}' GET /v1/organizations/{orgId} Get an organization Get an organization.
Requires permission `org:read` (role of the member, or scope of the API token).
Requires org:read on api.darkship.tech
Parameters Parameters for GET /v1/organizations/{orgId} Name In Type Description orgId path string required Organization id.
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"slug" : "string" ,
"role" : "OWNER" ,
"created_at" : "string" ,
"updated_at" : "string" ,
"state" : "active" ,
"deletion_requested_at" : "string" ,
"purge_after" : "string"
}Errors Errors for GET /v1/organizations/{orgId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/organizations/{orgId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' PATCH /v1/organizations/{orgId} Rename an organization or change its slug Rename an organization or change its slug.
Requires permission `org:manage`. Session only: this permission cannot be granted to API tokens.
Requires org:manage on api.darkship.tech
Parameters Parameters for PATCH /v1/organizations/{orgId} Name In Type Description orgId path string required Organization id.
Request body JSON application/json Copy{
"name" : "string" ,
"slug" : "string"
}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"slug" : "string" ,
"role" : "OWNER" ,
"created_at" : "string" ,
"updated_at" : "string" ,
"state" : "active" ,
"deletion_requested_at" : "string" ,
"purge_after" : "string"
}Errors Errors for PATCH /v1/organizations/{orgId} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PATCH 'https://api.darkship.tech/v1/organizations/{orgId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"string","slug":"string"}' DELETE /v1/organizations/{orgId} Schedule the deletion of an organization (Owner only). Needs the typed organization name, your current password and, with MFA enabled, a recent MFA sign-in. The organization becomes read-only for 30 days (SDK keys keep serving), then it is erased. Schedule the deletion of an organization (Owner only). Needs the typed organization name, your current password and, with MFA enabled, a recent MFA sign-in. The organization becomes read-only for 30 days (SDK keys keep serving), then it is erased.
Requires permission `org:manage`. Session only: this permission cannot be granted to API tokens.
Requires org:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/organizations/{orgId} Name In Type Description orgId path string required Organization id. confirm_name body string required See the request example.
Request body JSON application/json Copy{
"confirm_name" : "string" ,
"password" : "string"
}Response 202 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"slug" : "string" ,
"role" : "OWNER" ,
"created_at" : "string" ,
"updated_at" : "string" ,
"state" : "active" ,
"deletion_requested_at" : "string" ,
"purge_after" : "string"
}Errors Errors for DELETE /v1/organizations/{orgId} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/organizations/{orgId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"confirm_name":"string","password":"string"}' POST /v1/organizations/{orgId} /transfer-ownership Transfer ownership to an existing member (Owner only; you become Admin). Needs a recent MFA sign-in when MFA is enabled. Transfer ownership to an existing member (Owner only; you become Admin). Needs a recent MFA sign-in when MFA is enabled.
Requires permission `org:transfer`. Session only: this permission cannot be granted to API tokens.
Requires org:transfer on api.darkship.tech
Parameters Parameters for POST /v1/organizations/{orgId}/transfer-ownership Name In Type Description orgId path string required Organization id. new_owner_user_id body string required See the request example.
Request body JSON application/json Copy{
"new_owner_user_id" : "string"
}Response 200 {
"new_owner_user_id" : "string" ,
"previous_owner_user_id" : "string" ,
"previous_owner_role" : "string"
}Errors Errors for POST /v1/organizations/{orgId}/transfer-ownership Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/organizations/{orgId}/transfer-ownership' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"new_owner_user_id":"string"}' POST /v1/organizations/{orgId} /deletion Schedule the deletion of an organization (Owner only). Needs the typed organization name, your current password and, with MFA enabled, a recent MFA sign-in. The organization becomes read-only for 30 days (SDK keys keep serving), then it is erased. Schedule the deletion of an organization (Owner only). Needs the typed organization name, your current password and, with MFA enabled, a recent MFA sign-in. The organization becomes read-only for 30 days (SDK keys keep serving), then it is erased.
Requires permission `org:manage`. Session only: this permission cannot be granted to API tokens.
Requires org:manage on api.darkship.tech
Parameters Parameters for POST /v1/organizations/{orgId}/deletion Name In Type Description orgId path string required Organization id. confirm_name body string required See the request example.
Request body JSON application/json Copy{
"confirm_name" : "string" ,
"password" : "string"
}Response 202 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"slug" : "string" ,
"role" : "OWNER" ,
"created_at" : "string" ,
"updated_at" : "string" ,
"state" : "active" ,
"deletion_requested_at" : "string" ,
"purge_after" : "string"
}Errors Errors for POST /v1/organizations/{orgId}/deletion Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/organizations/{orgId}/deletion' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"confirm_name":"string","password":"string"}' POST /v1/organizations/{orgId} /restore Restore an organization scheduled for deletion (Owner only, inside the 30-day regret window). Restore an organization scheduled for deletion (Owner only, inside the 30-day regret window).
Requires permission `org:manage`. Session only: this permission cannot be granted to API tokens.
Requires org:manage on api.darkship.tech
Parameters Parameters for POST /v1/organizations/{orgId}/restore Name In Type Description orgId path string required Organization id.
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"slug" : "string" ,
"role" : "OWNER" ,
"created_at" : "string" ,
"updated_at" : "string" ,
"state" : "active" ,
"deletion_requested_at" : "string" ,
"purge_after" : "string"
}Errors Errors for POST /v1/organizations/{orgId}/restore Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/organizations/{orgId}/restore' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Projects 5 endpoints # Projects group flags, segments and environments. Creating one adds dev, staging and prod.
GET /v1/projects List projects List projects.
Requires permission `project:read` (role of the member, or scope of the API token).
Requires project:read on api.darkship.tech
Parameters Parameters for GET /v1/projects Name In Type Description limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"description" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/projects Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects Create a project with the default dev/staging/prod environments Create a project with the default dev/staging/prod environments.
Requires permission `project:manage` (role of the member, or scope of the API token).
Requires project:manage on api.darkship.tech
Parameters Parameters for POST /v1/projects Name In Type Description string optional name body string required See the request example. key body string required See the request example.
Request body JSON application/json Copy{
"name" : "Web app" ,
"key" : "web-app" ,
"description" : "Customer-facing storefront"
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"description" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for POST /v1/projects Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 402 Payment Required Plan limit or payment required 403 Forbidden Forbidden 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"Web app","key":"web-app","description":"Customer-facing storefront"}' GET /v1/projects/{projectId} Get a project Get a project.
Requires permission `project:read` (role of the member, or scope of the API token).
Requires project:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId} Name In Type Description projectId path string required Project id. string optional
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"description" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for GET /v1/projects/{projectId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' PATCH /v1/projects/{projectId} Update a project Update a project.
Requires permission `project:manage` (role of the member, or scope of the API token).
Requires project:manage on api.darkship.tech
Parameters Parameters for PATCH /v1/projects/{projectId} Name In Type Description projectId path string required Project id. string optional
Request body JSON application/json Copy{
"name" : "string" ,
"description" : "string"
}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"description" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for PATCH /v1/projects/{projectId} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PATCH 'https://api.darkship.tech/v1/projects/{projectId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"string","description":"string"}' DELETE /v1/projects/{projectId} Delete a project and everything in it Delete a project and everything in it.
Requires permission `project:manage` (role of the member, or scope of the API token).
Requires project:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/projects/{projectId} Name In Type Description projectId path string required Project id. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/projects/{projectId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/projects/{projectId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Environments 6 endpoints # Environments of a project (dev, staging, prod, ...). Each has its own flag configuration and SDK keys.
GET /v1/projects/{projectId} /environments List a project's environments in order List a project's environments in order.
Requires permission `environment:read` (role of the member, or scope of the API token).
Requires environment:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/environments Name In Type Description projectId path string required Project id. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"color" : "string" ,
"position" : -9007199254740991 ,
"require_confirm" : true ,
"require_reason" : true ,
"created_at" : "string" ,
"updated_at" : "string"
}
],
"next_cursor" : null
}Errors Errors for GET /v1/projects/{projectId}/environments Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/environments' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /environments Create an environment Create an environment.
Requires permission `environment:manage` (role of the member, or scope of the API token).
Requires environment:manage on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/environments Name In Type Description projectId path string required Project id. string optional name body string required See the request example. key body string required See the request example.
Request body JSON application/json Copy{
"name" : "QA" ,
"key" : "qa" ,
"color" : "#7c3aed" ,
"require_confirm" : false ,
"require_reason" : false
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"color" : "string" ,
"position" : -9007199254740991 ,
"require_confirm" : true ,
"require_reason" : true ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for POST /v1/projects/{projectId}/environments Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 402 Payment Required Plan limit or payment required 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/environments' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"QA","key":"qa","color":"#7c3aed","require_confirm":false,"require_reason":false}' PUT /v1/projects/{projectId} /environments/order Set the display order of the environments Set the display order of the environments.
Requires permission `environment:manage` (role of the member, or scope of the API token).
Requires environment:manage on api.darkship.tech
Parameters Parameters for PUT /v1/projects/{projectId}/environments/order Name In Type Description projectId path string required Project id. string optional environment_ids body array required See the request example.
Request body JSON application/json Copy{
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
]
}Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"color" : "string" ,
"position" : -9007199254740991 ,
"require_confirm" : true ,
"require_reason" : true ,
"created_at" : "string" ,
"updated_at" : "string"
}
],
"next_cursor" : null
}Errors Errors for PUT /v1/projects/{projectId}/environments/order Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 422 Unprocessable Content Unprocessable 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PUT 'https://api.darkship.tech/v1/projects/{projectId}/environments/order' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"environment_ids":["3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"]}' GET /v1/projects/{projectId} /environments/{envId} Get an environment Get an environment.
Requires permission `environment:read` (role of the member, or scope of the API token).
Requires environment:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/environments/{envId} Name In Type Description projectId path string required Project id. envId path string required Environment id. string optional
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"color" : "string" ,
"position" : -9007199254740991 ,
"require_confirm" : true ,
"require_reason" : true ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for GET /v1/projects/{projectId}/environments/{envId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/environments/{envId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' PATCH /v1/projects/{projectId} /environments/{envId} Update an environment's name or colour Update an environment's name or colour.
Requires permission `environment:manage` (role of the member, or scope of the API token).
Requires environment:manage on api.darkship.tech
Parameters Parameters for PATCH /v1/projects/{projectId}/environments/{envId} Name In Type Description projectId path string required Project id. envId path string required Environment id. string optional
Request body JSON application/json Copy{
"name" : "string" ,
"color" : "string" ,
"require_confirm" : true ,
"require_reason" : true
}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"name" : "string" ,
"key" : "string" ,
"color" : "string" ,
"position" : -9007199254740991 ,
"require_confirm" : true ,
"require_reason" : true ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for PATCH /v1/projects/{projectId}/environments/{envId} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PATCH 'https://api.darkship.tech/v1/projects/{projectId}/environments/{envId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"string","color":"string","require_confirm":true,"require_reason":true}' DELETE /v1/projects/{projectId} /environments/{envId} Delete an environment Delete an environment.
Requires permission `environment:manage` (role of the member, or scope of the API token).
Requires environment:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/projects/{projectId}/environments/{envId} Name In Type Description projectId path string required Project id. envId path string required Environment id. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/projects/{projectId}/environments/{envId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/projects/{projectId}/environments/{envId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Flags 10 endpoints # Typed feature flags. The type and key are fixed at creation; variations, name and tags can change.
GET /v1/projects/{projectId} /flags List flags of a project List flags of a project.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/flags Name In Type Description projectId path string required Project id. limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. q query string optional Case-insensitive text search. tag query string optional Only items carrying this tag. type query string optional Only flags of this type. archived query string optional `false` (default) hides archived flags, `true` lists only archived ones, `all` lists both. include query string optional Comma-separated expansions, e.g. `environments` to embed the per-environment state. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"type" : "boolean" ,
"description" : "string" ,
"tags" : [
"string"
],
"temporary" : true ,
"client_side" : true ,
"json_schema" : {},
"variations" : [
{
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"value" : "string"
}
],
"archived" : true ,
"archived_at" : "string" ,
"revision" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string" ,
"maintainer" : {
"id" : "string" ,
"name" : "string" ,
"email" : "string"
},
"environments" : [
{
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_key" : "string" ,
"enabled" : true ,
"rule_count" : -9007199254740991 ,
"target_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}
],
"stats" : {
"evals_7d" : -9007199254740991 ,
"last_eval_at" : "string" ,
"stale" : true ,
"stale_basis_days" : -9007199254740991
}
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/projects/{projectId}/flags Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/flags' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /flags Create a flag (type is fixed at creation). Supports Idempotency-Key. Create a flag (type is fixed at creation). Supports Idempotency-Key.
Creates the flag in every environment of the project, switched off and serving its off variation. Boolean flags get `true`/`false` variations when none are given. Send an `Idempotency-Key` to retry safely.
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags Name In Type Description projectId path string required Project id. Idempotency-Key header string optional Up to 255 printable ASCII characters. A replay within 24 h returns the original response; the same key with a different request answers 409 `idempotency_key_conflict`. string optional key body string required See the request example. name body string required See the request example. type body string required See the request example.
Request body JSON application/json Copy{
"key" : "new-checkout-flow" ,
"name" : "New checkout flow" ,
"type" : "boolean" ,
"description" : "Single-page checkout" ,
"tags" : [
"checkout"
],
"temporary" : true ,
"client_side" : false
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"type" : "boolean" ,
"description" : "string" ,
"tags" : [
"string"
],
"temporary" : true ,
"client_side" : true ,
"json_schema" : {},
"variations" : [
{
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"value" : "string"
}
],
"archived" : true ,
"archived_at" : "string" ,
"revision" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string" ,
"maintainer" : {
"id" : "string" ,
"name" : "string" ,
"email" : "string"
},
"environments" : [
{
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_key" : "string" ,
"enabled" : true ,
"rule_count" : -9007199254740991 ,
"target_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}
],
"stats" : {
"evals_7d" : -9007199254740991 ,
"last_eval_at" : "string" ,
"stale" : true ,
"stale_basis_days" : -9007199254740991
}
}Errors Errors for POST /v1/projects/{projectId}/flags Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 402 Payment Required Plan limit or payment required 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"key":"new-checkout-flow","name":"New checkout flow","type":"boolean","description":"Single-page checkout","tags":["checkout"],"temporary":true,"client_side":false}' GET /v1/projects/{projectId} /flags/{flagKey} Get a flag. Returns an ETag. Get a flag. Returns an ETag.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/flags/{flagKey} Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). string optional
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"type" : "boolean" ,
"description" : "string" ,
"tags" : [
"string"
],
"temporary" : true ,
"client_side" : true ,
"json_schema" : {},
"variations" : [
{
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"value" : "string"
}
],
"archived" : true ,
"archived_at" : "string" ,
"revision" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string" ,
"maintainer" : {
"id" : "string" ,
"name" : "string" ,
"email" : "string"
},
"environments" : [
{
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_key" : "string" ,
"enabled" : true ,
"rule_count" : -9007199254740991 ,
"target_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}
],
"stats" : {
"evals_7d" : -9007199254740991 ,
"last_eval_at" : "string" ,
"stale" : true ,
"stale_basis_days" : -9007199254740991
}
}Errors Errors for GET /v1/projects/{projectId}/flags/{flagKey} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' PATCH /v1/projects/{projectId} /flags/{flagKey} Update flag metadata and variations. If-Match is honoured (412). Variation or client-side changes by a Developer need production confirmation. Update flag metadata and variations. If-Match is honoured (412). Variation or client-side changes by a Developer need production confirmation.
Send only the fields you change. Variations in use by a rule or target cannot be removed (409 `variation_in_use`).
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for PATCH /v1/projects/{projectId}/flags/{flagKey} Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Request body JSON application/json Copy{
"name" : "New checkout flow (v2)" ,
"tags" : [
"checkout" ,
"q4"
]
}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"type" : "boolean" ,
"description" : "string" ,
"tags" : [
"string"
],
"temporary" : true ,
"client_side" : true ,
"json_schema" : {},
"variations" : [
{
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"value" : "string"
}
],
"archived" : true ,
"archived_at" : "string" ,
"revision" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string" ,
"maintainer" : {
"id" : "string" ,
"name" : "string" ,
"email" : "string"
},
"environments" : [
{
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_key" : "string" ,
"enabled" : true ,
"rule_count" : -9007199254740991 ,
"target_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}
],
"stats" : {
"evals_7d" : -9007199254740991 ,
"last_eval_at" : "string" ,
"stale" : true ,
"stale_basis_days" : -9007199254740991
}
}Errors Errors for PATCH /v1/projects/{projectId}/flags/{flagKey} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 412 Precondition Failed Precondition failed (stale ETag) 422 Unprocessable Content Unprocessable 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PATCH 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"New checkout flow (v2)","tags":["checkout","q4"]}' DELETE /v1/projects/{projectId} /flags/{flagKey} Delete a flag. Flags are soft-deleted (same as archive) so history and audit stay intact. Optional `reason` query. Delete a flag. Flags are soft-deleted (same as archive) so history and audit stay intact. Optional `reason` query.
A soft delete: the flag leaves every snapshot, its history stays, and it can be restored.
Requires permission `flag:delete` (role of the member, or scope of the API token).
Requires flag:delete on api.darkship.tech
Parameters Parameters for DELETE /v1/projects/{projectId}/flags/{flagKey} Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). reason query string optional Why the change is made (5 to 500 characters). Recorded in the audit log; required where the environment demands a reason. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/projects/{projectId}/flags/{flagKey} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /flags/{flagKey} /archive Archive a flag: it leaves every snapshot and can be restored Archive a flag: it leaves every snapshot and can be restored.
Requires permission `flag:delete` (role of the member, or scope of the API token).
Requires flag:delete on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags/{flagKey}/archive Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Request body JSON application/json Copy{}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"type" : "boolean" ,
"description" : "string" ,
"tags" : [
"string"
],
"temporary" : true ,
"client_side" : true ,
"json_schema" : {},
"variations" : [
{
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"value" : "string"
}
],
"archived" : true ,
"archived_at" : "string" ,
"revision" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string" ,
"maintainer" : {
"id" : "string" ,
"name" : "string" ,
"email" : "string"
},
"environments" : [
{
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_key" : "string" ,
"enabled" : true ,
"rule_count" : -9007199254740991 ,
"target_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}
],
"stats" : {
"evals_7d" : -9007199254740991 ,
"last_eval_at" : "string" ,
"stale" : true ,
"stale_basis_days" : -9007199254740991
}
}Errors Errors for POST /v1/projects/{projectId}/flags/{flagKey}/archive Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/archive' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{}' POST /v1/projects/{projectId} /flags/{flagKey} /restore Restore an archived flag Restore an archived flag.
Requires permission `flag:delete` (role of the member, or scope of the API token).
Requires flag:delete on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags/{flagKey}/restore Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Request body JSON application/json Copy{}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"type" : "boolean" ,
"description" : "string" ,
"tags" : [
"string"
],
"temporary" : true ,
"client_side" : true ,
"json_schema" : {},
"variations" : [
{
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"value" : "string"
}
],
"archived" : true ,
"archived_at" : "string" ,
"revision" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string" ,
"maintainer" : {
"id" : "string" ,
"name" : "string" ,
"email" : "string"
},
"environments" : [
{
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_key" : "string" ,
"enabled" : true ,
"rule_count" : -9007199254740991 ,
"target_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}
],
"stats" : {
"evals_7d" : -9007199254740991 ,
"last_eval_at" : "string" ,
"stale" : true ,
"stale_basis_days" : -9007199254740991
}
}Errors Errors for POST /v1/projects/{projectId}/flags/{flagKey}/restore Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/restore' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{}' GET /v1/projects/{projectId} /flags/{flagKey} /history Revision history of a flag (flag-level and per-environment), newest first Revision history of a flag (flag-level and per-environment), newest first.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/flags/{flagKey}/history Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"kind" : "flag" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"revision" : -9007199254740991 ,
"action" : "string" ,
"reason" : "string" ,
"actor_type" : "string" ,
"actor_id" : "string" ,
"created_at" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/projects/{projectId}/flags/{flagKey}/history Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/history' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/projects/{projectId} /flags/{flagKey} /history/{historyId} One revision with its stored state One revision with its stored state.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/flags/{flagKey}/history/{historyId} Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). historyId path string required Revision id from the history list. string optional
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"kind" : "flag" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"revision" : -9007199254740991 ,
"action" : "string" ,
"reason" : "string" ,
"actor_type" : "string" ,
"actor_id" : "string" ,
"created_at" : "string" ,
"state" : {}
}Errors Errors for GET /v1/projects/{projectId}/flags/{flagKey}/history/{historyId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/history/{historyId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /flags/{flagKey} /history/{historyId} /restore Restore the descriptive fields of a flag-level revision as a new revision Restore the descriptive fields of a flag-level revision as a new revision.
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags/{flagKey}/history/{historyId}/restore Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). historyId path string required Revision id from the history list. If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Request body JSON application/json Copy{}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"type" : "boolean" ,
"description" : "string" ,
"tags" : [
"string"
],
"temporary" : true ,
"client_side" : true ,
"json_schema" : {},
"variations" : [
{
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"value" : "string"
}
],
"archived" : true ,
"archived_at" : "string" ,
"revision" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string" ,
"maintainer" : {
"id" : "string" ,
"name" : "string" ,
"email" : "string"
},
"environments" : [
{
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_key" : "string" ,
"enabled" : true ,
"rule_count" : -9007199254740991 ,
"target_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}
],
"stats" : {
"evals_7d" : -9007199254740991 ,
"last_eval_at" : "string" ,
"stale" : true ,
"stale_basis_days" : -9007199254740991
}
}Errors Errors for POST /v1/projects/{projectId}/flags/{flagKey}/history/{historyId}/restore Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 412 Precondition Failed Precondition failed (stale ETag) 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/history/{historyId}/restore' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{}' Flag environments 9 endpoints # Per-environment state of a flag: on/off, individual targets, rules, fallthrough and rollout.
GET /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} State of a flag in one environment: toggle, targets, rules, rollout. Returns an ETag. State of a flag in one environment: toggle, targets, rules, rollout. Returns an ETag.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/flags/{flagKey}/environments/{envId} Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. string optional
Response 200 {
"flag_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"flag_key" : "string" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"enabled" : true ,
"off_variation" : "string" ,
"fallthrough" : {
"variation" : "string"
},
"targets" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
],
"variation" : "string"
}
],
"rules" : [
{
"id" : "string" ,
"description" : "string" ,
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
null
]
}
]
],
"serve" : {
"variation" : "string"
}
}
],
"salt" : "string" ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}Errors Errors for GET /v1/projects/{projectId}/flags/{flagKey}/environments/{envId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' PUT /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} Replace the environment configuration. If-Match is honoured (412); production edits by a Developer need confirmation (428). Replace the environment configuration. If-Match is honoured (412); production edits by a Developer need confirmation (428).
Replaces targets, rules, fallthrough and off variation in one revision. Send the `ETag` from the GET as `If-Match`.
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for PUT /v1/projects/{projectId}/flags/{flagKey}/environments/{envId} Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional enabled body boolean required See the request example. off_variation body string required See the request example. fallthrough body any required See the request example. targets body array required See the request example. rules body array required See the request example.
Request body JSON application/json Copy{
"enabled" : true ,
"off_variation" : "string" ,
"fallthrough" : {
"variation" : "string"
},
"targets" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
],
"variation" : "string"
}
],
"rules" : [
{
"id" : "string" ,
"description" : "string" ,
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
null
]
}
]
],
"serve" : {
"variation" : "string"
}
}
],
"reason" : "string"
}Response 200 {
"flag_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"flag_key" : "string" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"enabled" : true ,
"off_variation" : "string" ,
"fallthrough" : {
"variation" : "string"
},
"targets" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
],
"variation" : "string"
}
],
"rules" : [
{
"id" : "string" ,
"description" : "string" ,
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
null
]
}
]
],
"serve" : {
"variation" : "string"
}
}
],
"salt" : "string" ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}Errors Errors for PUT /v1/projects/{projectId}/flags/{flagKey}/environments/{envId} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 412 Precondition Failed Precondition failed (stale ETag) 422 Unprocessable Content Unprocessable 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PUT 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"enabled":true,"off_variation":"string","fallthrough":{"variation":"string"},"targets":[{"id":"string","match_by":"string","values":["string"],"variation":"string"}],"rules":[{"id":"string","description":"string","groups":[[{"attribute":"string","op":"string","values":[null]}]],"serve":{"variation":"string"}}],"reason":"string"}' PATCH /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} Partially update the environment configuration (only the given fields change) Partially update the environment configuration (only the given fields change).
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for PATCH /v1/projects/{projectId}/flags/{flagKey}/environments/{envId} Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Request body JSON application/json Copy{
"enabled" : true ,
"off_variation" : "string" ,
"fallthrough" : {
"variation" : "string"
},
"targets" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
],
"variation" : "string"
}
],
"rules" : [
{
"id" : "string" ,
"description" : "string" ,
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
null
]
}
]
],
"serve" : {
"variation" : "string"
}
}
],
"reason" : "string"
}Response 200 {
"flag_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"flag_key" : "string" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"enabled" : true ,
"off_variation" : "string" ,
"fallthrough" : {
"variation" : "string"
},
"targets" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
],
"variation" : "string"
}
],
"rules" : [
{
"id" : "string" ,
"description" : "string" ,
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
null
]
}
]
],
"serve" : {
"variation" : "string"
}
}
],
"salt" : "string" ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}Errors Errors for PATCH /v1/projects/{projectId}/flags/{flagKey}/environments/{envId} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 412 Precondition Failed Precondition failed (stale ETag) 422 Unprocessable Content Unprocessable 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PATCH 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"enabled":true,"off_variation":"string","fallthrough":{"variation":"string"},"targets":[{"id":"string","match_by":"string","values":["string"],"variation":"string"}],"rules":[{"id":"string","description":"string","groups":[[{"attribute":"string","op":"string","values":[null]}]],"serve":{"variation":"string"}}],"reason":"string"}' POST /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} /toggle Turn the flag on or off in this environment Turn the flag on or off in this environment.
The change reaches server SDKs over their stream within seconds. On production a Developer must confirm the change.
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/toggle Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional enabled body boolean required See the request example.
Request body JSON application/json Copy{
"enabled" : true ,
"reason" : "Launch to everyone"
}Response 200 {
"flag_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"flag_key" : "string" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"enabled" : true ,
"off_variation" : "string" ,
"fallthrough" : {
"variation" : "string"
},
"targets" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
],
"variation" : "string"
}
],
"rules" : [
{
"id" : "string" ,
"description" : "string" ,
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
null
]
}
]
],
"serve" : {
"variation" : "string"
}
}
],
"salt" : "string" ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}Errors Errors for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/toggle Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 412 Precondition Failed Precondition failed (stale ETag) 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/toggle' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"enabled":true,"reason":"Launch to everyone"}' POST /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} /evaluate-preview Evaluate a context against the saved configuration or a draft, with the shared evaluator. Nothing is stored. Evaluate a context against the saved configuration or a draft, with the shared evaluator. Nothing is stored.
Uses the same evaluator as the SDKs and the eval service. The context is not stored or logged.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/evaluate-preview Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. string optional context body object required See the request example.
Request body JSON application/json Copy{
"context" : {},
"draft" : {
"enabled" : true ,
"off_variation" : "string" ,
"fallthrough" : {
"variation" : "string"
},
"targets" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
],
"variation" : "string"
}
],
"rules" : [
{
"id" : "string" ,
"description" : "string" ,
"groups" : [
[
{
"attribute" : null ,
"op" : null ,
"values" : null
}
]
],
"serve" : {
"variation" : "string"
}
}
],
"reason" : "string"
}
}Response 200 {
"value" : "string" ,
"variation" : "string" ,
"reason" : "string" ,
"rule_id" : "string" ,
"error_code" : "string" ,
"bucket" : -9007199254740991 ,
"detail" : "string"
}Errors Errors for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/evaluate-preview Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 422 Unprocessable Content Unprocessable 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/evaluate-preview' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"context":{},"draft":{"enabled":true,"off_variation":"string","fallthrough":{"variation":"string"},"targets":[{"id":"string","match_by":"string","values":["string"],"variation":"string"}],"rules":[{"id":"string","description":"string","groups":[[{"attribute":null,"op":null,"values":null}]],"serve":{"variation":"string"}}],"reason":"string"}}' POST /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} /targets/import/preview Preview a paste/CSV import into a target list: added, duplicates, invalid, over limit Preview a paste/CSV import into a target list: added, duplicates, invalid, over limit.
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/targets/import/preview Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. string optional
Request body JSON application/json Copy{
"target_id" : "string" ,
"match_by" : "key" ,
"variation" : "string" ,
"mode" : "append" ,
"text" : "string" ,
"csv" : "string" ,
"reason" : "string"
}Response 200 {
"total" : -9007199254740991 ,
"added" : -9007199254740991 ,
"duplicates" : -9007199254740991 ,
"invalid" : [
{
"sample" : "string" ,
"error" : "string"
}
],
"over_limit" : -9007199254740991 ,
"limit" : -9007199254740991 ,
"applied" : true ,
"version" : -9007199254740991
}Errors Errors for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/targets/import/preview Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/targets/import/preview' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"target_id":"string","match_by":"key","variation":"string","mode":"append","text":"string","csv":"string","reason":"string"}' POST /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} /targets/import Apply a paste/CSV import. Refused (422) when it exceeds the plan limit; entries are never truncated. Supports Idempotency-Key. Apply a paste/CSV import. Refused (422) when it exceeds the plan limit; entries are never truncated. Supports Idempotency-Key.
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/targets/import Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. Idempotency-Key header string optional Up to 255 printable ASCII characters. A replay within 24 h returns the original response; the same key with a different request answers 409 `idempotency_key_conflict`. string optional
Request body JSON application/json Copy{
"target_id" : "string" ,
"match_by" : "key" ,
"variation" : "string" ,
"mode" : "append" ,
"text" : "string" ,
"csv" : "string" ,
"reason" : "string"
}Response 200 {
"total" : -9007199254740991 ,
"added" : -9007199254740991 ,
"duplicates" : -9007199254740991 ,
"invalid" : [
{
"sample" : "string" ,
"error" : "string"
}
],
"over_limit" : -9007199254740991 ,
"limit" : -9007199254740991 ,
"applied" : true ,
"version" : -9007199254740991
}Errors Errors for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/targets/import Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 412 Precondition Failed Precondition failed (stale ETag) 422 Unprocessable Content Unprocessable 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/targets/import' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"target_id":"string","match_by":"key","variation":"string","mode":"append","text":"string","csv":"string","reason":"string"}' GET /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} /history Configuration revisions of this flag in this environment Configuration revisions of this flag in this environment.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/history Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"kind" : "flag" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"revision" : -9007199254740991 ,
"action" : "string" ,
"reason" : "string" ,
"actor_type" : "string" ,
"actor_id" : "string" ,
"created_at" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/history Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/history' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /flags/{flagKey} /environments/{envId} /history/{historyId} /restore Restore a stored configuration revision as a new revision Restore a stored configuration revision as a new revision.
Requires permission `flag:write` (role of the member, or scope of the API token).
Requires flag:write on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/history/{historyId}/restore Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). envId path string required Environment id. historyId path string required Revision id from the history list. If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Request body JSON application/json Copy{}Response 200 {
"flag_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"flag_key" : "string" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"enabled" : true ,
"off_variation" : "string" ,
"fallthrough" : {
"variation" : "string"
},
"targets" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
],
"variation" : "string"
}
],
"rules" : [
{
"id" : "string" ,
"description" : "string" ,
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
null
]
}
]
],
"serve" : {
"variation" : "string"
}
}
],
"salt" : "string" ,
"version" : -9007199254740991 ,
"updated_at" : "string"
}Errors Errors for POST /v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/history/{historyId}/restore Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 412 Precondition Failed Precondition failed (stale ETag) 422 Unprocessable Content Unprocessable 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/environments/{envId}/history/{historyId}/restore' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{}' Segments 8 endpoints # Reusable audiences, project-wide. Every environment snapshot embeds them.
GET /v1/projects/{projectId} /segments List segments of a project List segments of a project.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/segments Name In Type Description projectId path string required Project id. limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. q query string optional Case-insensitive text search. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"included" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"excluded" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
null
]
}
]
],
"entry_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/projects/{projectId}/segments Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/segments' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /segments Create a segment (project-wide; every environment snapshot embeds it). Supports Idempotency-Key. Create a segment (project-wide; every environment snapshot embeds it). Supports Idempotency-Key.
Requires permission `segment:manage` (role of the member, or scope of the API token).
Requires segment:manage on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/segments Name In Type Description projectId path string required Project id. Idempotency-Key header string optional Up to 255 printable ASCII characters. A replay within 24 h returns the original response; the same key with a different request answers 409 `idempotency_key_conflict`. string optional key body string required See the request example. name body string required See the request example.
Request body JSON application/json Copy{
"key" : "beta-testers" ,
"name" : "Beta testers" ,
"description" : "Opted in to early features" ,
"included" : [
{
"match_by" : "key" ,
"values" : [
"usr_marta" ,
"usr_joao"
]
}
]
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"included" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"excluded" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
"string"
]
}
]
],
"entry_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for POST /v1/projects/{projectId}/segments Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 422 Unprocessable Content Unprocessable 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/segments' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"key":"beta-testers","name":"Beta testers","description":"Opted in to early features","included":[{"match_by":"key","values":["usr_marta","usr_joao"]}]}' GET /v1/projects/{projectId} /segments/{segmentKey} Get a segment. Returns an ETag. Get a segment. Returns an ETag.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/segments/{segmentKey} Name In Type Description projectId path string required Project id. segmentKey path string required Segment key (unique within the project). string optional
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"included" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"excluded" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
"string"
]
}
]
],
"entry_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for GET /v1/projects/{projectId}/segments/{segmentKey} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/segments/{segmentKey}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' PATCH /v1/projects/{projectId} /segments/{segmentKey} Update a segment. If-Match is honoured (412); a Developer needs production confirmation (428). Update a segment. If-Match is honoured (412); a Developer needs production confirmation (428).
Requires permission `segment:manage` (role of the member, or scope of the API token).
Requires segment:manage on api.darkship.tech
Parameters Parameters for PATCH /v1/projects/{projectId}/segments/{segmentKey} Name In Type Description projectId path string required Project id. segmentKey path string required Segment key (unique within the project). If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Request body JSON application/json Copy{
"name" : "string" ,
"description" : "string" ,
"included" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"excluded" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
"string"
]
}
]
],
"reason" : "string"
}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"key" : "string" ,
"name" : "string" ,
"description" : "string" ,
"included" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"excluded" : [
{
"id" : "string" ,
"match_by" : "string" ,
"values" : [
"string"
]
}
],
"groups" : [
[
{
"attribute" : "string" ,
"op" : "string" ,
"values" : [
"string"
]
}
]
],
"entry_count" : -9007199254740991 ,
"version" : -9007199254740991 ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for PATCH /v1/projects/{projectId}/segments/{segmentKey} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 412 Precondition Failed Precondition failed (stale ETag) 422 Unprocessable Content Unprocessable 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PATCH 'https://api.darkship.tech/v1/projects/{projectId}/segments/{segmentKey}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"string","description":"string","included":[{"id":"string","match_by":"string","values":["string"]}],"excluded":[{"id":"string","match_by":"string","values":["string"]}],"groups":[[{"attribute":"string","op":"string","values":["string"]}]],"reason":"string"}' DELETE /v1/projects/{projectId} /segments/{segmentKey} Delete a segment that no flag rule references. Optional `reason` query. Delete a segment that no flag rule references. Optional `reason` query.
Requires permission `segment:manage` (role of the member, or scope of the API token).
Requires segment:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/projects/{projectId}/segments/{segmentKey} Name In Type Description projectId path string required Project id. segmentKey path string required Segment key (unique within the project). reason query string optional Why the change is made (5 to 500 characters). Recorded in the audit log; required where the environment demands a reason. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/projects/{projectId}/segments/{segmentKey} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/projects/{projectId}/segments/{segmentKey}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/projects/{projectId} /segments/{segmentKey} /usage Flags (per environment) whose rules reference the segment Flags (per environment) whose rules reference the segment.
Requires permission `flag:read` (role of the member, or scope of the API token).
Requires flag:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/segments/{segmentKey}/usage Name In Type Description projectId path string required Project id. segmentKey path string required Segment key (unique within the project). string optional
Response 200 {
"data" : [
{
"flag_key" : "string" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"rule_ids" : [
"string"
]
}
]
}Errors Errors for GET /v1/projects/{projectId}/segments/{segmentKey}/usage Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/segments/{segmentKey}/usage' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /segments/{segmentKey} /import/preview Preview a paste/CSV import into a segment list Preview a paste/CSV import into a segment list.
Requires permission `segment:manage` (role of the member, or scope of the API token).
Requires segment:manage on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/segments/{segmentKey}/import/preview Name In Type Description projectId path string required Project id. segmentKey path string required Segment key (unique within the project). string optional list body string required See the request example.
Request body JSON application/json Copy{
"list" : "included" ,
"match_by" : "key" ,
"mode" : "append" ,
"text" : "string" ,
"csv" : "string" ,
"reason" : "string"
}Response 200 {
"total" : -9007199254740991 ,
"added" : -9007199254740991 ,
"duplicates" : -9007199254740991 ,
"invalid" : [
{
"sample" : "string" ,
"error" : "string"
}
],
"over_limit" : -9007199254740991 ,
"limit" : -9007199254740991 ,
"applied" : true ,
"version" : -9007199254740991
}Errors Errors for POST /v1/projects/{projectId}/segments/{segmentKey}/import/preview Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/segments/{segmentKey}/import/preview' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"list":"included","match_by":"key","mode":"append","text":"string","csv":"string","reason":"string"}' POST /v1/projects/{projectId} /segments/{segmentKey} /import Apply a paste/CSV import. Refused (422) beyond the plan limit; never truncates. Supports Idempotency-Key. Apply a paste/CSV import. Refused (422) beyond the plan limit; never truncates. Supports Idempotency-Key.
Requires permission `segment:manage` (role of the member, or scope of the API token).
Requires segment:manage on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/segments/{segmentKey}/import Name In Type Description projectId path string required Project id. segmentKey path string required Segment key (unique within the project). If-Match header string optional ETag of the version being changed. A stale value answers 412 `precondition_failed`. Darkship-Confirm-Production header string optional `true` confirms a change to a production environment (also accepted as `?confirm=true`). Required for Developers; Owners and Admins are not asked. Idempotency-Key header string optional Up to 255 printable ASCII characters. A replay within 24 h returns the original response; the same key with a different request answers 409 `idempotency_key_conflict`. string optional list body string required See the request example.
Request body JSON application/json Copy{
"list" : "included" ,
"match_by" : "key" ,
"mode" : "append" ,
"text" : "string" ,
"csv" : "string" ,
"reason" : "string"
}Response 200 {
"total" : -9007199254740991 ,
"added" : -9007199254740991 ,
"duplicates" : -9007199254740991 ,
"invalid" : [
{
"sample" : "string" ,
"error" : "string"
}
],
"over_limit" : -9007199254740991 ,
"limit" : -9007199254740991 ,
"applied" : true ,
"version" : -9007199254740991
}Errors Errors for POST /v1/projects/{projectId}/segments/{segmentKey}/import Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 412 Precondition Failed Precondition failed (stale ETag) 422 Unprocessable Content Unprocessable 428 Precondition Required Production confirmation required 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/segments/{segmentKey}/import' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"list":"included","match_by":"key","mode":"append","text":"string","csv":"string","reason":"string"}' SDK keys 5 endpoints # Server (`ds_srv_`) and client (`ds_cli_`) keys for the data plane. Secrets are shown once.
GET /v1/sdk-keys List SDK keys of the whole organization (metadata only) with project/environment keys and 7-day request counts List SDK keys of the whole organization (metadata only) with project/environment keys and 7-day request counts.
Requires permission `sdk_key:read` (role of the member, or scope of the API token).
Requires sdk_key:read on api.darkship.tech
Parameters Parameters for GET /v1/sdk-keys Name In Type Description limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. project_id query string optional Only items of this project. environment_id query string optional Only items of this environment. status query string optional Only items with this status. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"role" : "server" ,
"name" : "string" ,
"prefix" : "string" ,
"last4" : "string" ,
"masked" : "string" ,
"allowed_origins" : [
"string"
],
"status" : "active" ,
"rotated_from_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"created_at" : "string" ,
"last_used_at" : "string" ,
"expires_at" : "string" ,
"retire_at" : "string" ,
"revoked_at" : "string" ,
"secret" : "string" ,
"project_key" : "string" ,
"environment_key" : "string" ,
"requests_7d" : -9007199254740991 ,
"requests_scope" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/sdk-keys Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/sdk-keys' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/projects/{projectId} /environments/{envId} /sdk-keys List SDK keys of an environment (metadata only) List SDK keys of an environment (metadata only).
Requires permission `sdk_key:read` (role of the member, or scope of the API token).
Requires sdk_key:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/environments/{envId}/sdk-keys Name In Type Description projectId path string required Project id. envId path string required Environment id. limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"role" : "server" ,
"name" : "string" ,
"prefix" : "string" ,
"last4" : "string" ,
"masked" : "string" ,
"allowed_origins" : [
"string"
],
"status" : "active" ,
"rotated_from_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"created_at" : "string" ,
"last_used_at" : "string" ,
"expires_at" : "string" ,
"retire_at" : "string" ,
"revoked_at" : "string" ,
"secret" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/projects/{projectId}/environments/{envId}/sdk-keys Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/environments/{envId}/sdk-keys' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /environments/{envId} /sdk-keys Create an SDK key. The secret is returned once. Create an SDK key. The secret is returned once.
The secret is in the response once and never again; store it in your secret manager.
Requires permission `sdk_key:manage` (role of the member, or scope of the API token).
Requires sdk_key:manage on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/environments/{envId}/sdk-keys Name In Type Description projectId path string required Project id. envId path string required Environment id. string optional role body string required See the request example. name body string required See the request example.
Request body JSON application/json Copy{
"role" : "server" ,
"name" : "checkout-service"
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"role" : "server" ,
"name" : "string" ,
"prefix" : "string" ,
"last4" : "string" ,
"masked" : "string" ,
"allowed_origins" : [
"string"
],
"status" : "active" ,
"rotated_from_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"created_at" : "string" ,
"last_used_at" : "string" ,
"expires_at" : "string" ,
"retire_at" : "string" ,
"revoked_at" : "string" ,
"secret" : "string"
}Errors Errors for POST /v1/projects/{projectId}/environments/{envId}/sdk-keys Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/environments/{envId}/sdk-keys' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"role":"server","name":"checkout-service"}' POST /v1/sdk-keys/{keyId} /rotate Rotate an SDK key; the old one stays valid for the grace period Rotate an SDK key; the old one stays valid for the grace period.
Returns a new key. The previous key keeps working for `grace_period_hours` so you can roll it out.
Requires permission `sdk_key:manage` (role of the member, or scope of the API token).
Requires sdk_key:manage on api.darkship.tech
Parameters Parameters for POST /v1/sdk-keys/{keyId}/rotate Name In Type Description keyId path string required SDK key id. string optional
Request body JSON application/json Copy{
"grace_period_hours" : 24
}Response 201 {
"key" : {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"role" : "server" ,
"name" : "string" ,
"prefix" : "string" ,
"last4" : "string" ,
"masked" : "string" ,
"allowed_origins" : [
"string"
],
"status" : "active" ,
"rotated_from_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"created_at" : "string" ,
"last_used_at" : "string" ,
"expires_at" : "string" ,
"retire_at" : "string" ,
"revoked_at" : "string" ,
"secret" : "string"
},
"previous_key" : {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"role" : "server" ,
"name" : "string" ,
"prefix" : "string" ,
"last4" : "string" ,
"masked" : "string" ,
"allowed_origins" : [
"string"
],
"status" : "active" ,
"rotated_from_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"created_at" : "string" ,
"last_used_at" : "string" ,
"expires_at" : "string" ,
"retire_at" : "string" ,
"revoked_at" : "string" ,
"secret" : "string"
},
"grace_period_hours" : 0
}Errors Errors for POST /v1/sdk-keys/{keyId}/rotate Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/sdk-keys/{keyId}/rotate' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"grace_period_hours":24}' DELETE /v1/sdk-keys/{keyId} Revoke an SDK key immediately Revoke an SDK key immediately.
Requires permission `sdk_key:manage` (role of the member, or scope of the API token).
Requires sdk_key:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/sdk-keys/{keyId} Name In Type Description keyId path string required SDK key id. reason query string optional Why the change is made (5 to 500 characters). Recorded in the audit log; required where the environment demands a reason. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/sdk-keys/{keyId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/sdk-keys/{keyId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' API tokens 3 endpoints # Scoped `ds_pat_` tokens for this API. Secrets are shown once.
GET /v1/api-tokens List API tokens (own, or all for Owner/Admin) List API tokens (own, or all for Owner/Admin).
Requires permission `api_token:manage`. Session only: this permission cannot be granted to API tokens.
Requires api_token:manage on api.darkship.tech
Parameters Parameters for GET /v1/api-tokens Name In Type Description limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"user_id" : "string" ,
"name" : "string" ,
"prefix" : "string" ,
"last4" : "string" ,
"masked" : "string" ,
"scopes" : [
"string"
],
"project_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"status" : "active" ,
"created_at" : "string" ,
"last_used_at" : "string" ,
"expires_at" : "string" ,
"revoked_at" : "string" ,
"requests_7d" : -9007199254740991 ,
"secret" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/api-tokens Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/api-tokens' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/api-tokens Create a scoped API token. The secret is returned once. Create a scoped API token. The secret is returned once.
A token never holds more permissions than its creator and stops working if the creator leaves the organization.
Requires permission `api_token:manage`. Session only: this permission cannot be granted to API tokens.
Requires api_token:manage on api.darkship.tech
Parameters Parameters for POST /v1/api-tokens Name In Type Description string optional name body string required See the request example. scopes body array required See the request example.
Request body JSON application/json Copy{
"name" : "CI deploy" ,
"scopes" : [
"flag:read" ,
"flag:write"
]
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"user_id" : "string" ,
"name" : "string" ,
"prefix" : "string" ,
"last4" : "string" ,
"masked" : "string" ,
"scopes" : [
"string"
],
"project_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"status" : "active" ,
"created_at" : "string" ,
"last_used_at" : "string" ,
"expires_at" : "string" ,
"revoked_at" : "string" ,
"requests_7d" : -9007199254740991 ,
"secret" : "string"
}Errors Errors for POST /v1/api-tokens Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 422 Unprocessable Content Unprocessable 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/api-tokens' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"CI deploy","scopes":["flag:read","flag:write"]}' DELETE /v1/api-tokens/{tokenId} Revoke an API token Revoke an API token.
Requires permission `api_token:manage`. Session only: this permission cannot be granted to API tokens.
Requires api_token:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/api-tokens/{tokenId} Name In Type Description tokenId path string required API token id. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/api-tokens/{tokenId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/api-tokens/{tokenId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Members 4 endpoints # Organization members, their roles and scopes, and the role catalogue.
GET /v1/members List organization members List organization members.
Requires permission `member:read`. Session only: this permission cannot be granted to API tokens.
Requires member:read on api.darkship.tech
Parameters Parameters for GET /v1/members Name In Type Description limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"user_id" : "string" ,
"email" : "string" ,
"name" : "string" ,
"role" : "OWNER" ,
"project_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"created_at" : "string" ,
"mfa_enabled" : true ,
"last_active_at" : "string" ,
"invited_by" : {
"user_id" : "string" ,
"name" : "string" ,
"email" : "string"
}
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/members Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/members' \
-H 'Authorization: Bearer $DARKSHIP_KEY' PATCH /v1/members/{memberId} Change a member's role or scope Change a member's role or scope.
Requires permission `member:manage`. Session only: this permission cannot be granted to API tokens.
Requires member:manage on api.darkship.tech
Parameters Parameters for PATCH /v1/members/{memberId} Name In Type Description memberId path string required Member id. string optional
Request body JSON application/json Copy{
"role" : "OWNER" ,
"project_ids" : [],
"environment_ids" : []
}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"user_id" : "string" ,
"email" : "string" ,
"name" : "string" ,
"role" : "OWNER" ,
"project_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"created_at" : "string" ,
"mfa_enabled" : true ,
"last_active_at" : "string" ,
"invited_by" : {
"user_id" : "string" ,
"name" : "string" ,
"email" : "string"
}
}Errors Errors for PATCH /v1/members/{memberId} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 422 Unprocessable Content Unprocessable 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PATCH 'https://api.darkship.tech/v1/members/{memberId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"role":"OWNER","project_ids":[],"environment_ids":[]}' DELETE /v1/members/{memberId} Remove a member Remove a member.
Requires permission `member:manage`. Session only: this permission cannot be granted to API tokens.
Requires member:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/members/{memberId} Name In Type Description memberId path string required Member id. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/members/{memberId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/members/{memberId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/roles Role catalogue: label, description, scopability and the permissions each role holds Role catalogue: label, description, scopability and the permissions each role holds.
The permission strings listed here are the values of `x-required-scope` on each operation and of API token `scopes`.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for GET /v1/roles Name In Type Description string optional
Response 200 {
"data" : [
{
"role" : "OWNER" ,
"label" : "string" ,
"description" : "string" ,
"scopable" : true ,
"assignable_by" : [
"OWNER"
],
"permissions" : [
"string"
]
}
]
}Errors Errors for GET /v1/roles Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/roles' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Invitations 4 endpoints # Invite people by email; they join with the role and scope you choose.
GET /v1/invitations List invitations List invitations.
Requires permission `member:manage`. Session only: this permission cannot be granted to API tokens.
Requires member:manage on api.darkship.tech
Parameters Parameters for GET /v1/invitations Name In Type Description limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"email" : "string" ,
"role" : "OWNER" ,
"project_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"status" : "pending" ,
"expires_at" : "string" ,
"created_at" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/invitations Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/invitations' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/invitations Invite someone by email Invite someone by email.
Requires permission `member:manage`. Session only: this permission cannot be granted to API tokens.
Requires member:manage on api.darkship.tech
Parameters Parameters for POST /v1/invitations Name In Type Description string optional email body string required See the request example. role body string required See the request example.
Request body JSON application/json Copy{
"email" : "ana@example.com" ,
"role" : "DEVELOPER"
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"email" : "string" ,
"role" : "OWNER" ,
"project_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"status" : "pending" ,
"expires_at" : "string" ,
"created_at" : "string"
}Errors Errors for POST /v1/invitations Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 402 Payment Required Plan limit or payment required 403 Forbidden Forbidden 409 Conflict Conflict 422 Unprocessable Content Unprocessable 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/invitations' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"email":"ana@example.com","role":"DEVELOPER"}' POST /v1/invitations/accept Accept an invitation Accept an invitation.
Session only: any signed-in user (API tokens are not accepted).
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/invitations/accept Name In Type Description string optional token body string required See the request example.
Request body JSON application/json Copy{
"token" : "string"
}Response 200 {
"organization_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"member_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"role" : "OWNER"
}Errors Errors for POST /v1/invitations/accept Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/invitations/accept' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"token":"string"}' DELETE /v1/invitations/{invitationId} Revoke a pending invitation Revoke a pending invitation.
Requires permission `member:manage`. Session only: this permission cannot be granted to API tokens.
Requires member:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/invitations/{invitationId} Name In Type Description invitationId path string required Invitation id. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/invitations/{invitationId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/invitations/{invitationId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Webhooks 11 endpoints # Signed HTTP callbacks for flag, segment and environment changes, with a delivery log.
GET /v1/webhooks/event-types Event types you can subscribe to, the payload version and the signature tolerance Event types you can subscribe to, the payload version and the signature tolerance.
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for GET /v1/webhooks/event-types Name In Type Description string optional
Response 200 {
"data" : [
"string"
],
"payload_version" : 1.5 ,
"signature_tolerance_seconds" : 1.5
}Errors Errors for GET /v1/webhooks/event-types Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/webhooks/event-types' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/projects/{projectId} /webhooks List webhook endpoints of a project List webhook endpoints of a project.
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/webhooks Name In Type Description projectId path string required Project id. limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"url" : "string" ,
"description" : "string" ,
"event_types" : [
"string"
],
"status" : "active" ,
"health" : "healthy" ,
"disabled_reason" : "string" ,
"disabled_at" : "string" ,
"consecutive_failures" : 1.5 ,
"last_success_at" : "string" ,
"last_failure_at" : "string" ,
"secret_last4" : "string" ,
"secret_rotation_ends_at" : "string" ,
"secret" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/projects/{projectId}/webhooks Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/webhooks' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/projects/{projectId} /webhooks Create a webhook endpoint. The signing secret is returned once. Create a webhook endpoint. The signing secret is returned once.
The signing secret is in the response once. Verify the `Darkship-Signature` header on every delivery.
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for POST /v1/projects/{projectId}/webhooks Name In Type Description projectId path string required Project id. string optional url body string required See the request example.
Request body JSON application/json Copy{
"url" : "https://hooks.example.com/darkship" ,
"description" : "Deploy notifier" ,
"event_types" : [
"flag.updated"
]
}Response 201 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"url" : "string" ,
"description" : "string" ,
"event_types" : [
"string"
],
"status" : "active" ,
"health" : "healthy" ,
"disabled_reason" : "string" ,
"disabled_at" : "string" ,
"consecutive_failures" : 1.5 ,
"last_success_at" : "string" ,
"last_failure_at" : "string" ,
"secret_last4" : "string" ,
"secret_rotation_ends_at" : "string" ,
"secret" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for POST /v1/projects/{projectId}/webhooks Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/projects/{projectId}/webhooks' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"url":"https://hooks.example.com/darkship","description":"Deploy notifier","event_types":["flag.updated"]}' GET /v1/webhooks/{id} Get a webhook endpoint with its health Get a webhook endpoint with its health.
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for GET /v1/webhooks/{id} Name In Type Description id path string required Webhook endpoint id. string optional
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"url" : "string" ,
"description" : "string" ,
"event_types" : [
"string"
],
"status" : "active" ,
"health" : "healthy" ,
"disabled_reason" : "string" ,
"disabled_at" : "string" ,
"consecutive_failures" : 1.5 ,
"last_success_at" : "string" ,
"last_failure_at" : "string" ,
"secret_last4" : "string" ,
"secret_rotation_ends_at" : "string" ,
"secret" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for GET /v1/webhooks/{id} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/webhooks/{id}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' PATCH /v1/webhooks/{id} Update URL, subscriptions or status (re-enabling resets the failure streak) Update URL, subscriptions or status (re-enabling resets the failure streak).
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for PATCH /v1/webhooks/{id} Name In Type Description id path string required Webhook endpoint id. string optional
Request body JSON application/json Copy{
"url" : "string" ,
"description" : "string" ,
"event_types" : [
"string"
],
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"status" : "active"
}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"url" : "string" ,
"description" : "string" ,
"event_types" : [
"string"
],
"status" : "active" ,
"health" : "healthy" ,
"disabled_reason" : "string" ,
"disabled_at" : "string" ,
"consecutive_failures" : 1.5 ,
"last_success_at" : "string" ,
"last_failure_at" : "string" ,
"secret_last4" : "string" ,
"secret_rotation_ends_at" : "string" ,
"secret" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for PATCH /v1/webhooks/{id} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X PATCH 'https://api.darkship.tech/v1/webhooks/{id}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"url":"string","description":"string","event_types":["string"],"environment_ids":["3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"],"status":"active"}' DELETE /v1/webhooks/{id} Delete a webhook endpoint and its delivery log Delete a webhook endpoint and its delivery log.
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for DELETE /v1/webhooks/{id} Name In Type Description id path string required Webhook endpoint id. string optional
Response 204 Empty body (204 No Content).
Errors Errors for DELETE /v1/webhooks/{id} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X DELETE 'https://api.darkship.tech/v1/webhooks/{id}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/webhooks/{id} /rotate-secret Rotate the signing secret; the old one signs too during the overlap window Rotate the signing secret; the old one signs too during the overlap window.
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for POST /v1/webhooks/{id}/rotate-secret Name In Type Description id path string required Webhook endpoint id. string optional
Request body JSON application/json Copy{
"overlap_hours" : 24
}Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_ids" : [
"3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90"
],
"url" : "string" ,
"description" : "string" ,
"event_types" : [
"string"
],
"status" : "active" ,
"health" : "healthy" ,
"disabled_reason" : "string" ,
"disabled_at" : "string" ,
"consecutive_failures" : 1.5 ,
"last_success_at" : "string" ,
"last_failure_at" : "string" ,
"secret_last4" : "string" ,
"secret_rotation_ends_at" : "string" ,
"secret" : "string" ,
"created_at" : "string" ,
"updated_at" : "string"
}Errors Errors for POST /v1/webhooks/{id}/rotate-secret Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/webhooks/{id}/rotate-secret' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"overlap_hours":24}' POST /v1/webhooks/{id} /test Send a signed webhook.test event now and report the result (at most 3 in flight per organization) Send a signed webhook.test event now and report the result (at most 3 in flight per organization).
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for POST /v1/webhooks/{id}/test Name In Type Description id path string required Webhook endpoint id. string optional
Response 200 {
"delivery_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"ok" : true ,
"status_code" : 1.5 ,
"duration_ms" : 1.5 ,
"error" : "string" ,
"response_snippet" : "string"
}Errors Errors for POST /v1/webhooks/{id}/test Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/webhooks/{id}/test' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/webhooks/{id} /deliveries Delivery log of an endpoint (status, attempts, last response status and latency) Delivery log of an endpoint (status, attempts, last response status and latency).
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for GET /v1/webhooks/{id}/deliveries Name In Type Description id path string required Webhook endpoint id. limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. status query string optional Only items with this status. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"endpoint_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"event_id" : "string" ,
"event_type" : "string" ,
"status" : "pending" ,
"attempt_count" : 1.5 ,
"next_attempt_at" : "string" ,
"last_status_code" : 1.5 ,
"last_error" : "string" ,
"last_duration_ms" : 1.5 ,
"redelivery_of" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"created_at" : "string" ,
"completed_at" : "string"
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/webhooks/{id}/deliveries Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/webhooks/{id}/deliveries' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/webhooks/{id} /deliveries/{deliveryId} One delivery with every attempt and the event payload One delivery with every attempt and the event payload.
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for GET /v1/webhooks/{id}/deliveries/{deliveryId} Name In Type Description id path string required Webhook endpoint id. deliveryId path string required Delivery id from the delivery log. string optional
Response 200 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"endpoint_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"event_id" : "string" ,
"event_type" : "string" ,
"status" : "pending" ,
"attempt_count" : 1.5 ,
"next_attempt_at" : "string" ,
"last_status_code" : 1.5 ,
"last_error" : "string" ,
"last_duration_ms" : 1.5 ,
"redelivery_of" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"created_at" : "string" ,
"completed_at" : "string" ,
"attempts" : [
{
"attempt_number" : 1.5 ,
"started_at" : "string" ,
"duration_ms" : 1.5 ,
"status_code" : 1.5 ,
"ok" : true ,
"error" : "string" ,
"response_snippet" : "string"
}
],
"payload" : null
}Errors Errors for GET /v1/webhooks/{id}/deliveries/{deliveryId} Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/webhooks/{id}/deliveries/{deliveryId}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/webhooks/{id} /deliveries/{deliveryId} /redeliver Queue a new delivery of the same event (same event id) Queue a new delivery of the same event (same event id).
Requires permission `webhook:manage` (role of the member, or scope of the API token).
Requires webhook:manage on api.darkship.tech
Parameters Parameters for POST /v1/webhooks/{id}/deliveries/{deliveryId}/redeliver Name In Type Description id path string required Webhook endpoint id. deliveryId path string required Delivery id from the delivery log. string optional
Response 202 {
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"endpoint_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"event_id" : "string" ,
"event_type" : "string" ,
"status" : "pending" ,
"attempt_count" : 1.5 ,
"next_attempt_at" : "string" ,
"last_status_code" : 1.5 ,
"last_error" : "string" ,
"last_duration_ms" : 1.5 ,
"redelivery_of" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"created_at" : "string" ,
"completed_at" : "string"
}Errors Errors for POST /v1/webhooks/{id}/deliveries/{deliveryId}/redeliver Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 409 Conflict Conflict 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/webhooks/{id}/deliveries/{deliveryId}/redeliver' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Audit log 1 endpoint # Who changed what and when, newest first.
GET /v1/audit-log Query the audit log (newest first, cursor pagination) Query the audit log (newest first, cursor pagination).
Filter by actor, action, resource and time range. Pagination is by cursor, newest first.
Requires permission `audit:read` (role of the member, or scope of the API token).
Requires audit:read on api.darkship.tech
Parameters Parameters for GET /v1/audit-log Name In Type Description limit query integer optional Page size (1 to 200). cursor query string optional Opaque cursor from the previous page's `next_cursor`. Omit for the first page. actor_id query string optional Only entries made by this user or token. actor_type query string optional Only entries made by this kind of actor. action query string optional Only entries with this action, e.g. `flag.updated`. resource_type query string optional Only entries about this kind of resource. resource_id query string optional Only entries about this resource. project_id query string optional Only items of this project. environment_id query string optional Only items of this environment. from query string optional Start of the time range (ISO-8601, inclusive). to query string optional End of the time range (ISO-8601, exclusive). q query string optional Case-insensitive text search. string optional
Response 200 {
"data" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"occurred_at" : "string" ,
"actor_type" : "USER" ,
"actor_id" : "string" ,
"token_prefix" : "string" ,
"action" : "string" ,
"resource_type" : "string" ,
"resource_id" : "string" ,
"project_id" : "string" ,
"environment_id" : "string" ,
"before" : null ,
"after" : null ,
"ip" : "string" ,
"user_agent" : "string" ,
"request_id" : "string" ,
"summary" : "string" ,
"reason" : "string" ,
"environment_key" : "string" ,
"actor" : {
"type" : "USER" ,
"id" : "string" ,
"name" : "string" ,
"email" : "string"
}
}
],
"next_cursor" : "string"
}Errors Errors for GET /v1/audit-log Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/audit-log' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Usage 3 endpoints # Requests and evaluations over time, per organization, project and flag.
GET /v1/usage Organization request usage for a calendar month (fetches + remote evaluations) Organization request usage for a calendar month (fetches + remote evaluations).
Requires permission `usage:read` (role of the member, or scope of the API token).
Requires usage:read on api.darkship.tech
Parameters Parameters for GET /v1/usage Name In Type Description month query string optional Calendar month as `YYYY-MM` (UTC). Default: the current month. string optional
Response 200 {
"month" : "string" ,
"from" : "string" ,
"to" : "string" ,
"as_of" : "string" ,
"requests" : {
"fetches" : 1.5 ,
"remote_evaluations" : 1.5 ,
"total" : 1.5
},
"daily" : [
{
"day" : "string" ,
"fetches" : 1.5 ,
"remote_evaluations" : 1.5
}
],
"by_project" : [
{
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"fetches" : 1.5 ,
"remote_evaluations" : 1.5 ,
"total" : 1.5
}
],
"by_environment" : [
{
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_key" : "string" ,
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"fetches" : 1.5 ,
"remote_evaluations" : 1.5 ,
"total" : 1.5
}
]
}Errors Errors for GET /v1/usage Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/usage' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/projects/{projectId} /usage Requests and flag evaluations over time, plus the top flags Requests and flag evaluations over time, plus the top flags.
Requires permission `usage:read` (role of the member, or scope of the API token).
Requires usage:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/usage Name In Type Description projectId path string required Project id. environment_id query string optional Only items of this environment. from query string optional Start of the time range (ISO-8601, inclusive). to query string optional End of the time range (ISO-8601, exclusive). granularity query string optional Bucket size of the time series. top query integer optional How many flags to list in the top-flags ranking. string optional
Response 200 {
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"granularity" : "hour" ,
"from" : "string" ,
"to" : "string" ,
"as_of" : "string" ,
"requests" : [
{
"t" : "string" ,
"fetches" : 1.5 ,
"remote_evaluations" : 1.5
}
],
"evaluations" : [
{
"t" : "string" ,
"count" : 1.5
}
],
"totals" : {
"fetches" : 1.5 ,
"remote_evaluations" : 1.5 ,
"evaluations" : 1.5
},
"top_flags" : [
{
"flag_key" : "string" ,
"count" : 1.5 ,
"share" : 1.5 ,
"variations" : [
{
"variation" : "string" ,
"count" : 1.5
}
]
}
]
}Errors Errors for GET /v1/projects/{projectId}/usage Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/usage' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/projects/{projectId} /flags/{flagKey} /usage Evaluations of one flag by variation over time Evaluations of one flag by variation over time.
Requires permission `usage:read` (role of the member, or scope of the API token).
Requires usage:read on api.darkship.tech
Parameters Parameters for GET /v1/projects/{projectId}/flags/{flagKey}/usage Name In Type Description projectId path string required Project id. flagKey path string required Flag key (unique within the project, fixed at creation). environment_id query string optional Only items of this environment. from query string optional Start of the time range (ISO-8601, inclusive). to query string optional End of the time range (ISO-8601, exclusive). granularity query string optional Bucket size of the time series. string optional
Response 200 {
"project_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"environment_id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"flag_key" : "string" ,
"granularity" : "hour" ,
"from" : "string" ,
"to" : "string" ,
"as_of" : "string" ,
"series" : [
{
"t" : "string" ,
"total" : 1.5 ,
"by_variation" : {}
}
],
"variations" : [
{
"variation" : "string" ,
"count" : 1.5 ,
"share" : 1.5
}
],
"total" : 1.5
}Errors Errors for GET /v1/projects/{projectId}/flags/{flagKey}/usage Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/projects/{projectId}/flags/{flagKey}/usage' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Billing 5 endpoints # Plan, subscription, Stripe Checkout and Customer Portal, and the public plan catalogue.
GET /v1/orgs/{orgId} /billing Plan, subscription status, usage against limits and invoices Plan, subscription status, usage against limits and invoices.
Requires permission `billing:manage`. Session only: this permission cannot be granted to API tokens.
Requires billing:manage on api.darkship.tech
Parameters Parameters for GET /v1/orgs/{orgId}/billing Name In Type Description orgId path string required Organization id.
Response 200 {
"plan" : "free" ,
"effective_plan" : "free" ,
"interval" : "month" ,
"status" : "trialing" ,
"org_state" : "active" ,
"cancel_at_period_end" : true ,
"current_period_start" : "string" ,
"current_period_end" : "string" ,
"grace_until" : "string" ,
"billing_email" : "string" ,
"limits" : {
"monthly_requests" : 1.5 ,
"projects" : 1.5 ,
"environments_per_project" : 1.5 ,
"seats" : 1.5 ,
"flags" : 1.5 ,
"audit_retention_days" : 1.5 ,
"target_list_entries" : 1.5 ,
"segment_entries" : 1.5 ,
"entry_length" : 1.5
},
"usage" : {
"period_start" : "string" ,
"period_end" : "string" ,
"requests" : 1.5 ,
"requests_limit" : 1.5 ,
"requests_percent" : 1.5 ,
"projects" : {
"used" : 1.5 ,
"limit" : 1.5
},
"seats" : {
"used" : 1.5 ,
"limit" : 1.5
},
"environments" : {
"used" : 1.5 ,
"limit_per_project" : 1.5
}
},
"notices" : [
{
"kind" : "string" ,
"period_start" : "string" ,
"created_at" : "string"
}
],
"invoices" : [
{
"id" : "string" ,
"number" : "string" ,
"status" : "string" ,
"currency" : "string" ,
"amount_due" : 1.5 ,
"amount_paid" : 1.5 ,
"created_at" : "string" ,
"hosted_invoice_url" : "string"
}
],
"invoices_available" : true
}Errors Errors for GET /v1/orgs/{orgId}/billing Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 404 Not Found Not found 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/orgs/{orgId}/billing' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/orgs/{orgId} /billing/checkout Start a Stripe Checkout Session (subscription) Start a Stripe Checkout Session (subscription).
Requires permission `billing:manage`. Session only: this permission cannot be granted to API tokens.
Requires billing:manage on api.darkship.tech
Parameters Parameters for POST /v1/orgs/{orgId}/billing/checkout Name In Type Description orgId path string required Organization id. plan body string required See the request example. interval body string required See the request example.
Request body JSON application/json Copy{
"plan" : "pro" ,
"interval" : "month"
}Response 200 Errors Errors for POST /v1/orgs/{orgId}/billing/checkout Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 409 Conflict Conflict 429 Too Many Requests Rate limited 503 Service unavailable 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/orgs/{orgId}/billing/checkout' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"plan":"pro","interval":"month"}' POST /v1/orgs/{orgId} /billing/portal Open the Stripe Customer Portal (payment method, invoices, plan change, cancellation) Open the Stripe Customer Portal (payment method, invoices, plan change, cancellation).
Requires permission `billing:manage`. Session only: this permission cannot be granted to API tokens.
Requires billing:manage on api.darkship.tech
Parameters Parameters for POST /v1/orgs/{orgId}/billing/portal Name In Type Description orgId path string required Organization id.
Response 200 Errors Errors for POST /v1/orgs/{orgId}/billing/portal Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 409 Conflict Conflict 429 Too Many Requests Rate limited 503 Service unavailable 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/orgs/{orgId}/billing/portal' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/plans Public plan catalogue (prices and limits are placeholders until `pricing_is_placeholder` is false) Public plan catalogue (prices and limits are placeholders until `pricing_is_placeholder` is false).
No authentication.
Requires API token or session on api.darkship.tech
Parameters No parameters.
Response 200 {
"currency" : "string" ,
"pricing_is_placeholder" : true ,
"data" : [
{
"id" : "free" ,
"name" : "string" ,
"price_usd_cents" : {
"month" : 1.5 ,
"year" : 1.5
},
"purchasable" : true ,
"limits" : {
"monthly_requests" : 1.5 ,
"projects" : 1.5 ,
"environments_per_project" : 1.5 ,
"seats" : 1.5 ,
"flags" : 1.5 ,
"audit_retention_days" : 1.5 ,
"target_list_entries" : 1.5 ,
"segment_entries" : 1.5 ,
"entry_length" : 1.5
}
}
]
}Errors Errors for GET /v1/plans Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/plans' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/webhooks/stripe Stripe webhook receiver (signature verified, idempotent by event id) Stripe webhook receiver (signature verified, idempotent by event id).
No authentication.
Requires API token or session on api.darkship.tech
Parameters No parameters.
Response 200 Errors Errors for POST /v1/webhooks/stripe Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Validation failed 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 503 Service unavailable 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/webhooks/stripe' \
-H 'Authorization: Bearer $DARKSHIP_KEY' Public platform status: maintenance, announcements, read-only mode.
GET /v1/platform/status Public platform status: maintenance banner, announcements, read-only mode and sign-up availability Public platform status: maintenance banner, announcements, read-only mode and sign-up availability.
No authentication.
Requires API token or session on api.darkship.tech
Parameters No parameters.
Response 200 {
"read_only" : true ,
"signups_disabled" : true ,
"signups_message" : "string" ,
"maintenance" : {
"message" : "string" ,
"severity" : "info"
},
"announcements" : [
{
"id" : "3f2b8c1e-6a4d-4e0b-9f57-2d1c8a7e5b90" ,
"title" : "string" ,
"body" : "string" ,
"severity" : "info" ,
"starts_at" : "2026-10-28T14:30:00Z" ,
"ends_at" : "2026-10-28T14:30:00Z"
}
]
}Errors Errors for GET /v1/platform/status Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Not authenticated 403 Forbidden Forbidden 429 Too Many Requests Rate limited 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/platform/status' \
-H 'Authorization: Bearer $DARKSHIP_KEY' SDK data plane 6 endpoints # Served by the evaluation service (`eval` host), not the management API. Server keys download the ruleset snapshot (or subscribe to changes) and evaluate in-process; client keys ask for evaluated values only. Use these routes to write an SDK for a language we do not ship.
GET /v1/sdk/snapshot Download the ruleset snapshot of the key's environment (server keys) Returns every flag and segment of the environment so the SDK can evaluate locally with no network on the evaluation path. Send the last `ETag` as `If-None-Match`: an unchanged ruleset answers `304` with no body. Poll at most every 30 s when not streaming; bodies larger than 1 KiB are gzip-compressed when you send `Accept-Encoding: gzip`.
Requires API token or session on api.darkship.tech
Parameters Parameters for GET /v1/sdk/snapshot Name In Type Description If-None-Match header string optional ETag of the snapshot you hold (its quoted `version`). Darkship-Sdk header string optional SDK name and version, e.g. `js/1.2.0` or `python/0.4.1`. Used for usage breakdowns and support; never for access decisions.
Response 200 {
"schemaVersion" : 1.5 ,
"version" : "string" ,
"environmentId" : "string" ,
"generatedAt" : "2026-10-28T14:30:00Z" ,
"flags" : {},
"segments" : {}
}Response 304 Empty body (304 Not Modified).
Errors Errors for GET /v1/sdk/snapshot Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Missing, malformed, revoked or expired SDK key (`unauthenticated`). 403 Wrong key kind for this route, or the organization is hard-suspended (`org_suspended`, also signalled by `Darkship-Org-State suspended_hard`). 429 Too Many Requests Rate limited. Honour `Retry-After`. 503 No snapshot could be served (cold start with Redis unavailable). Retry with backoff; keep your last ruleset. 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/sdk/snapshot' \
-H 'Authorization: Bearer $DARKSHIP_KEY' GET /v1/sdk/stream Subscribe to ruleset changes over server-sent events (server keys) A long-lived `text/event-stream`. Any event other than `heartbeat` means the ruleset may have changed: fetch the snapshot again with `If-None-Match`. The payload carries the new `version` as a hint (skip the fetch when you already hold it). Reconnect with exponential backoff and keep polling the snapshot while disconnected. This is how SDKs reach a change within seconds.
Requires API token or session on api.darkship.tech
Parameters Parameters for GET /v1/sdk/stream Name In Type Description Darkship-Sdk header string optional SDK name and version, e.g. `js/1.2.0` or `python/0.4.1`. Used for usage breakdowns and support; never for access decisions.
Response 200 event: snapshot
data: {"version":"9c1d5e0a3b7f4c2e8d6a1b0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a2f1e0d"}
event: heartbeat
data: {}Errors Errors for GET /v1/sdk/stream Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Missing, malformed, revoked or expired SDK key (`unauthenticated`). 403 Wrong key kind for this route, or the organization is hard-suspended (`org_suspended`, also signalled by `Darkship-Org-State suspended_hard`). 429 Too Many Requests Rate limited. Honour `Retry-After`. 503 No snapshot could be served (cold start with Redis unavailable). Retry with backoff; keep your last ruleset. 429 rate_limited See rate limits.
Example request curl -X GET 'https://api.darkship.tech/v1/sdk/stream' \
-H 'Authorization: Bearer $DARKSHIP_KEY' POST /v1/sdk/evaluate Evaluate the client-visible flags for a context (client keys) Remote evaluation for browsers and mobile apps: returns values only, never rules, target lists or segments. Only flags marked client-side are visible to client keys. The context is evaluated in memory and never stored or logged.
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/sdk/evaluate Name In Type Description Darkship-Sdk header string optional SDK name and version, e.g. `js/1.2.0` or `python/0.4.1`. Used for usage breakdowns and support; never for access decisions. context body any required See the request example.
Request body JSON application/json Copy{
"context" : {
"key" : "usr_marta" ,
"email" : "marta@example.com" ,
"plan" : "pro" ,
"groups" : [
"beta-testers"
]
},
"flag_keys" : [
"new-checkout-flow" ,
"promo-banner-text"
]
}Response 200 {
"version" : "9c1d5e0a3b7f4c2e8d6a1b0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a2f1e0d" ,
"flags" : {
"new-checkout-flow" : {
"value" : true ,
"variation_key" : "on" ,
"reason" : "RULE_MATCH" ,
"flag_type" : "boolean"
},
"promo-banner-text" : {
"value" : "Free shipping this week" ,
"variation_key" : "promo" ,
"reason" : "FALLTHROUGH" ,
"flag_type" : "string"
}
}
}Errors Errors for POST /v1/sdk/evaluate Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Malformed JSON or a body without `context` (`validation_failed`). 401 Unauthorized Missing, malformed, revoked or expired SDK key (`unauthenticated`). 403 Wrong key kind for this route, or the organization is hard-suspended (`org_suspended`, also signalled by `Darkship-Org-State suspended_hard`). 429 Too Many Requests Rate limited. Honour `Retry-After`. 503 No snapshot could be served (cold start with Redis unavailable). Retry with backoff; keep your last ruleset. 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/sdk/evaluate' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"context":{"key":"usr_marta","email":"marta@example.com","plan":"pro","groups":["beta-testers"]},"flag_keys":["new-checkout-flow","promo-banner-text"]}' POST /v1/sdk/evaluate/{flagKey} Evaluate one client-visible flag for a context (client keys) Same as the bulk evaluation for a single flag. A flag that does not exist or is not client-visible answers 404 `flag_not_found`.
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/sdk/evaluate/{flagKey} Name In Type Description flagKey path string required Flag key. Darkship-Sdk header string optional SDK name and version, e.g. `js/1.2.0` or `python/0.4.1`. Used for usage breakdowns and support; never for access decisions. context body object required See the request example.
Request body JSON application/json Copy{
"context" : {
"key" : "usr_marta" ,
"email" : "marta@example.com" ,
"plan" : "pro" ,
"groups" : [
"beta-testers"
]
}
}Response 200 {
"flag_key" : "new-checkout-flow" ,
"version" : "9c1d5e0a3b7f4c2e8d6a1b0f9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a2f1e0d" ,
"value" : true ,
"variation_key" : "on" ,
"reason" : "RULE_MATCH" ,
"flag_type" : "boolean"
}Errors Errors for POST /v1/sdk/evaluate/{flagKey} Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Invalid flag key, malformed JSON or missing `context` (`validation_failed`). 401 Unauthorized Missing, malformed, revoked or expired SDK key (`unauthenticated`). 403 Wrong key kind for this route, or the organization is hard-suspended (`org_suspended`, also signalled by `Darkship-Org-State suspended_hard`). 404 Not Found No client-visible flag with this key (`flag_not_found`). 429 Too Many Requests Rate limited. Honour `Retry-After`. 503 No snapshot could be served (cold start with Redis unavailable). Retry with backoff; keep your last ruleset. 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/sdk/evaluate/{flagKey}' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"context":{"key":"usr_marta","email":"marta@example.com","plan":"pro","groups":["beta-testers"]}}' POST /v1/telemetry/counters Report aggregate evaluation counters (server keys) Counters per flag x variation x one-minute window, never contexts or user ids. Unknown flags and windows outside the accepted range are dropped silently (an SDK may lag behind a deleted flag).
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/telemetry/counters Name In Type Description Darkship-Sdk header string optional SDK name and version, e.g. `js/1.2.0` or `python/0.4.1`. Used for usage breakdowns and support; never for access decisions. sdk body string required See the request example. sdk_version body string required See the request example. counters body array required See the request example.
Request body JSON application/json Copy{
"sdk" : "js" ,
"sdk_version" : "0.1.0" ,
"counters" : [
{
"flag_key" : "new-checkout-flow" ,
"variation" : "on" ,
"window_start" : "2026-10-28T14:30:00Z" ,
"count" : 1842
}
]
}Response 202 Errors Errors for POST /v1/telemetry/counters Status code When 401 unauthenticated Missing or invalid credentials. 400 Bad Request Body does not match the schema (`validation_failed`). 401 Unauthorized Missing, malformed, revoked or expired SDK key (`unauthenticated`). 403 Wrong key kind for this route, or the organization is hard-suspended (`org_suspended`, also signalled by `Darkship-Org-State suspended_hard`). 429 Too Many Requests Rate limited. Honour `Retry-After`. 503 No snapshot could be served (cold start with Redis unavailable). Retry with backoff; keep your last ruleset. 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/telemetry/counters' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"sdk":"js","sdk_version":"0.1.0","counters":[{"flag_key":"new-checkout-flow","variation":"on","window_start":"2026-10-28T14:30:00Z","count":1842}]}' POST /v1/sdk/telemetry Report aggregate evaluation counters (deprecated alias) Deprecated alias of `POST /v1/telemetry/counters` kept for early SDK builds; responses carry `Deprecation: true`. Use `/v1/telemetry/counters`.
Requires API token or session on api.darkship.tech
Parameters Parameters for POST /v1/sdk/telemetry Name In Type Description Darkship-Sdk header string optional SDK name and version, e.g. `js/1.2.0` or `python/0.4.1`. Used for usage breakdowns and support; never for access decisions. sdk body string required See the request example. sdk_version body string required See the request example. counters body array required See the request example.
Request body JSON application/json Copy{
"sdk" : "string" ,
"sdk_version" : "string" ,
"counters" : [
{
"flag_key" : "string" ,
"variation" : "string" ,
"window_start" : "2026-10-28T14:30:00Z" ,
"count" : 0
}
]
}Response 202 Errors Errors for POST /v1/sdk/telemetry Status code When 401 unauthenticated Missing or invalid credentials. 401 Unauthorized Missing, malformed, revoked or expired SDK key (`unauthenticated`). 403 Wrong key kind for this route, or the organization is hard-suspended (`org_suspended`, also signalled by `Darkship-Org-State suspended_hard`). 429 Too Many Requests Rate limited. Honour `Retry-After`. 503 No snapshot could be served (cold start with Redis unavailable). Retry with backoff; keep your last ruleset. 429 rate_limited See rate limits.
Example request curl -X POST 'https://api.darkship.tech/v1/sdk/telemetry' \
-H 'Authorization: Bearer $DARKSHIP_KEY' \
-H 'Content-Type: application/json' \
-d '{"sdk":"string","sdk_version":"string","counters":[{"flag_key":"string","variation":"string","window_start":"2026-10-28T14:30:00Z","count":0}]}'
No endpoints match. Clear the filter or choose "All".
Thanks. This helps us prioritise the docs.
PreviousPlan gating Next API explorer