Update a segment
Code Mode: praxis.devops.segments.update
HTTP: PATCH /devops/v1/segments/{id}
Change a segment’s membership: name, included, excluded and rules, naming in updateMask the fields this request means to write. A field present in segment but absent from updateMask is left alone, and a mask naming anything else — key, environment, kind — is refused rather than ignored, so an audience keeps the identity rules match on. A listed field replaces the whole list rather than adding to it. The change is stored here as the source of truth and reaches evaluation through the environment’s ruleset; if that push fails the write still stands and is reconciled later, so the caller is not told an accepted edit was rejected.
Signature
praxis.devops.segments.update(args:{path:{/** e.g. "seg_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string};body:{segment:{/** New display name for the segment; nothing matches on it, so it may change freely. e.g. "Beta testers" */ name?:string;/** The segment's full included list after this write; send an empty list to clear it, since the list replaces rather than merges. */ included?:Array<string>;/** The segment's full excluded list after this write; send an empty list to clear it. */ excluded?:Array<string>;/** The segment's full rule set after this write; send an empty list to leave membership to the included and excluded lists. */ rules?:Array<{/** 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}>;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}}}>};/** Which fields to write, by name; omit it to write every field the segment object carries, and a field not listed is left as it is. e.g. ["included","excluded"] */ updateMask?:Array<string>}}):Promise<{/** Segment identifier used by updates; rules target a segment by its key, not by this id. e.g. "seg_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The resource type of this answer, always segment. */ object:"segment";/** RFC 3339 UTC time the segment was created; it is the default order of the segment list. e.g. "2026-11-03T09:10:00Z" */ createTime:string;/** RFC 3339 UTC time the segment's membership or name last changed. e.g. "2026-11-03T09:14:00Z" */ updateTime:string;/** Canonical Console link for the project this segment belongs to. e.g. "https://console.deepraxis.com/devops/projects/dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ viewerUrl:string;/** The project this segment belongs to, from the project list. e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string;/** The environment this segment belongs to; a segment never crosses environments, so the same audience is created once per environment it is needed in. e.g. "dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ environment:string;/** The name flag rules match this segment by; unique inside the environment, unchanged after creation, and what an inSegment clause carries. pattern: ^[a-z][a-z0-9-]{0,63}$ e.g. "beta-testers" */ key:string;/** Display name of the segment, shown wherever it is listed; it defaults to the key. e.g. "Beta testers" */ name:string;/** What the listed recipients are, such as a user or an organization; it says which context attribute the entries are compared against. e.g. "user" */ kind:string;/** Recipients always in the segment, whatever their context says; an empty list adds nobody by name. */ included:Array<string>;/** Recipients always out of the segment, even when a rule would select them; exclusion wins over inclusion. */ excluded:Array<string>;/** Rules that add recipients by a context attribute, such as everyone in a region; an empty list means membership is only the lists above. */ rules:Array<{/** 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}>;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}}}>}>;Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string | yes | The segment identifier returned by a segment list or create answer, not the segment key rules refer to. |
Request body
| Required | Content types | Description |
|---|---|---|
| yes | application/json |
Responses
| Status | Content types | Description |
|---|---|---|
| 200 | application/json | The segment after the change, with its new membership. |
| 400 | application/json | INVALID_ARGUMENT means updateMask names a field this operation cannot change — only name, included, excluded and rules are updatable — or segment is not an object of those fields. Correct the mask and resend; nothing was written. |
| 401 | application/json | The API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying. |
| 403 | application/json | The 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. |
| 404 | application/json | SEGMENT_NOT_FOUND means no segment with that id exists in this organization; list the environment’s segments and use an id from that answer. A segment belongs to one environment, so an id from another environment’s list is not readable here either. |
| 500 | application/json | INTERNAL 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. |