Skip to content
中文

Archive a flag

Code Mode: praxis.devops.flags.archive

HTTP: POST /devops/v1/flags/{id}:archive

Archive a flag whose code is gone: it stops evaluating in every environment, leaves the ordinary flag list and keeps its key and history. Archiving is the delete, and the platform refuses it while the last reported scan still finds the key in code or while the flag is on in an environment: a flag whose codeRefs.count is above zero is refused with FLAG_STILL_REFERENCED, and a flag whose on state is true in any environment is refused with FLAG_HAS_LIVE_RULES, so archiving succeeds only once the code that names the key is deployed away and every environment is off. The gate reads the stored scan as it stands — an out-of-date scannedCommit is not corrected for — and there is no force flag. It is irreversible through the API: there is no unarchive call, an archived flag cannot be updated or configured, and its key stays reserved, so a later create with the same key is refused; archiving an archived flag just answers it again. A flag that may come back is turned off in its environment instead. The order is: open the flag fully (praxis api devops flag environment update), delete the code that names the key and deploy that, run praxis devops flag remove <key> (local, lists the references still naming the key), then praxis api devops flag archive <id>, then praxis devops flag sync so the local registry drops it. There is no separate delete call.

Signature

praxis.devops.flags.archive(args:{path:{/** e.g. "flg_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string}}):Promise<{/** Flag identifier used by every later read and write of this flag; code names the flag by key, while this API addresses it by id. e.g. "flg_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The resource type of this answer, always flag. */ object:"flag";/** RFC 3339 UTC time the flag was created; the flag list is ordered by it, newest first. e.g. "2026-10-27T02:00:00Z" */ createTime:string;/** RFC 3339 UTC time the flag's own fields last changed; a change to one environment's configuration does not move this. e.g. "2026-11-02T08:12:00Z" */ updateTime:string;/** Canonical Console link for the project this flag belongs to. e.g. "https://console.deepraxis.com/devops/projects/dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ viewerUrl:string;/** The project this flag belongs to, from the project list. e.g. "dvp_01m6j8swzteapw2j5sh4" */ project:string;/** The name code calls this flag by, unique inside the project including archived flags; it is what a ruleset and a client library look up. e.g. "sandbox-ephemeral-default" */ key:string;/** Display name of the flag, shown wherever it is listed; it may change freely and nothing depends on it. e.g. "Sandbox defaults to an ephemeral instance" */ name:string;/** What this flag does to the product, absent when none was given; it is where the reason for the flag belongs. e.g. "New sandboxes start ephemeral unless the caller asks for a persistent one." */ description?:string;/** What sort of flag this is, which decides how long it may live and what its removal means. e.g. "release" */ kind:"release"|"experiment"|"ops"|"permission";/** The type every variation of this flag has; a value of another type cannot be served, and clients request the flag in this type. e.g. "boolean" */ valueType:"boolean"|"string"|"number"|"object";/** The values this flag can serve, each with the id that rules and defaults refer to. */ variations:Array<{/** Variation id, which is what a default, a rule and a rollout name; it is a name, not the value itself. e.g. "on" */ id:string;/** The value served when this variation is selected; its type is the flag's valueType. e.g. true */ value:unknown;/** Human-readable name for this variation, absent when only an id was given. e.g. "On" */ name?:string}>;defaults:{/** Variation served to a caller that matches no rule while the flag is on; it must name one of the flag's variations. e.g. "on" */ onVariation:string;/** Variation served while the flag is off, whatever the rules say; this is the value an incident falls back to. e.g. "off" */ offVariation:string};/** Who owns this flag and is expected to conclude it when its observation deadline arrives; null when the flag was created without one. */ owner:null|{/** What sort of actor this is, which decides how the id should be read. e.g. "user" */ kind:"user"|"agent"|"system";/** Identifier of the actor within its kind, such as a user id for a person. e.g. "usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Display name for the actor at the time, so a record reads the way it did when it was written; absent when none was known. e.g. "Sean" */ label?:string};/** RFC 3339 UTC time this flag must be decided by, required for a release or experiment flag; absent for a flag that has no deadline. e.g. "2026-12-15T23:59:59Z" */ observeUntil?:string;/** The ticket that removes the flag and its code once the rollout is complete, absent when none was recorded. e.g. "#279" */ removalTicket?:string;origin:{/** Which path created the flag; exposure means a change declared it and carried it here, manual means someone created it directly. e.g. "manual" */ declaredBy:"exposure"|"manual";/** The pull request that declared this flag, present only when declaredBy is exposure; it is what ties the flag to the change that introduced it. e.g. "pr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ pullRequest?:string};/** Where the flag is in its own life; launched means the behaviour is permanent and only the code and the flag row remain to be removed. e.g. "active" */ lifecycle:"new"|"active"|"launched"|"inactive"|"archived";/** Whether the flag looks abandoned: its deadline has passed or no environment has used it. e.g. false */ stale:boolean;/** What each environment of the project serves for this flag, keyed by environment id; every environment has an entry from the moment the flag is created. e.g. {"dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW":{"on":true,"version":3}} */ environments:{[key:string]:{/** Whether the flag is evaluated at all here; false serves the off variation to everyone and makes the rules and the rollout below irrelevant. e.g. true */ on:boolean;/** Other flags this one depends on: it is evaluated only when each of them serves the variation named here. */ prerequisites:Array<{/** The key of the prerequisite flag, which is how code and the evaluator name it. e.g. "sandbox-ephemeral-default" */ flagKey:string;/** The variation the prerequisite must serve; when it serves anything else this flag is not evaluated and its off variation is served. e.g. "on" */ variation:string}>;/** Callers named individually, grouped by context kind, and the variation each group gets; a named caller is served before any rule is evaluated. */ targets:Array<{/** The context kind these keys belong to, such as user or organization; the same key string can name different things in different kinds. e.g. "user" */ kind:string;/** The variation every caller in this group is served, whatever the rules would have decided. e.g. "on" */ variation:string;/** The targeting keys in this group; a caller whose targetingKey is listed here is served this variation. */ keys:Array<string>}>;/** The targeting rules, evaluated in order; the first rule whose clauses all match decides the variation, and an empty list means every caller falls through. */ rules:Array<{/** Rule identifier, used when a rule is updated or removed by a configuration write. e.g. "rule-1" */ id:string;/** What this rule is for, in the author's words; absent when none was given, which makes a rule hard to judge later. e.g. "Internal users get the new path first." */ description?:string;/** The conditions this rule tests, all of which must match; an empty list matches every caller. */ clauses:Array<{/** The context kind the attribute belongs to, absent when the attribute is read from the caller's own context. e.g. "organization" */ kind?:string;/** Which context attribute is tested; it must be one of the project's declared attributes for that kind, or the configuration is refused. e.g. "region" */ attribute:string;/** How the attribute is compared; the operators that need one value, such as startsWith, use the first entry of values. e.g. "in" */ op:"in"|"notIn"|"startsWith"|"endsWith"|"contains"|"matches"|"lessThan"|"greaterThan"|"semVerLessThan"|"semVerGreaterThan"|"before"|"after"|"inSegment";/** The values this comparison uses; their type must match the attribute's declared type, and a mismatch is refused rather than evaluated as false. e.g. ["apac","eu"] */ values:Array<unknown>;/** Whether the result of the comparison is inverted; true serves the rule's variation when the comparison does not match. e.g. false */ negate?:boolean}>;serve:{/** The variation to serve; it must name one of the flag's variations. e.g. "on" */ variation:string}|{rollout:{/** Which context attribute is bucketed, such as targetingKey; bucketing by a stable attribute is what keeps one caller on one side. e.g. "targetingKey" */ bucketBy:string;/** The number that salts the bucketing; two splits with different seeds place the same caller differently, which is how a split is reset. e.g. 428173911 */ seed:number;/** Variation id to weight, out of 100000; the weights must total exactly 100000 or the write is refused with ROLLOUT_WEIGHTS_INVALID. e.g. {"on":50000,"off":50000} */ weights:{[key:string]:number}}};/** Whether the rule is skipped; true keeps the rule in place without letting it decide anything. e.g. false */ disabled?:boolean}>;fallthrough:{/** The variation to serve; it must name one of the flag's variations. e.g. "on" */ variation:string}|{rollout:{/** Which context attribute is bucketed, such as targetingKey; bucketing by a stable attribute is what keeps one caller on one side. e.g. "targetingKey" */ bucketBy:string;/** The number that salts the bucketing; two splits with different seeds place the same caller differently, which is how a split is reset. e.g. 428173911 */ seed:number;/** Variation id to weight, out of 100000; the weights must total exactly 100000 or the write is refused with ROLLOUT_WEIGHTS_INVALID. e.g. {"on":50000,"off":50000} */ weights:{[key:string]:number}}};/** The progressive rollout currently ramping this environment, absent when the environment serves its fallthrough directly. e.g. "prr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ progressiveRollout?:string;/** The configuration version, incremented by each accepted write; send the version you read so a concurrent edit is refused rather than overwritten. e.g. 3 */ version:number;/** RFC 3339 UTC time this environment's configuration last changed. e.g. "2026-11-02T08:12:00Z" */ updateTime:string;updatedBy:{/** What sort of actor this is, which decides how the id should be read. e.g. "user" */ kind:"user"|"agent"|"system";/** Identifier of the actor within its kind, such as a user id for a person. e.g. "usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Display name for the actor at the time, so a record reads the way it did when it was written; absent when none was known. e.g. "Sean" */ label?:string}}};codeRefs:{/** How many places the scan found the flag key read at the scanned commit; zero means no code reads it. e.g. 4 */ count:number;/** The commit the scan read; an old commit means the count describes the code as it was then, not as it is now. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ scannedCommit:string};/** Labels on the flag for grouping and searching; empty when none were set. */ tags:Array<string>;/** Which evaluator serves this flag at runtime; it decides whether a ruleset or the local flag binding answers an evaluation. e.g. "ruleset" */ evaluator:"flagship"|"ruleset"}>;

Parameters

NameInTypeRequiredDescription
idpathstringyesThe flag identifier from a flag list or create answer; code names a flag by its key, while this API addresses it by id.

Responses

StatusContent typesDescription
200application/jsonThe archived flag, with lifecycle archived and its key still reserved.
401application/jsonThe API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying.
403application/jsonThe credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible.
404application/jsonFLAG_NOT_FOUND means no flag with that id exists in this organization; list the project’s flags and use an id from that answer. An archived flag is still readable by id — it is the list that hides it.
409application/jsonFLAG_STILL_REFERENCED means the stored code-ref scan still finds the key (codeRefs.count above zero): the message names the count, the scanned commit and up to five path:line references; delete the code that names the key, deploy it, rerun `praxis devops flag refs —report —project <id>` and retry. FLAG_HAS_LIVE_RULES means no reference remains but the flag is on in one or more environments: the message lists those environment ids; turn the flag off in each with the environment update and retry. Nothing was archived in either case.
500application/jsonINTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again.