> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.getunleash.io/api/change-request/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getunleash.io/_mcp/server. # Create or add change to request POST https://app.unleash-instance.example.com/api/admin/projects/{projectId}/environments/{environment}/change-requests Content-Type: application/json **Enterprise feature** Given a change request exists, this endpoint will attempt to add a change to an existing change request for the user. If a change request does not exist, it will attempt to create one. Reference: https://docs.getunleash.io/api/change-request ## Authentication - `Authorization` header (required) — API key needed to access this API - `Authorization` header (bearer token, required) — API key needed to access this API, in Bearer token format ## Request ### Path parameters - `projectId` (string, required) - `environment` (string, required) ### Body (application/json) This endpoint expects a changeRequestOneOrManyCreateSchema. - `changeRequestOneOrManyCreateSchema` ## Response ### 200 changeRequestSchema - `changeRequestSchema` ## Errors ### 400 Bad Request Error The request data does not match what we expect. - `id` (string, optional) — The ID of the error instance - `name` (string, optional) — The name of the error kind - `message` (string, optional) — A description of what went wrong. ## Types ### ChangeRequestOneOrManyCreateSchema0 - `action` (enum, required) — The name of this action. - Allowed values: `updateSegment` - `payload` (upsertSegmentSchema, required) — Data used to create or update a segment ### ChangeRequestOneOrManyCreateSchema1 - `action` (enum, required) — The name of this action. - Allowed values: `deleteSegment` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf1Payload, required) — Required data to delete a segment. ### ChangeRequestOneOrManyCreateSchema2 Update the enabled state for a feature. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `updateEnabled` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf2Payload, required) ### ChangeRequestOneOrManyCreateSchema3 Add a strategy to the feature - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `addStrategy` - `payload` (createFeatureStrategySchema, required) — Create a strategy configuration in a feature ### ChangeRequestOneOrManyCreateSchema4 Update a milestone strategy belonging to this feature. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `updateMilestoneStrategy` - `payload` (updateMilestoneStrategySchema, required) — Update a milestone strategy configuration for a feature flag ### ChangeRequestOneOrManyCreateSchema5 Update a strategy belonging to this feature. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `updateStrategy` - `payload` (updateFeatureStrategySchema, required) — Update a strategy configuration in a feature ### ChangeRequestOneOrManyCreateSchema6 Delete a strategy from this feature. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `deleteStrategy` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf6Payload, required) ### ChangeRequestOneOrManyCreateSchema7 Archive a feature. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `archiveFeature` ### ChangeRequestOneOrManyCreateSchema8 Update variants for this feature. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `patchVariant` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf8Payload, required) ### ChangeRequestOneOrManyCreateSchema9 Reorder strategies for this feature - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `reorderStrategy` - `payload` (list of SetStrategySortOrderSchemaItems, required) — An array of strategies with their new sort order ### ChangeRequestOneOrManyCreateSchema10 Add a parent feature dependency. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `addDependency` - `payload` (createDependentFeatureSchema, required) — Feature dependency on a parent feature in write model ### ChangeRequestOneOrManyCreateSchema11 Remove a parent feature dependency or all dependencies if no payload. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `deleteDependency` ### ChangeRequestOneOrManyCreateSchema12 Add a release plan to this feature environment. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `addReleasePlan` - `payload` (releasePlanTemplateIdSchema, required) — Schema for creating a release plan for a feature flag environment by copying and applying the configuration from a release plan template. ### ChangeRequestOneOrManyCreateSchema13 Start milestone of feature environment release plan. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `startMilestone` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf13Payload, required) — The ID of the release plan and which of its milestones to start. ### ChangeRequestOneOrManyCreateSchema14 Remove a release plan from feature environment. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `deleteReleasePlan` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf14Payload, required) — The Id of the release plan to remove. ### ChangeRequestOneOrManyCreateSchema15 Create or update milestone progression from one milestone to another. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `changeMilestoneProgression` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf15Payload, required) ### ChangeRequestOneOrManyCreateSchema16 Delete milestone progression. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `deleteMilestoneProgression` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf16Payload, required) ### ChangeRequestOneOrManyCreateSchema17 Resume paused milestone progressions for a release plan. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `resumeMilestoneProgression` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf17Payload, required) ### ChangeRequestOneOrManyCreateSchema18 Create or update a safeguard for a release plan. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `changeReleasePlanSafeguard` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf18Payload, required) ### ChangeRequestOneOrManyCreateSchema19 Delete a safeguard from a release plan. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `deleteReleasePlanSafeguard` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf19Payload, required) ### ChangeRequestOneOrManyCreateSchema20 Create or update a safeguard for a feature environment. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `changeFeatureEnvSafeguard` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf20Payload, required) ### ChangeRequestOneOrManyCreateSchema21 Delete a safeguard from a feature environment. - `feature` (string, required) — The name of the feature that this change applies to. - `action` (enum, required) — The name of this action. - Allowed values: `deleteFeatureEnvSafeguard` - `payload` (ChangeRequestOneOrManyCreateSchemaOneOf21Payload, required) ### ChangeRequestSchema0 - `id` (double, required) — This change requests's ID. - `environment` (string, required) — The environment in which the changes should be applied. - `minApprovals` (double, required) — The minimum number of approvals required before this change request can be applied. - `project` (string, required) — The project this change request belongs to. - `features` (list of changeRequestFeatureSchema, required) — The list of features and their changes that relate to this change request. - `segments` (list of changeRequestSegmentChangeSchema, required) — The list of segments and their changes that relate to this change request. - `createdBy` (ChangeRequestSchemaOneOf0CreatedBy, required) — The user who created this change request. - `createdAt` (string, required) — When this change request was created. - `stateTimestamps` (map from string to string, required) — A mapping of each state this change request has entered to the most recent time when it entered that state. If a change request has entered the same state multiple times, only the most recent timestamp will be included. - `state` (enum, required) — The current state of the change request. - Allowed values: `Draft`, `In review`, `Approved`, `Applied`, `Cancelled`, `Rejected` - `title` (string, optional) — A title describing the change request's content. - `approvals` (list of changeRequestApprovalSchema, optional) — A list of approvals that this change request has received. - `rejections` (list of changeRequestApprovalSchema, optional) — A list of rejections that this change request has received. - `comments` (list of changeRequestCommentSchema, optional) — All comments that have been made on this change request. ### ChangeRequestSchema1 - `id` (double, required) — This change requests's ID. - `environment` (string, required) — The environment in which the changes should be applied. - `minApprovals` (double, required) — The minimum number of approvals required before this change request can be applied. - `project` (string, required) — The project this change request belongs to. - `features` (list of changeRequestFeatureSchema, required) — The list of features and their changes that relate to this change request. - `segments` (list of changeRequestSegmentChangeSchema, required) — The list of segments and their changes that relate to this change request. - `createdBy` (ChangeRequestSchemaOneOf1CreatedBy, required) — The user who created this change request. - `createdAt` (string, required) — When this change request was created. - `stateTimestamps` (map from string to string, required) — A mapping of each state this change request has entered to the most recent time when it entered that state. If a change request has entered the same state multiple times, only the most recent timestamp will be included. - `state` (enum, required) — The current state of the change request. - Allowed values: `Scheduled` - `schedule` (changeRequestScheduleSchema, required) — A schedule for a change request's application. The schedule can either be pending, failed, or suspended. The schedule will always contain the state of the schedule and the last scheduled time, but other data varies between the different states. - `title` (string, optional) — A title describing the change request's content. - `approvals` (list of changeRequestApprovalSchema, optional) — A list of approvals that this change request has received. - `rejections` (list of changeRequestApprovalSchema, optional) — A list of rejections that this change request has received. - `comments` (list of changeRequestCommentSchema, optional) — All comments that have been made on this change request. ### upsertSegmentSchema Data used to create or update a segment - `name` (string, required) — The name of the segment - `constraints` (list of constraintSchema, required) — The list of constraints that make up this segment - `description` (string, optional, nullable) — A description of what the segment is for - `project` (string, optional, nullable) — The project the segment belongs to if any. ### ChangeRequestOneOrManyCreateSchemaOneOf1Payload Required data to delete a segment. - `id` (integer, required) — The ID of the segment to delete. ### ChangeRequestOneOrManyCreateSchemaOneOf2Payload - `enabled` (boolean, required) — The new state of the feature. - `shouldActivateDisabledStrategies` (boolean, optional) — Only relevant when ALL the strategies are disabled. If `true`, all the disabled strategies will be enabled. If `false`, the default strategy will be added ### createFeatureStrategySchema Create a strategy configuration in a feature - `name` (string, required) — The name of the strategy type - `title` (string, optional, nullable) — A descriptive title for the strategy - `disabled` (boolean, optional, nullable) — A toggle to disable the strategy. defaults to false. Disabled strategies are not evaluated or returned to the SDKs - `sortOrder` (double, optional) — The order of the strategy in the list - `constraints` (list of constraintSchema, optional) — A list of the constraints attached to the strategy. See https://docs.getunleash.io/concepts/activation-strategies#constraints - `variants` (list of createStrategyVariantSchema, optional) — Strategy level variants - `parameters` (map from string to string, optional) — An object containing the parameters for the strategy - `segments` (list of double, optional) — Ids of segments to use for this strategy ### updateMilestoneStrategySchema Update a milestone strategy configuration for a feature flag - `sortOrder` (double, optional) — The order of the strategy in the list in feature environment configuration - `constraints` (list of constraintSchema, optional) — A list of the constraints attached to the strategy. See https://docs.getunleash.io/concepts/activation-strategies#constraints - `title` (string, optional, nullable) — A descriptive title for the strategy - `disabled` (boolean, optional, nullable) — A toggle to disable the strategy. defaults to true. Disabled strategies are not evaluated or returned to the SDKs - `variants` (list of strategyVariantSchema, optional) — Strategy level variants - `segments` (list of double, optional) — A list of segment ids attached to the strategy - `parameters` (map from string to string, optional) — A list of parameters for a strategy ### updateFeatureStrategySchema Update a strategy configuration in a feature - `sortOrder` (double, optional) — The order of the strategy in the list in feature environment configuration - `constraints` (list of constraintSchema, optional) — A list of the constraints attached to the strategy. See https://docs.getunleash.io/concepts/activation-strategies#constraints - `title` (string, optional, nullable) — A descriptive title for the strategy - `disabled` (boolean, optional, nullable) — A toggle to disable the strategy. defaults to true. Disabled strategies are not evaluated or returned to the SDKs - `variants` (list of strategyVariantSchema, optional) — Strategy level variants - `segments` (list of double, optional) — A list of segment ids attached to the strategy - `parameters` (map from string to string, optional) — A list of parameters for a strategy - `name` (string, optional, deprecated) — The name of the strategy type. This property is deprecated and the ability to change a strategy's type will be removed in a future release. ### ChangeRequestOneOrManyCreateSchemaOneOf6Payload - `id` (string, required) — The ID of the strategy to update. ### ChangeRequestOneOrManyCreateSchemaOneOf8Payload - `variants` (list of variantSchema, required) ### SetStrategySortOrderSchemaItems A strategy with its new sort order - `id` (string, required) — The ID of the strategy - `sortOrder` (double, required) — The new sort order of the strategy ### createDependentFeatureSchema Feature dependency on a parent feature in write model - `feature` (string, required) — The name of the feature we depend on. - `enabled` (boolean, optional) — Whether the parent feature should be enabled. When `false` variants are ignored. `true` by default. - `variants` (list of string, optional) — The list of variants the parent feature should resolve to. Leave empty when you only want to check the `enabled` status. ### releasePlanTemplateIdSchema Schema for creating a release plan for a feature flag environment by copying and applying the configuration from a release plan template. - `templateId` (string, required) — The release plan template's ID. Release template IDs are ulids. ### ChangeRequestOneOrManyCreateSchemaOneOf13Payload The ID of the release plan and which of its milestones to start. - `milestoneId` (string, required) — The ID of the milestone to start. This ID is an ulid - `planId` (string, required) — The ID of the release plan. This ID is an ulid ### ChangeRequestOneOrManyCreateSchemaOneOf14Payload The Id of the release plan to remove. - `planId` (string, required) — The Id of the release plan. This id is an ulid ### ChangeRequestOneOrManyCreateSchemaOneOf15Payload - `sourceMilestone` (string, required) — The ID of the source milestone - `targetMilestone` (string, required) — The ID of the target milestone - `transitionCondition` (transitionConditionSchema, required) — The condition configuration for the transition ### ChangeRequestOneOrManyCreateSchemaOneOf16Payload - `sourceMilestone` (string, required) — The ID of the source milestone with progression to delete. ### ChangeRequestOneOrManyCreateSchemaOneOf17Payload - `planId` (string, required) — The release plan's unique identifier (ULID format) ### ChangeRequestOneOrManyCreateSchemaOneOf18Payload - `planId` (string, required) — The ID of the release plan. This ID is an ulid - `safeguard` (createSafeguardSchema, required) — Request body to create a safeguard with metric-based alert condition. ### ChangeRequestOneOrManyCreateSchemaOneOf19Payload - `planId` (string, required) — The ID of the release plan. This ID is an ulid - `safeguardId` (string, required) — The ID of the safeguard to delete. ### ChangeRequestOneOrManyCreateSchemaOneOf20Payload - `safeguard` (createSafeguardSchema, required) — Request body to create a safeguard with metric-based alert condition. ### ChangeRequestOneOrManyCreateSchemaOneOf21Payload - `safeguardId` (string, required) — The ID of the safeguard to delete. ### changeRequestFeatureSchema A feature and all its suggested changes. - `name` (string, required) — The name of the feature - `changes` (list of changeRequestChangeSchema, required) — List of changes inside change request. This list may be empty when listing all change requests for a project. - `conflict` (string, optional) — A string describing the conflicts related to this change. Only present if there are any conflicts on the feature level. - `defaultChange` (changeRequestDefaultChangeSchema, optional) — A description of a default change that will be applied with the change request to prevent invalid states. Default changes are changes that are applied in addition to explicit user-specified changes when a change request is applied. Any default changes are applied in the background and are not a real part of the change request. ### changeRequestSegmentChangeSchema A change request segment change, containing info about the type of segment change and the specific changes. - `id` (double, required) — The ID of this change. - `action` (string, required) — The kind of action that the change contains information about. - `payload` (ChangeRequestSegmentChangeSchemaPayload, required) — The data required to perform this action. - `name` (string, required) — The current name of the segment - `conflict` (string, optional) — A description of the conflict caused by this change. Only present if there are any conflicts. - `createdBy` (ChangeRequestSegmentChangeSchemaCreatedBy, optional) — The user who created this change. - `createdAt` (string, optional) — When this change was suggested - `scheduleConflicts` (ChangeRequestSegmentChangeSchemaScheduleConflicts, optional) — Information about scheduled change requests that would casue conflicts with this change if applied. ### ChangeRequestSchemaOneOf0CreatedBy The user who created this change request. - `username` (string, optional, nullable) - `imageUrl` (string, optional, nullable) — The URL of the user's profile image. ### changeRequestApprovalSchema Information about a [change request](https://docs.getunleash.io/concepts/change-requests) approval. - `createdBy` (ChangeRequestApprovalSchemaCreatedBy, required) — Information about the user who gave this approval. - `createdAt` (string, required) — When the approval was given. ### changeRequestCommentSchema A comment belonging to a [change request](https://docs.getunleash.io/concepts/change-requests). - `text` (string, required) — The content of the comment. - `createdBy` (ChangeRequestCommentSchemaCreatedBy, required) — Information about the user who posted the comment - `createdAt` (string, required) — When the comment was made. - `id` (double, optional) — The comment's ID. Unique per change request. ### ChangeRequestSchemaOneOf1CreatedBy The user who created this change request. - `username` (string, optional, nullable) - `imageUrl` (string, optional, nullable) — The URL of the user's profile image. ### changeRequestScheduleSchema A schedule for a change request's application. The schedule can either be pending, failed, or suspended. The schedule will always contain the state of the schedule and the last scheduled time, but other data varies between the different states. ### constraintSchema A strategy constraint. For more information, refer to [the strategy constraint reference documentation](https://docs.getunleash.io/concepts/activation-strategies#constraints) - `contextName` (string, required) — The name of the context field that this constraint should apply to. - `operator` (enum, required) — The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/concepts/activation-strategies#constraint-operators). - Allowed values: `NOT_IN`, `IN`, `STR_ENDS_WITH`, `STR_STARTS_WITH`, `STR_CONTAINS`, `NUM_EQ`, `NUM_GT`, `NUM_GTE`, `NUM_LT`, `NUM_LTE`, `DATE_AFTER`, `DATE_BEFORE`, `SEMVER_EQ`, `SEMVER_GT`, `SEMVER_LT`, `SEMVER_GTE`, `SEMVER_LTE`, `REGEX` - `caseInsensitive` (boolean, optional, default: false) — Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive). - `inverted` (boolean, optional, default: false) — Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa. - `values` (list of string, optional) — The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values. - `value` (string, optional) — The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values. ### createStrategyVariantSchema This is an experimental property. It may change or be removed as we work on it. Please don't depend on it yet. A strategy variant allows you to attach any data to strategies instead of only returning `true`/`false`. Strategy variants take precedence over feature variants. - `name` (string, required) — The variant name. Must be unique for this feature flag - `weight` (integer, required) — The weight is the likelihood of any one user getting this variant. It is an integer between 0 and 1000. See the section on [variant weights](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight) for more information - `weightType` (enum, required) — Set to `fix` if this variant must have exactly the weight allocated to it. If the type is `variable`, the weight will adjust so that the total weight of all variants adds up to 1000. Refer to the [variant weight documentation](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight). - Allowed values: `variable`, `fix` - `stickiness` (string, required) — The [stickiness](https://docs.getunleash.io/concepts/feature-flag-variants#variant-stickiness) to use for distribution of this variant. Stickiness is how Unleash guarantees that the same user gets the same variant every time - `payload` (CreateStrategyVariantSchemaPayload, optional) — Extra data configured for this variant ### strategyVariantSchema This is an experimental property. It may change or be removed as we work on it. Please don't depend on it yet. A strategy variant allows you to attach any data to strategies instead of only returning `true`/`false`. Strategy variants take precedence over feature variants. - `name` (string, required) — The variant name. Must be unique for this feature flag - `weight` (integer, required) — The weight is the likelihood of any one user getting this variant. It is an integer between 0 and 1000. See the section on [variant weights](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight) for more information - `weightType` (enum, required) — Set to `fix` if this variant must have exactly the weight allocated to it. If the type is `variable`, the weight will adjust so that the total weight of all variants adds up to 1000. Refer to the [variant weight documentation](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight). - Allowed values: `variable`, `fix` - `stickiness` (string, required) — The [stickiness](https://docs.getunleash.io/concepts/feature-flag-variants#variant-stickiness) to use for distribution of this variant. Stickiness is how Unleash guarantees that the same user gets the same variant every time - `payload` (StrategyVariantSchemaPayload, optional) — Extra data configured for this variant ### variantSchema A variant allows for further separation of users into segments. See [our excellent documentation](https://docs.getunleash.io/concepts/feature-flag-variants#what-are-variants) for a more detailed description - `name` (string, required) — The variants name. Is unique for this feature flag - `weight` (double, required) — The weight is the likelihood of any one user getting this variant. It is a number between 0 and 1000. See the section on [variant weights](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight) for more information - `weightType` (enum, optional) — Set to fix if this variant must have exactly the weight allocated to it. If the type is variable, the weight will adjust so that the total weight of all variants adds up to 1000 - Allowed values: `variable`, `fix` - `stickiness` (string, optional) — [Stickiness](https://docs.getunleash.io/concepts/feature-flag-variants#variant-stickiness) is how Unleash guarantees that the same user gets the same variant every time - `payload` (VariantSchemaPayload, optional) — Extra data configured for this variant - `overrides` (list of overrideSchema, optional) — Overrides assigning specific variants to specific users. The weighting system automatically assigns users to specific groups for you, but any overrides in this list will take precedence. ### transitionConditionSchema A transition condition for milestone progression ### createSafeguardSchema Request body to create a safeguard with metric-based alert condition. - `impactMetric` (CreateSafeguardSchemaImpactMetric, required) — Metric configuration that should be evaluated for the safeguard. - `triggerCondition` (safeguardTriggerConditionSchema, required) — The condition that triggers the safeguard. ### changeRequestChangeSchema A change request change, containing info about the type of change and the specific changes. - `id` (double, required) — The ID of this change. - `action` (string, required) — The kind of action that the change contains information about. - `conflict` (string, optional) — A description of the conflict caused by this change. Only present if there are any conflicts. - `payload` (ChangeRequestChangeSchemaPayload, optional) — The data required to perform this action. - `createdBy` (ChangeRequestChangeSchemaCreatedBy, optional) — The user who created this change. - `createdAt` (string, optional) — When this change was suggested - `scheduleConflicts` (ChangeRequestChangeSchemaScheduleConflicts, optional) — Information about scheduled change requests that would casue conflicts with this change if applied. ### changeRequestDefaultChangeSchema A description of a default change that will be applied with the change request to prevent invalid states. Default changes are changes that are applied in addition to explicit user-specified changes when a change request is applied. Any default changes are applied in the background and are not a real part of the change request. - `action` (string, required) — The kind of action this is. - `payload` (ChangeRequestDefaultChangeSchemaPayload, required) — The necessary data to perform this change. ### ChangeRequestSegmentChangeSchemaPayload The data required to perform this action. ### ChangeRequestSegmentChangeSchemaCreatedBy The user who created this change. - `username` (string, optional, nullable) — The user's username. - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found. ### ChangeRequestSegmentChangeSchemaScheduleConflicts Information about scheduled change requests that would casue conflicts with this change if applied. - `changeRequests` (list of ChangeRequestSegmentChangeSchemaScheduleConflictsChangeRequestsItems, required) — The list of scheduled change requests that would cause conflict with this change. ### ChangeRequestApprovalSchemaCreatedBy Information about the user who gave this approval. - `id` (double, optional) — The ID of the user who gave this approval. - `username` (string, optional) — The approving user's username. - `imageUrl` (string, optional) — The URL where the user's image can be found. ### ChangeRequestCommentSchemaCreatedBy Information about the user who posted the comment - `username` (string, optional, nullable) — The user's username. - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found. ### ChangeRequestScheduleSchema0 A pending schedule for a change request. - `scheduledAt` (string, required) — When this change request will be applied. - `status` (enum, required) — The status of the schedule. - Allowed values: `pending` ### ChangeRequestScheduleSchema1 A failed schedule for a change request. - `scheduledAt` (string, required) — When Unleash last attempted to apply this change request. - `status` (enum, required) — The status of the schedule. - Allowed values: `failed` - `reason` (string, required) — The reason the scheduled failed to apply. - `failureReason` (string, optional, nullable, deprecated) — The reason the scheduled failed to apply. Deprecated in favor of the `reason` property. ### ChangeRequestScheduleSchema2 A suspended schedule for a change request. - `scheduledAt` (string, required) — When Unleash would have attempted to apply this change request if the schedule was not suspended. - `status` (enum, required) — The status of the schedule. - Allowed values: `suspended` - `reason` (string, required) — Why the schedule was suspended. ### CreateStrategyVariantSchemaPayload Extra data configured for this variant - `type` (enum, required) — The type of the value. Commonly used types are string, number, json and csv. - Allowed values: `json`, `csv`, `string`, `number` - `value` (string, required) — The actual value of payload ### StrategyVariantSchemaPayload Extra data configured for this variant - `type` (enum, required) — The type of the value. Commonly used types are string, number, json and csv. - Allowed values: `json`, `csv`, `string`, `number` - `value` (string, required) — The actual value of payload ### VariantSchemaPayload Extra data configured for this variant - `type` (enum, required) — The type of the value. Commonly used types are string, number, json and csv. - Allowed values: `json`, `csv`, `string`, `number` - `value` (string, required) — The actual value of payload ### overrideSchema An override for deciding which variant should be assigned to a user based on the context name - `contextName` (string, required) — The name of the context field used to determine overrides - `values` (list of string, required) — Which values that should be overriden ### TransitionConditionSchema0 Transition after a fixed amount of time from milestone start - `intervalMinutes` (integer, required) — The interval in minutes before transitioning - `type` (enum, optional) — Discriminator for time-based transitions. Omitting it means time-based. - Allowed values: `time` ### TransitionConditionSchema1 Transition once the feature has been exposed (evaluated as enabled) enough times in total - `type` (enum, required) — Discriminator for exposure-based transitions - Allowed values: `exposure` - `minimumExposures` (integer, required) — The total number of enabled evaluations of the feature required before transitioning ### CreateSafeguardSchemaImpactMetric Metric configuration that should be evaluated for the safeguard. - `metricName` (string, required) — The Prometheus metric series to query. It includes both unleash prefix and metric type and display name - `timeRange` (enum, required) — The time range for the metric data. - Allowed values: `hour`, `day`, `week`, `month` - `aggregationMode` (enum, required) — The aggregation mode for the metric data. - Allowed values: `rps`, `count`, `avg`, `sum`, `p95`, `p99`, `p50` - `labelSelectors` (map from string to list of string, required) — The selected labels and their values for filtering the metric data. - `source` (enum, optional) — The Prometheus data source for this metric. Internal is the Unleash-managed Prometheus, external is a customer-provided Prometheus instance. Defaults to internal if not specified. - Allowed values: `internal`, `external` ### safeguardTriggerConditionSchema The condition that triggers the safeguard. - `operator` (enum, required) — The comparison operator for the threshold check. - Allowed values: `>`, `<` - `threshold` (double, required) — The threshold value to compare against. ### ChangeRequestChangeSchemaPayload The data required to perform this action. ### ChangeRequestChangeSchemaCreatedBy The user who created this change. - `username` (string, optional, nullable) — The user's username. - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found. ### ChangeRequestChangeSchemaScheduleConflicts Information about scheduled change requests that would casue conflicts with this change if applied. - `changeRequests` (list of ChangeRequestChangeSchemaScheduleConflictsChangeRequestsItems, required) — The list of scheduled change requests that would cause conflict with this change. ### ChangeRequestDefaultChangeSchemaPayload The necessary data to perform this change. ### ChangeRequestSegmentChangeSchemaScheduleConflictsChangeRequestsItems - `id` (double, required) — The ID of the change request. - `title` (string, optional) — The title of the change request, if any. Only present if there is a title. ### ChangeRequestChangeSchemaScheduleConflictsChangeRequestsItems - `id` (double, required) — The ID of the change request. - `title` (string, optional) — The title of the change request, if any. Only present if there is a title. ## Examples **Request** ```json { "action": "updateSegment", "payload": { "constraints": [ { "contextName": "appName", "operator": "IN" } ], "name": "beta-users" } } ``` **Response** ```json { "approvals": [ { "createdAt": "2022-12-12T12:13:24.218Z", "createdBy": { "id": 33, "imageUrl": "string", "username": "unleash-user" } } ], "comments": [ { "createdAt": "2022-12-12T12:13:24.218Z", "createdBy": { "imageUrl": "string", "username": "unleash-user" }, "id": 33, "text": "This is a comment" } ], "createdAt": "2023-07-31T13:33:02Z", "createdBy": { "imageUrl": "string", "username": "Hunter" }, "environment": "development", "features": [ { "changes": [ { "action": "updateStrategy", "conflict": "Strategy has been deleted", "createdAt": "2023-07-31T13:22:03+02:00", "createdBy": { "imageUrl": "string", "username": "string" }, "id": 33, "payload": {}, "scheduleConflicts": { "changeRequests": [ { "id": 1.1, "title": "string" } ] } } ], "conflict": "Feature has been archived", "defaultChange": { "action": "addStrategy", "payload": { "constraints": [ { "caseInsensitive": false, "contextName": "userId", "inverted": false, "operator": "STR_CONTAINS", "values": [ "ux" ] } ], "disabled": false, "name": "flexibleRollout", "parameters": { "groupId": "my-feature", "rollout": "100", "stickiness": "default" }, "segments": [], "title": "" } }, "name": "my-feature" } ], "id": 3, "minApprovals": 2, "project": "unleash-project", "rejections": [ { "createdAt": "2022-12-12T12:13:24.218Z", "createdBy": { "id": 33, "imageUrl": "string", "username": "unleash-user" } } ], "segments": [ { "action": "updateStrategy", "conflict": "Strategy has been deleted", "createdAt": "2023-07-31T13:22:03+02:00", "createdBy": { "imageUrl": "string", "username": "string" }, "id": 33, "name": "beta-users", "payload": {}, "scheduleConflicts": { "changeRequests": [ { "id": 1.1, "title": "string" } ] } } ], "state": "Draft", "stateTimestamps": { "Approved": "2023-08-02T09:01:00Z", "Draft": "2023-07-31T13:33:02Z", "In review": "2023-08-01T10:15:30Z" }, "title": "Increasing gradual rollout" } ``` **SDK Code** ```python import requests url = "https://app.unleash-instance.example.com/api/admin/projects/projectId/environments/environment/change-requests" payload = { "action": "updateSegment", "payload": { "constraints": [ { "contextName": "appName", "operator": "IN" } ], "name": "beta-users" } } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/admin/projects/projectId/environments/environment/change-requests'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"action":"updateSegment","payload":{"constraints":[{"contextName":"appName","operator":"IN"}],"name":"beta-users"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.unleash-instance.example.com/api/admin/projects/projectId/environments/environment/change-requests" payload := strings.NewReader("{\n \"action\": \"updateSegment\",\n \"payload\": {\n \"constraints\": [\n {\n \"contextName\": \"appName\",\n \"operator\": \"IN\"\n }\n ],\n \"name\": \"beta-users\"\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.unleash-instance.example.com/api/admin/projects/projectId/environments/environment/change-requests") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"action\": \"updateSegment\",\n \"payload\": {\n \"constraints\": [\n {\n \"contextName\": \"appName\",\n \"operator\": \"IN\"\n }\n ],\n \"name\": \"beta-users\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://app.unleash-instance.example.com/api/admin/projects/projectId/environments/environment/change-requests") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"action\": \"updateSegment\",\n \"payload\": {\n \"constraints\": [\n {\n \"contextName\": \"appName\",\n \"operator\": \"IN\"\n }\n ],\n \"name\": \"beta-users\"\n }\n}") .asString(); ``` ```php request('POST', 'https://app.unleash-instance.example.com/api/admin/projects/projectId/environments/environment/change-requests', [ 'body' => '{ "action": "updateSegment", "payload": { "constraints": [ { "contextName": "appName", "operator": "IN" } ], "name": "beta-users" } }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/admin/projects/projectId/environments/environment/change-requests"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"action\": \"updateSegment\",\n \"payload\": {\n \"constraints\": [\n {\n \"contextName\": \"appName\",\n \"operator\": \"IN\"\n }\n ],\n \"name\": \"beta-users\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "action": "updateSegment", "payload": [ "constraints": [ [ "contextName": "appName", "operator": "IN" ] ], "name": "beta-users" ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/projects/projectId/environments/environment/change-requests")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```