{"openapi":"3.1.0","info":{"title":"NanoFlags Management API","version":"1.0.0","summary":"Manage flags, segments, changes and publishing from CI pipelines, scripts and infrastructure tooling.","description":"A versioned REST API over the same rules as the dashboard: roles, independent approvals, scenario checks, protected environments, plan gating and the audit log. Every request runs as the person who created the token, with that person's current role, narrowed by the token's scopes.\n\n**Authentication.** `Authorization: Bearer nf_api_…`. Tokens are created by organization owners and admins (see the docs page), are scoped to the organization or one project, carry explicit scopes and an expiry, and are stored hashed. Using a token needs no interactive two-step verification; creating one does where the organization requires it. Every use is audited with the token id.\n\n**Errors** are `{\"error\":{\"code\",\"message\"}}`; `code` is stable. **Pagination**: list endpoints return `{ data, nextCursor }`; pass `cursor` to continue. **Idempotency**: send `Idempotency-Key` on POST. **Rate limits**: see `RateLimit-Policy`. **Caching**: GET answers carry an `ETag`.","contact":{"name":"NanoFlags support","email":"support@nanoflags.io","url":"https://nanoflags.io/docs/api-reference"},"license":{"name":"Proprietary","url":"https://nanoflags.io/terms"}},"servers":[{"url":"https://edge.nanoflags.io/api/v1","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Token","description":"The token making the request."},{"name":"Projects","description":"Projects of the token's organization."},{"name":"Environments","description":"Environments and their publishing policy."},{"name":"Flags","description":"Flag definitions (shared by every environment of a project)."},{"name":"Flag configurations","description":"A flag's draft configuration per environment."},{"name":"Segments","description":"Reusable audiences, part of every environment's draft."},{"name":"Changes","description":"Reviewed changes and independent approvals."},{"name":"Publishing","description":"Publishing an environment's draft as a new revision."},{"name":"Scheduled publishing","description":"Publishing a pinned draft at a future time, under the same rules as publishing now (Team plan and above)."},{"name":"Revisions","description":"Immutable published revisions, diffs and restore-to-draft."},{"name":"Scenarios","description":"Saved scenarios and their run results."},{"name":"Audit log","description":"Who did what, when; includes every API token use."},{"name":"SDK keys","description":"Key metadata, never key material."},{"name":"Usage insights","description":"Sampled evaluation usage per flag and project (scope insights:read)."},{"name":"Meta","description":"This API description."}],"paths":{"/token":{"get":{"operationId":"getToken","tags":["Token"],"summary":"The calling token","description":"Metadata of the token used for this request: scopes, project scope, expiry.\n\nScope: any valid token.","security":[{"bearerAuth":[]}],"parameters":[{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects":{"get":{"operationId":"listProjects","tags":["Projects"],"summary":"List projects","description":"Projects of the token's organization (only its project for a project token).\n\nScope: any valid token.","security":[{"bearerAuth":[]}],"parameters":[{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}":{"get":{"operationId":"getProject","tags":["Projects"],"summary":"Get a project","description":"Scope: any valid token.","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments":{"get":{"operationId":"listEnvironments","tags":["Environments"],"summary":"List environments","description":"Ordered as in the dashboard. Not paginated (`nextCursor` is always null).\n\nScope: any valid token.","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnvironmentList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}":{"get":{"operationId":"getEnvironment","tags":["Environments"],"summary":"Get an environment","description":"Includes the publishing policy (protection, approvals, scenario checks) and the published revision.\n\nScope: any valid token.","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Environment"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/flags":{"get":{"operationId":"listFlags","tags":["Flags"],"summary":"List flags","description":"Scope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"archived","in":"query","required":false,"description":"`false` (default), `true` or `all`.","schema":{"type":"string","enum":["false","true","all"]}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createFlag","tags":["Flags"],"summary":"Create a flag","description":"Every environment's draft starts with `initialValue`; nothing is published. Editor role.\n\nScope: `flags:write`.","x-nanoflags-scope":"flags:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagCreate"}}}},"responses":{"201":{"description":"Created.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flag"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/flags/{flag}":{"get":{"operationId":"getFlag","tags":["Flags"],"summary":"Get a flag","description":"Scope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"flag","in":"path","required":true,"description":"Flag key.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flag"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateFlag","tags":["Flags"],"summary":"Update flag details","description":"Key and type are immutable. Editor role.\n\nScope: `flags:write`.","x-nanoflags-scope":"flags:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"flag","in":"path","required":true,"description":"Flag key.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagUpdate"}}}},"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flag"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/flags/{flag}/archive":{"post":{"operationId":"archiveFlag","tags":["Flags"],"summary":"Archive a flag","description":"Removes the flag from every draft; it leaves published revisions on the next publish. Editor role.\n\nScope: `flags:write`.","x-nanoflags-scope":"flags:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"flag","in":"path","required":true,"description":"Flag key.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flag"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/flags/{flag}/unarchive":{"post":{"operationId":"unarchiveFlag","tags":["Flags"],"summary":"Restore an archived flag","description":"Scope: `flags:write`.","x-nanoflags-scope":"flags:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"flag","in":"path","required":true,"description":"Flag key.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flag"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/flags/{flag}/environments/{environment}":{"get":{"operationId":"getFlagConfig","tags":["Flag configurations"],"summary":"Get a flag's configuration in an environment","description":"The draft and, separately, what is published.\n\nScope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"flag","in":"path","required":true,"description":"Flag key.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagConfig"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateFlagConfig","tags":["Flag configurations"],"summary":"Edit a flag's draft in an environment","description":"Changes the draft only. Publishing is a separate step with the environment's policy. Editor role; the edit is recorded for independent approval (you cannot approve a change whose draft you edited).\n\nScope: `flags:write`.","x-nanoflags-scope":"flags:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"flag","in":"path","required":true,"description":"Flag key.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigUpdate"}}}},"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagConfig"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/segments":{"get":{"operationId":"listSegments","tags":["Segments"],"summary":"List segments","description":"Scope: `segments:read`.","x-nanoflags-scope":"segments:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createSegment","tags":["Segments"],"summary":"Create a segment","description":"Segments are project-wide: part of every environment's draft. Editor role.\n\nScope: `segments:write`.","x-nanoflags-scope":"segments:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentCreate"}}}},"responses":{"201":{"description":"Created.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/segments/{segment}":{"get":{"operationId":"getSegment","tags":["Segments"],"summary":"Get a segment","description":"Scope: `segments:read`.","x-nanoflags-scope":"segments:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"segment","in":"path","required":true,"description":"Segment key.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateSegment","tags":["Segments"],"summary":"Update a segment","description":"Scope: `segments:write`.","x-nanoflags-scope":"segments:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"segment","in":"path","required":true,"description":"Segment key.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentUpdate"}}}},"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Segment"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteSegment","tags":["Segments"],"summary":"Delete a segment","description":"Rules that still reference the segment stop matching it (an unknown segment matches nobody), as in the dashboard. Check `GET …/draft` before publishing.\n\nScope: `segments:write`.","x-nanoflags-scope":"segments:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"segment","in":"path","required":true,"description":"Segment key.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/changes":{"get":{"operationId":"listChanges","tags":["Changes"],"summary":"List changes","description":"Newest first.\n\nScope: `changes:read`.","x-nanoflags-scope":"changes:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"query","required":false,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"Filter by status.","schema":{"type":"string","enum":["draft","testing","awaiting_approval","approved","published","closed"]}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createChange","tags":["Changes"],"summary":"Create a change","description":"The token's creator becomes the author. `baseRevision` is the environment's current revision. Editor role.\n\nScope: `changes:write`.","x-nanoflags-scope":"changes:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeCreate"}}}},"responses":{"201":{"description":"Created.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Change"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/changes/{change}":{"get":{"operationId":"getChange","tags":["Changes"],"summary":"Get a change with its flags and approvals","description":"Scope: `changes:read`.","x-nanoflags-scope":"changes:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"change","in":"path","required":true,"description":"Change id.","schema":{"type":"string","format":"uuid"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Change"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateChange","tags":["Changes"],"summary":"Edit a change or move it to draft/testing/closed","description":"Finished changes (published, closed) refuse every edit with 422 INVALID_STATE.\n\nScope: `changes:write`.","x-nanoflags-scope":"changes:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"change","in":"path","required":true,"description":"Change id.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeUpdate"}}}},"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Change"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/changes/{change}/flags":{"post":{"operationId":"addChangeFlag","tags":["Changes"],"summary":"Add a flag to a change","description":"Scope: `changes:write`.","x-nanoflags-scope":"changes:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"change","in":"path","required":true,"description":"Change id.","schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeFlag"}}}},"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Change"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/changes/{change}/flags/{flag}":{"delete":{"operationId":"removeChangeFlag","tags":["Changes"],"summary":"Remove a flag from a change","description":"Scope: `changes:write`.","x-nanoflags-scope":"changes:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"change","in":"path","required":true,"description":"Change id.","schema":{"type":"string","format":"uuid"}},{"name":"flag","in":"path","required":true,"description":"Flag key.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Change"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/changes/{change}/submit":{"post":{"operationId":"submitChange","tags":["Changes"],"summary":"Request approval","description":"Moves the change to `awaiting_approval`.\n\nScope: `changes:write`.","x-nanoflags-scope":"changes:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"change","in":"path","required":true,"description":"Change id.","schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Change"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/changes/{change}/approvals":{"post":{"operationId":"decideChange","tags":["Changes"],"summary":"Approve or reject a change","description":"Admin or owner. Independence rules apply to the token's creator: the author, and anyone who edited the environment's draft (or project-wide content) since the change's base revision, get 403 SELF_APPROVAL. An approval is bound to the current draft checksum and goes stale when the draft changes.\n\nScope: `changes:approve`.","x-nanoflags-scope":"changes:approve","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"change","in":"path","required":true,"description":"Change id.","schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Decision"}}}},"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Change"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/publish-requirements":{"get":{"operationId":"getPublishRequirements","tags":["Publishing"],"summary":"What publishing the current draft needs","description":"Scope: `publish`.","x-nanoflags-scope":"publish","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"change","in":"query","required":false,"description":"Change id to evaluate approvals for.","schema":{"type":"string","format":"uuid"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishRequirements"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/publish":{"post":{"operationId":"publish","tags":["Publishing"],"summary":"Publish the environment's draft","description":"Publishes the draft as revision N+1 exactly like the dashboard: refused with 409 DESTINATION_CHANGED (another publish happened), 409 NO_CHANGES, 422 CHANGE_REQUIRED / APPROVAL_REQUIRED / SCENARIOS_REQUIRED when the environment's policy is not met, 422 INVALID_VALUE for an invalid draft. Editor role. Distribution to SDKs starts immediately.\n\nScope: `publish`.","x-nanoflags-scope":"publish","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Publish"}}}},"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishResult"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/schedules":{"get":{"operationId":"listSchedules","tags":["Scheduled publishing"],"summary":"List scheduled publishes","description":"Upcoming and past schedules of the environment, latest time first.\n\nScope: `publish`.","x-nanoflags-scope":"publish","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"Filter by status.","schema":{"type":"string","enum":["scheduled","published","failed","canceled"]}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createSchedule","tags":["Scheduled publishing"],"summary":"Schedule a publish of the current draft","description":"Pins the current draft (its checksum) and the destination revision, and publishes exactly that at `runAt`, as the token's creator, through the same path as `POST …/publish`: role, approvals (valid on the pinned draft at that time), scenario checks, protected-environment policy and audit all apply when it runs. If the draft or the destination changed, or approvals are not valid then, nothing is published and the schedule fails (`errorCode`), with a `schedule.failed` webhook and e-mail; success sends `schedule.executed`. One pending schedule per environment (409 CONFLICT). Team plan and above (402 PLAN_REQUIRED). Editor role.\n\nScope: `publish`.","x-nanoflags-scope":"publish","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleCreate"}}}},"responses":{"201":{"description":"Created.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Schedule"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/schedules/{schedule}":{"delete":{"operationId":"cancelSchedule","tags":["Scheduled publishing"],"summary":"Cancel a scheduled publish","description":"Only pending schedules can be canceled (422 INVALID_STATE otherwise). Any editor of the project may cancel. Canceling is allowed on every plan.\n\nScope: `publish`.","x-nanoflags-scope":"publish","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"schedule","in":"path","required":true,"description":"Schedule id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Schedule"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/draft":{"get":{"operationId":"getDraft","tags":["Revisions"],"summary":"The environment's draft as a bundle","description":"Scope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Draft"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/revisions":{"get":{"operationId":"listRevisions","tags":["Revisions"],"summary":"List published revisions","description":"Newest first, without bundles.\n\nScope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevisionList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/revisions/{number}":{"get":{"operationId":"getRevision","tags":["Revisions"],"summary":"Get a revision with its bundle","description":"Scope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"number","in":"path","required":true,"description":"Revision number.","schema":{"type":"integer","minimum":1}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevisionDetail"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/revisions/{number}/diff":{"get":{"operationId":"diffRevision","tags":["Revisions"],"summary":"Field-level diff from a revision to the draft or another revision","description":"Scope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"number","in":"path","required":true,"description":"Revision number.","schema":{"type":"integer","minimum":1}},{"name":"to","in":"query","required":false,"description":"`draft` (default), `published`, or a revision number.","schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevisionDiff"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/environments/{environment}/revisions/{number}/restore":{"post":{"operationId":"restoreRevision","tags":["Revisions"],"summary":"Load a revision into the draft","description":"Then publish normally (a new revision). Shared segments are restored too. Editor role.\n\nScope: `flags:write`.","x-nanoflags-scope":"flags:write","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"path","required":true,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"number","in":"path","required":true,"description":"Revision number.","schema":{"type":"integer","minimum":1}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Up to 255 visible ASCII characters. A retry with the same key and request within 24 h returns the first answer (`Idempotency-Replayed: true`); the same key with a different request → 422 IDEMPOTENCY_MISMATCH. Failed requests are not stored.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"Idempotency-Replayed":{"description":"`true` when this is a stored answer to an earlier request with the same Idempotency-Key.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreResult"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The organization's plan does not include this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused by a rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/scenarios":{"get":{"operationId":"listScenarios","tags":["Scenarios"],"summary":"List saved scenarios","description":"Scope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"flag","in":"query","required":false,"description":"Flag key.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScenarioList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/scenario-runs":{"get":{"operationId":"listScenarioRuns","tags":["Scenarios"],"summary":"List scenario run results","description":"Newest first. A run counts for publishing only while its `configChecksum` equals the draft checksum.\n\nScope: `flags:read`.","x-nanoflags-scope":"flags:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"query","required":false,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"scenario","in":"query","required":false,"description":"Scenario id.","schema":{"type":"string","format":"uuid"}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScenarioRunList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/audit-log":{"get":{"operationId":"listAuditLog","tags":["Audit log"],"summary":"List audit log entries","description":"Newest first. Organization-wide for org tokens, the token's project for project tokens.\n\nScope: `audit:read`.","x-nanoflags-scope":"audit:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"query","required":false,"description":"Project key or id.","schema":{"type":"string"}},{"name":"action","in":"query","required":false,"description":"Exact action, e.g. `revision.published`.","schema":{"type":"string"}},{"name":"since","in":"query","required":false,"description":"Only entries at or after this time.","schema":{"type":"string","format":"date-time"}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size, 1–100 (default 50).","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditEntryList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/keys":{"get":{"operationId":"listSdkKeys","tags":["SDK keys"],"summary":"List SDK key metadata","description":"Admin role. Never returns key material or hashes.\n\nScope: `keys:read`.","x-nanoflags-scope":"keys:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"query","required":false,"description":"Environment key or id.","schema":{"type":"string"}},{"name":"revoked","in":"query","required":false,"description":"`true` to include revoked keys.","schema":{"type":"string","enum":["true","false"]}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SdkKeyList"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/flags/{flag}/insights":{"get":{"operationId":"getFlagInsights","tags":["Usage insights"],"summary":"Usage of one flag in an environment","description":"Sampled evaluation events over a window (series, totals), the served values and deciding rules, the services and SDKs that evaluate the flag, and the revisions published in the window. Counts are **sampled events**, not evaluations; `weighted` estimates evaluations only where the SDK reported its sample rate. Windows longer than the plan's usage history are capped.\n\nScope: `insights:read`.","x-nanoflags-scope":"insights:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"flag","in":"path","required":true,"description":"Flag key.","schema":{"type":"string"}},{"name":"environment","in":"query","required":false,"description":"Environment key or id (default: the project's default environment).","schema":{"type":"string"}},{"name":"window","in":"query","required":false,"description":"`1h`, `24h` (default), `7d` or `30d`.","schema":{"type":"string","enum":["1h","24h","7d","30d"]}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagInsights"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{project}/insights":{"get":{"operationId":"getProjectInsights","tags":["Usage insights"],"summary":"Usage overview of a project in an environment","description":"Every live flag with its sampled events in the last `days` and when it was last seen (flags with no sampled evaluation are cleanup candidates), active services and SDK versions, and revisions per week across environments.\n\nScope: `insights:read`.","x-nanoflags-scope":"insights:read","security":[{"bearerAuth":[]}],"parameters":[{"name":"project","in":"path","required":true,"description":"Project key or id.","schema":{"type":"string"}},{"name":"environment","in":"query","required":false,"description":"Environment key or id (default: the project's default environment).","schema":{"type":"string"}},{"name":"days","in":"query","required":false,"description":"1–400 (default 7), capped by the plan's usage history.","schema":{"type":"integer","minimum":1,"maximum":400}},{"name":"If-None-Match","in":"header","required":false,"description":"ETag of a previous answer; 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK.","headers":{"RateLimit-Policy":{"description":"`\"token\";q=600;w=60`: requests per window per token and Cloudflare location.","schema":{"type":"string"}},"X-Request-Id":{"description":"Unique id of this request; quote it when contacting support.","schema":{"type":"string"}},"ETag":{"description":"Strong validator of the body.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectInsights"}}}},"304":{"description":"Not modified (`If-None-Match` matched)."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown, revoked or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Role, scope or independence rules do not allow this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"description":"Seconds to wait.","schema":{"type":"integer"}}}},"503":{"description":"NanoFlags unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"operationId":"getOpenApi","tags":["Meta"],"summary":"This document","description":"The OpenAPI 3.1 description of this API. No authentication.","security":[],"responses":{"200":{"description":"OK.","content":{"application/json":{"schema":{"type":"object"}}}},"405":{"description":"Use GET.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"nf_api_<48 hex>","description":"API token. Scopes: `flags:read` (Read flags, flag configurations, drafts, revisions and scenarios.); `flags:write` (Create, edit and archive flags, edit drafts, restore revisions to a draft (implies flags:read).); `segments:read` (Read segments.); `segments:write` (Create, edit and delete segments (implies segments:read).); `changes:read` (Read changes and their approvals.); `changes:write` (Create and edit changes, add or remove flags, submit for approval (implies changes:read).); `changes:approve` (Approve or reject changes (independence rules apply to the token's creator).); `publish` (Read publish requirements, publish an environment's draft, and schedule or cancel scheduled publishes.); `audit:read` (Read the audit log.); `keys:read` (List SDK key metadata (never key material).); `insights:read` (Read usage insights: sampled evaluation counts, variation and rule distribution, services and SDK versions, revisions per week.)"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable code, e.g. FORBIDDEN, PLAN_REQUIRED, APPROVAL_REQUIRED."},"message":{"type":"string","description":"Human readable explanation."}},"required":["code","message"]}},"required":["error"]},"Token":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"prefix":{"type":"string","description":"First 14 characters of the token, safe to display."},"orgId":{"type":"string","format":"uuid"},"projectId":{"type":["string","null"],"format":"uuid"},"projectKey":{"type":["string","null"]},"scopes":{"type":"array","items":{"type":"string","enum":["flags:read","flags:write","segments:read","segments:write","changes:read","changes:write","changes:approve","publish","audit:read","keys:read","insights:read"]}},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","format":"uuid"},"createdByName":{"type":["string","null"]},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"status":{"type":"string","enum":["active","expired","revoked"]}},"required":["id","name","prefix","orgId","projectId","projectKey","scopes","expiresAt","createdAt","createdBy","createdByName","lastUsedAt","revokedAt","status"]},"Project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"timezone":{"type":"string"},"defaultEnvironment":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","key","name","timezone","defaultEnvironment","createdAt"]},"Environment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"sort":{"type":"integer"},"isProtected":{"type":"boolean"},"requireApproval":{"type":"boolean"},"requiredApprovers":{"type":"integer"},"requireScenarios":{"type":"boolean"},"publishedRevision":{"type":"integer","description":"0 when nothing was published."},"publishedChecksum":{"type":["string","null"]},"publishedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","key","name","sort","isProtected","requireApproval","requiredApprovers","requireScenarios","publishedRevision","publishedChecksum","publishedAt","createdAt"]},"Flag":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["boolean","string","number","json"]},"purpose":{"type":"string","enum":["release","experiment","operational","permission"]},"permanent":{"type":"boolean"},"clientExposed":{"type":"boolean"},"initialValue":{"description":"Any JSON value."},"jsonSchema":{"type":["object","null"]},"ownerId":{"type":["string","null"],"format":"uuid"},"reviewDate":{"type":["string","null"],"format":"date"},"archivedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","key","name","description","type","purpose","permanent","clientExposed","initialValue","jsonSchema","ownerId","reviewDate","archivedAt","createdAt"]},"Rule":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"attribute":{"type":"string"},"op":{"type":"string","description":"eq, neq, in, not_in, contains, starts_with, ends_with, gt, gte, lt, lte, semver_gt, semver_lt, segment, not_segment, …"},"value":{"description":"Any JSON value."}},"required":["attribute","op"]}},"serve":{"type":"object","description":"`{ type: 'fixed', value }` or `{ type: 'rollout', percentage, value, otherwise, bucketBy? }`.","properties":{"type":{"type":"string","enum":["fixed","rollout"]}},"required":["type"]}},"required":["id","conditions","serve"]},"FlagConfig":{"type":"object","properties":{"flag":{"type":"string"},"environment":{"type":"string"},"environmentId":{"type":"string","format":"uuid"},"draft":{"type":"object","properties":{"enabled":{"type":"boolean"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/Rule"}},"default":{"description":"Any JSON value."},"off":{"description":"Any JSON value."},"updatedAt":{"type":"string","format":"date-time"},"updatedBy":{"type":["string","null"],"format":"uuid"}},"required":["enabled","rules","default","off","updatedAt","updatedBy"]},"publishedRevision":{"type":"integer"},"published":{"type":["object","null"],"description":"The flag as published in `publishedRevision` (`{ type, enabled, rules, default, off, clientExposed }`); null if not in it."}},"required":["flag","environment","environmentId","draft","publishedRevision","published"]},"Segment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"attribute":{"type":"string"},"op":{"type":"string","description":"eq, neq, in, not_in, contains, starts_with, ends_with, gt, gte, lt, lte, semver_gt, semver_lt, segment, not_segment, …"},"value":{"description":"Any JSON value."}},"required":["attribute","op"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","key","name","description","match","conditions","createdAt","updatedAt"]},"Deleted":{"type":"object","properties":{"deleted":{"type":"boolean","const":true},"key":{"type":"string"}},"required":["deleted","key"]},"Approval":{"type":"object","properties":{"approverId":{"type":"string","format":"uuid"},"decision":{"type":"string","enum":["approved","rejected"]},"comment":{"type":"string"},"draftChecksum":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["approverId","decision","comment","draftChecksum","createdAt"]},"Change":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"environment":{"type":"string"},"environmentId":{"type":"string","format":"uuid"},"title":{"type":"string"},"reason":{"type":"string"},"codeRef":{"type":"string"},"status":{"type":"string","enum":["draft","testing","awaiting_approval","approved","published","closed"]},"authorId":{"type":["string","null"],"format":"uuid"},"baseRevision":{"type":"integer"},"publishedRevision":{"type":["integer","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"flags":{"type":"array","items":{"type":"string"}},"approvals":{"type":"array","items":{"$ref":"#/components/schemas/Approval"}},"approvedChecksum":{"type":"string","description":"Only on the approval answer: the draft checksum the decision is bound to."}},"required":["id","environment","environmentId","title","reason","codeRef","status","authorId","baseRevision","publishedRevision","createdAt","updatedAt","flags","approvals"]},"PublishRequirements":{"type":"object","properties":{"environment":{"type":"string"},"changeId":{"type":["string","null"],"format":"uuid"},"checksum":{"type":"string","description":"Checksum of the current draft."},"hasChanges":{"type":"boolean"},"publishedRevision":{"type":"integer"},"changeRequired":{"type":"boolean"},"approval":{"type":"object","properties":{"required":{"type":"boolean"},"needed":{"type":"integer"},"valid":{"type":"integer"},"stale":{"type":"integer"},"met":{"type":"boolean"}},"required":["required","needed","valid","stale","met"]},"scenarios":{"type":"object","properties":{"required":{"type":"boolean"},"total":{"type":"integer"},"passed":{"type":"integer"},"failed":{"type":"integer"},"notRun":{"type":"integer"},"selfOnly":{"type":"integer","description":"Scenarios whose only passing runs are by the change author or a draft editor (they do not count)."},"met":{"type":"boolean"}},"required":["required","total","passed","failed","notRun","selfOnly","met"]},"canPublish":{"type":"boolean","description":"All of: has changes, no change required (or one given), approvals met, scenarios met."}},"required":["environment","changeId","checksum","hasChanges","publishedRevision","changeRequired","approval","scenarios","canPublish"]},"Schedule":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"environment":{"type":"string"},"environmentId":{"type":"string","format":"uuid"},"changeId":{"type":["string","null"],"format":"uuid"},"runAt":{"type":"string","format":"date-time","description":"When the publish runs (UTC). It runs within about 10 seconds after this time."},"timezone":{"type":"string","description":"IANA time zone the schedule was entered in (display only)."},"expectedRevision":{"type":"integer","description":"The destination revision pinned at scheduling time."},"checksum":{"type":"string","description":"The draft checksum pinned at scheduling time. Only exactly this draft is ever published."},"note":{"type":"string"},"status":{"type":"string","enum":["scheduled","published","failed","canceled"]},"createdBy":{"type":"string","format":"uuid"},"createdByName":{"type":["string","null"]},"via":{"type":"string","enum":["dashboard","api_token"]},"createdAt":{"type":"string","format":"date-time"},"canceledBy":{"type":["string","null"],"format":"uuid"},"canceledAt":{"type":["string","null"],"format":"date-time"},"executedAt":{"type":["string","null"],"format":"date-time"},"publishedRevision":{"type":["integer","null"]},"errorCode":{"type":["string","null"],"description":"Why it failed, e.g. DRAFT_CHANGED, DESTINATION_CHANGED, APPROVAL_REQUIRED, SCENARIOS_REQUIRED, FORBIDDEN."},"errorMessage":{"type":["string","null"]},"readiness":{"type":"object","properties":{"approvalMet":{"type":"boolean"},"scenariosMet":{"type":"boolean"}},"required":["approvalMet","scenariosMet"],"description":"Only on the create answer: whether approvals and scenario checks are already met for the pinned draft. They are checked again when the publish runs."}},"required":["id","environment","environmentId","changeId","runAt","timezone","expectedRevision","checksum","note","status","createdBy","createdByName","via","createdAt","canceledBy","canceledAt","executedAt","publishedRevision","errorCode","errorMessage"]},"PublishResult":{"type":"object","properties":{"environment":{"type":"string"},"environmentId":{"type":"string","format":"uuid"},"revision":{"type":"integer"},"checksum":{"type":"string"},"committedAt":{"type":"integer","description":"Commit time, epoch milliseconds."}},"required":["environment","environmentId","revision","checksum","committedAt"]},"Revision":{"type":"object","properties":{"number":{"type":"integer"},"checksum":{"type":"string"},"changeId":{"type":["string","null"],"format":"uuid"},"restoredFrom":{"type":["integer","null"]},"note":{"type":"string"},"publishedBy":{"type":["string","null"],"format":"uuid"},"publishedAt":{"type":"string","format":"date-time"},"distributedAt":{"type":["string","null"],"format":"date-time"}},"required":["number","checksum","changeId","restoredFrom","note","publishedBy","publishedAt","distributedAt"]},"RevisionDetail":{"allOf":[{"$ref":"#/components/schemas/Revision"},{"type":"object","properties":{"bundle":{"type":"object","description":"The immutable engine bundle: `{ schema, project, environment, revision, flags, segments }`."}},"required":["bundle"]}]},"DiffRow":{"type":"object","properties":{"flagKey":{"type":"string","description":"Flag key, or `segment:<key>`."},"field":{"type":"string"},"before":{"type":"string"},"after":{"type":"string"}},"required":["flagKey","field","before","after"]},"RevisionDiff":{"type":"object","properties":{"environment":{"type":"string"},"from":{"type":"integer"},"to":{"type":["integer","string"],"description":"Revision number or `draft`."},"changes":{"type":"array","items":{"$ref":"#/components/schemas/DiffRow"}}},"required":["environment","from","to","changes"]},"RestoreResult":{"type":"object","properties":{"environment":{"type":"string"},"restoredFrom":{"type":"integer"},"flags":{"type":"integer"},"segments":{"type":"integer"},"segmentsCreated":{"type":"integer"},"segmentKeys":{"type":"array","items":{"type":"string"}},"notInRevision":{"type":"array","items":{"type":"string"}}},"required":["environment","restoredFrom","flags","segments","segmentsCreated","segmentKeys","notInRevision"]},"Draft":{"type":"object","properties":{"environment":{"type":"string"},"checksum":{"type":"string"},"publishedRevision":{"type":"integer"},"publishedChecksum":{"type":["string","null"]},"dirty":{"type":"boolean"},"bundle":{"type":"object"}},"required":["environment","checksum","publishedRevision","publishedChecksum","dirty","bundle"]},"Scenario":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"flag":{"type":"string"},"context":{"type":"object"},"expected":{"description":"Any JSON value."},"includeInCi":{"type":"boolean"},"version":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","name","flag","context","expected","includeInCi","version","createdAt","updatedAt"]},"ScenarioRun":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"scenarioId":{"type":"string","format":"uuid"},"environment":{"type":"string"},"source":{"type":"string","enum":["draft","revision"]},"revision":{"type":["integer","null"]},"configChecksum":{"type":"string"},"actual":{"description":"Any JSON value."},"passed":{"type":"boolean"},"via":{"type":"string"},"runBy":{"type":["string","null"],"format":"uuid"},"commitSha":{"type":["string","null"]},"ciRunUrl":{"type":["string","null"]},"scenarioVersion":{"type":["integer","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","scenarioId","environment","source","revision","configChecksum","actual","passed","via","runBy","commitSha","ciRunUrl","scenarioVersion","createdAt"]},"AuditEntry":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"actorId":{"type":["string","null"],"format":"uuid"},"action":{"type":"string"},"objectType":{"type":"string"},"objectId":{"type":["string","null"]},"objectLabel":{"type":"string"},"summary":{"type":"string"},"projectId":{"type":["string","null"],"format":"uuid"},"environmentId":{"type":["string","null"],"format":"uuid"},"detail":{"type":"object","description":"Entries written through an API token carry `via: \"api_token\"` and `api_token_id`."}},"required":["id","createdAt","actorId","action","objectType","objectId","objectLabel","summary","projectId","environmentId","detail"]},"SdkKey":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"kind":{"type":"string","enum":["client","server","ci","admin"]},"prefix":{"type":"string"},"environment":{"type":"string"},"environmentId":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"],"format":"uuid"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","name","kind","prefix","environment","environmentId","createdAt","createdBy","lastUsedAt","revokedAt"]},"ProjectList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"EnvironmentList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Environment"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"FlagList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Flag"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"SegmentList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Segment"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"ChangeList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Change"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"RevisionList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Revision"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"ScenarioList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Scenario"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"ScenarioRunList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ScenarioRun"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"AuditEntryList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AuditEntry"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"SdkKeyList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SdkKey"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"ScheduleList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Schedule"}},"nextCursor":{"type":["string","null"],"description":"Pass as `cursor` to get the next page; null on the last page."}},"required":["data","nextCursor"]},"FlagCreate":{"type":"object","properties":{"key":{"type":"string","description":"Immutable. ^[a-z0-9][a-z0-9_-]{0,62}$"},"type":{"type":"string","enum":["boolean","string","number","json"]},"initialValue":{"description":"Every environment's draft starts with this value (default false for boolean flags)."},"name":{"type":"string","description":"1–120 characters; defaults to the key."},"description":{"type":"string","description":"At most 2000 characters."},"purpose":{"type":"string","enum":["release","experiment","operational","permission"]},"permanent":{"type":"boolean"},"clientExposed":{"type":"boolean","description":"Served to browser (nf_pub_) keys."},"jsonSchema":{"type":["object","null"],"description":"JSON Schema the values of a json flag must satisfy."},"reviewDate":{"type":["string","null"],"format":"date"},"ownerId":{"type":["string","null"],"format":"uuid"}},"required":["key"],"additionalProperties":false},"FlagUpdate":{"type":"object","properties":{"name":{"type":"string","description":"1–120 characters; defaults to the key."},"description":{"type":"string","description":"At most 2000 characters."},"purpose":{"type":"string","enum":["release","experiment","operational","permission"]},"permanent":{"type":"boolean"},"clientExposed":{"type":"boolean","description":"Served to browser (nf_pub_) keys."},"jsonSchema":{"type":["object","null"],"description":"JSON Schema the values of a json flag must satisfy."},"reviewDate":{"type":["string","null"],"format":"date"},"ownerId":{"type":["string","null"],"format":"uuid"}},"required":[],"additionalProperties":false,"minProperties":1},"ConfigUpdate":{"type":"object","properties":{"enabled":{"type":"boolean"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/Rule"}},"default":{"description":"Value served when no rule matches."},"off":{"description":"Value served while the flag is disabled."}},"required":[],"additionalProperties":false,"minProperties":1,"description":"Fields you leave out keep their draft value. Values are validated against the flag's type and JSON Schema."},"SegmentCreate":{"type":"object","properties":{"key":{"type":"string","description":"^[a-z0-9][a-z0-9_-]{0,62}$"},"name":{"type":"string"},"description":{"type":"string"},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"attribute":{"type":"string"},"op":{"type":"string","description":"eq, neq, in, not_in, contains, starts_with, ends_with, gt, gte, lt, lte, semver_gt, semver_lt, segment, not_segment, …"},"value":{"description":"Any JSON value."}},"required":["attribute","op"]}}},"required":["key"],"additionalProperties":false},"SegmentUpdate":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"attribute":{"type":"string"},"op":{"type":"string","description":"eq, neq, in, not_in, contains, starts_with, ends_with, gt, gte, lt, lte, semver_gt, semver_lt, segment, not_segment, …"},"value":{"description":"Any JSON value."}},"required":["attribute","op"]}}},"required":[],"additionalProperties":false,"minProperties":1},"ChangeCreate":{"type":"object","properties":{"environment":{"type":"string","description":"Environment key or id."},"title":{"type":"string","description":"1–140 characters."},"reason":{"type":"string","description":"At most 2000 characters."},"codeRef":{"type":"string","description":"At most 200 characters, e.g. a PR URL."},"flags":{"type":"array","items":{"type":"string"},"description":"Flag keys in scope (≤ 200)."}},"required":["environment","title"],"additionalProperties":false},"ChangeUpdate":{"type":"object","properties":{"title":{"type":"string"},"reason":{"type":"string"},"codeRef":{"type":"string"},"status":{"type":"string","enum":["draft","testing","closed"],"description":"Manual moves only; approval and publishing set the other states."}},"required":[],"additionalProperties":false,"minProperties":1},"ChangeFlag":{"type":"object","properties":{"flag":{"type":"string","description":"Flag key."}},"required":["flag"],"additionalProperties":false},"Decision":{"type":"object","properties":{"decision":{"type":"string","enum":["approved","rejected"]},"comment":{"type":"string"}},"required":["decision"],"additionalProperties":false},"Publish":{"type":"object","properties":{"expectedRevision":{"type":"integer","description":"The environment's current published revision. A different value → 409 DESTINATION_CHANGED."},"change":{"type":"string","format":"uuid","description":"The reviewed change to publish (required where approvals are)."},"note":{"type":"string","description":"At most 500 characters."}},"required":["expectedRevision"],"additionalProperties":false},"ScheduleCreate":{"type":"object","properties":{"runAt":{"type":"string","format":"date-time","description":"When to publish: 1 minute to 366 days from now, with an offset or `Z` (e.g. `2026-11-27T00:00:00+03:00`)."},"expectedRevision":{"type":"integer","description":"The environment's current published revision. A different value → 409 DESTINATION_CHANGED, now and again when the publish runs."},"checksum":{"type":"string","description":"Optional: the draft checksum you reviewed (`GET …/draft`). A different current draft → 409 DRAFT_CHANGED. Whether given or not, the schedule pins the current draft's checksum."},"change":{"type":"string","format":"uuid","description":"The reviewed change to publish (required where approvals are)."},"note":{"type":"string","description":"At most 500 characters; becomes the revision note."},"timezone":{"type":"string","description":"IANA time zone, for display (default UTC)."}},"required":["runAt","expectedRevision"],"additionalProperties":false},"FlagInsights":{"type":"object","properties":{"environment":{"type":"string"},"environmentId":{"type":"string","format":"uuid"},"flag":{"type":"string"},"window":{"type":"string","enum":["1h","24h","7d","30d"]},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"bucketSeconds":{"type":"integer","description":"Width of a series bucket: 300 for 1h, 3600 for 24h, 21600 for 7d, 86400 for 30d."},"retentionDays":{"type":"integer","description":"Days of usage history the organization's plan keeps; longer windows are capped (`capped: true`)."},"capped":{"type":"boolean"},"totals":{"allOf":[{"type":"object","properties":{"events":{"type":"integer","description":"Sampled events stored (not evaluations): SDKs send a random sample of evaluations, and stored events are capped per environment and day."},"rated":{"type":"integer","description":"How many of `events` carried the SDK's sample rate."},"weighted":{"type":"number","description":"Sum of 1 / sample rate over the `rated` events: an estimate of evaluations, only for events whose rate is known."}},"required":["events","rated","weighted"]},{"type":"object","properties":{"rateMin":{"type":["number","null"]},"rateMax":{"type":["number","null"]},"lastAt":{"type":["string","null"],"format":"date-time"}},"required":["rateMin","rateMax","lastAt"]}]},"series":{"type":"array","items":{"allOf":[{"type":"object","properties":{"t":{"type":"string","format":"date-time"}},"required":["t"]},{"type":"object","properties":{"events":{"type":"integer","description":"Sampled events stored (not evaluations): SDKs send a random sample of evaluations, and stored events are capped per environment and day."},"rated":{"type":"integer","description":"How many of `events` carried the SDK's sample rate."},"weighted":{"type":"number","description":"Sum of 1 / sample rate over the `rated` events: an estimate of evaluations, only for events whose rate is known."}},"required":["events","rated","weighted"]}]}},"variations":{"type":"array","items":{"type":"object","properties":{"value":{"description":"Any JSON value."},"events":{"type":"integer"}},"required":["value","events"]},"description":"Top 20 served values by sampled events."},"rules":{"type":"array","items":{"type":"object","properties":{"reason":{"type":"string","description":"Engine reason, e.g. rule_match, rollout, default, disabled."},"ruleIndex":{"type":["integer","null"],"description":"0-based rule position; null when no rule decided."},"events":{"type":"integer"}},"required":["reason","ruleIndex","events"]}},"services":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string"},"sdk":{"type":"string"},"events":{"type":"integer"},"lastAt":{"type":"string","format":"date-time"},"reportedAt":{"type":["string","null"],"format":"date-time"},"reportedRevision":{"type":["integer","null"]}},"required":["service","sdk","events","lastAt","reportedAt","reportedRevision"]}},"publishes":{"type":"array","items":{"type":"object","properties":{"revision":{"type":"integer"},"at":{"type":"string","format":"date-time"},"note":{"type":"string"}},"required":["revision","at","note"]},"description":"Revisions published in the window (chart markers)."},"seen":{"type":"object","properties":{"firstSeenAt":{"type":["string","null"],"format":"date-time"},"lastSeenAt":{"type":["string","null"],"format":"date-time"}},"required":["firstSeenAt","lastSeenAt"],"description":"First and last sampled evaluation ever recorded for this flag in this environment (kept beyond retention)."}},"required":["environment","environmentId","flag","window","from","to","bucketSeconds","retentionDays","capped","totals","series","variations","rules","services","publishes","seen"]},"ProjectInsights":{"type":"object","properties":{"environment":{"type":"string"},"environmentId":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"days":{"type":"integer","description":"Days covered (requested days capped by retention)."},"requestedDays":{"type":"integer"},"retentionDays":{"type":"integer"},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"totals":{"allOf":[{"type":"object","properties":{"events":{"type":"integer","description":"Sampled events stored (not evaluations): SDKs send a random sample of evaluations, and stored events are capped per environment and day."},"rated":{"type":"integer","description":"How many of `events` carried the SDK's sample rate."},"weighted":{"type":"number","description":"Sum of 1 / sample rate over the `rated` events: an estimate of evaluations, only for events whose rate is known."}},"required":["events","rated","weighted"]},{"type":"object","properties":{"rateMin":{"type":["number","null"]},"rateMax":{"type":["number","null"]}},"required":["rateMin","rateMax"]}]},"flags":{"type":"array","description":"Every live flag, most sampled first.","items":{"allOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"purpose":{"type":"string"},"permanent":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":["string","null"],"format":"date-time"},"firstSeenAt":{"type":["string","null"],"format":"date-time"}},"required":["key","name","purpose","permanent","createdAt","lastSeenAt","firstSeenAt"]},{"type":"object","properties":{"events":{"type":"integer","description":"Sampled events stored (not evaluations): SDKs send a random sample of evaluations, and stored events are capped per environment and day."},"rated":{"type":"integer","description":"How many of `events` carried the SDK's sample rate."},"weighted":{"type":"number","description":"Sum of 1 / sample rate over the `rated` events: an estimate of evaluations, only for events whose rate is known."}},"required":["events","rated","weighted"]}]}},"services":{"type":"array","items":{"type":"object","properties":{"service":{"type":"string"},"sdk":{"type":"string"},"revision":{"type":"integer","description":"Revision the service last reported."},"lastSeenAt":{"type":"string","format":"date-time"},"events":{"type":"integer"}},"required":["service","sdk","revision","lastSeenAt","events"]}},"sdks":{"type":"array","items":{"type":"object","properties":{"sdk":{"type":"string","description":"SDK name/version as reported, e.g. js/0.4.0."},"services":{"type":"integer"},"lastSeenAt":{"type":"string","format":"date-time"}},"required":["sdk","services","lastSeenAt"]}},"revisionsPerWeek":{"type":"array","description":"12 ISO weeks, every environment of the project.","items":{"type":"object","properties":{"week":{"type":"string","format":"date-time"},"total":{"type":"integer"},"byEnvironment":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["week","total","byEnvironment"]}}},"required":["environment","environmentId","projectId","days","requestedDays","retentionDays","from","to","totals","flags","services","sdks","revisionsPerWeek"]}}}}