> For the complete documentation index, see [llms.txt](https://docs.stellic.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stellic.com/stellic-partner-api/requirements/remove-a-requirement-constraint.md).

# Remove a requirement constraint

Use this endpoint to remove a constraint from a requirement in a draft audit. The requirement and its children stay. `{constraint_id}` is the constraint's `id` from the draft's tree and must be on `{requirement_id}`. Students aren't affected until you publish.

## DELETE /requirements/{requirement\_id}/constraints/{constraint\_id}

>

```json
{"openapi":"3.0.0","info":{"title":"Stellic for Developers","version":"1.0"},"tags":[{"name":"Requirements","description":"Add, update, and remove the constraints (rules) on a requirement inside a draft audit."}],"servers":[{"url":"https://{institution}.stellic.com/partnerapi/v1","variables":{"institution":{"default":"{institution}","description":"Your institution's Stellic subdomain: the part before `.stellic.com` in the URL you use to sign in. It becomes the host in every request, as in `https://{institution}.stellic.com/partnerapi/v1/...`. Replace the `{institution}` placeholder with your subdomain before sending."}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal Access Token issued by your Stellic integration partner. Send it as `Authorization: Bearer <token>` on every request. One token per institution; do not share across environments."}},"schemas":{"RemoveConstraintResponse":{"type":"object","properties":{"success":{"type":"boolean"},"pending_change":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/PendingChange"}],"description":"`null` when the removal only undid an add made on this draft."}}},"PendingChange":{"type":"object","description":"A draft change queued for replay onto the published version when the draft is published.","properties":{"user":{"$ref":"#/components/schemas/PendingChangeUser"},"text":{"type":"string","description":"Plain-language summary of the change."},"timestamp":{"type":"string","description":"When the change was recorded, as `YYYY-MM-DD HH:MM:SS.ffffff+00:00`."}}},"PendingChangeUser":{"type":"object","description":"The account that made the change, as recorded on the change record.","properties":{"username":{"type":"string"},"display_username":{"type":"string"},"userid":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"first_name":{"type":"string"},"last_name":{"type":"string"},"photo_url":{"type":"string","nullable":true},"email":{"type":"string"},"sms_alerts_enabled":{"type":"boolean"},"last_log_in":{"type":"string","nullable":true},"is_active":{"type":"boolean"},"is_admin":{"type":"boolean"},"role":{"type":"string","nullable":true},"mobile_number":{"type":"string","nullable":true},"hash":{"type":"string","description":"Opaque account token. Ignore it."}}},"ErrorMessage":{"type":"object","description":"Error envelope used by the programs, audits, and requirements endpoints.","properties":{"error":{"type":"string","description":"Human-readable reason. Match on it if you need to branch; the strings on each endpoint page are verbatim."}}}}},"paths":{"/requirements/{requirement_id}/constraints/{constraint_id}":{"delete":{"tags":["Requirements"],"parameters":[{"name":"requirement_id","in":"path","required":true,"description":"Internal numeric ID of the requirement that carries the constraint (a node `id` in the draft's `requirement_tree`).","schema":{"type":"integer"}},{"name":"constraint_id","in":"path","required":true,"description":"Internal numeric ID of the constraint: the `id` inside a `constraints[]` entry of that node. Must belong to `requirement_id`.","schema":{"type":"integer"}}],"responses":{"200":{"description":"Constraint removed from the draft. `pending_change` is `null` when the removal simply undoes an add you made on this draft, otherwise the change record replayed on publish.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoveConstraintResponse"}}}},"400":{"description":"The constraint cannot be removed as things stand.\n\nCommon causes:\n- Removing an `anyxof` constraint while the requirement still has sub-requirements - returns `Cannot remove this constraint. First remove all subrequirements of this requirement.`\n- Removing the only primary constraint while secondary constraints remain - returns `Cannot remove this constraint since there are other non-primary constraints added to the requirements. Remove them first or add a primary constraint.`\n- The draft cannot be edited - returns `Cannot edit this audit. Please contact the Stellic team.` Contact your Stellic Representative for help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"401":{"description":"Missing or invalid Bearer token.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"403":{"description":"Your IP address isn't on the allowlist for this endpoint. Contact Stellic to add it; the response includes the `client_ip` Stellic saw. Also returned, with only `error` set, when the requirement's audit isn't a draft (`Can only modify constraints on draft audits.`), belongs to a compliance requirement (`Compliance requirements are not available via the API.`), or cannot be edited by the token's account (`Forbidden Access.`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"client_ip":{"type":"string"}}}}}},"404":{"description":"No requirement has this ID, or no constraint with `constraint_id` sits on this requirement. A second DELETE of the same constraint also returns 404. The body is `{\"detail\": \"No RequirementTypeDetail matches the given query.\"}`, or `{\"detail\": \"No Requirement matches the given query.\"}` for an unknown requirement. A requirement with no audit (including a course node), or a requirement no longer in a non-compliance draft audit's tree, returns `{\"error\": \"Requirement not found in an editable audit.\"}`.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"},"error":{"type":"string"}}}}}}}}}}}
```

#### What happens after the call

* The constraint is removed. If it was the primary constraint, another constraint that can be primary takes its place.
* If you added the constraint in this draft to a requirement the published audit also has, the add is dropped and `pending_change` is `null`. Otherwise the removal is recorded and applied to the published audit when you publish.

#### Notes

* **`anyxof` stays while the requirement has children.** Removing it returns `Cannot remove this constraint. First remove all subrequirements of this requirement.` Change its `x` with a PUT instead, or remove the children first.
* **A requirement can't be left with only secondary constraints.** Removing the last constraint that can be primary returns `Cannot remove this constraint since there are other non-primary constraints added to the requirements. Remove them first or add a primary constraint.`
* **Repeating the call returns a 404,** as does any unknown requirement or constraint: `{"detail": "No RequirementTypeDetail matches the given query."}` or `{"detail": "No Requirement matches the given query."}`. Choose a requirement still in the draft's tree, not a course node or a requirement removed from that tree.
* **Only drafts can be edited.** A requirement in a published or under-review audit returns a 403 with `Can only modify constraints on draft audits.` The token's account needs edit rights on the audit, or the call returns a 403 with `Forbidden Access.` A compliance requirement's audit returns a 403.

#### Related APIs

* [`PUT /requirements/{requirement_id}/constraints/{constraint_id}`](/stellic-partner-api/requirements/update-a-requirement-constraint.md) to change the rule instead.
* [`DELETE /audits/{audit_id}/requirements/{parent_req_id}/subrequirements/{subrequirement_id}`](/stellic-partner-api/audits/remove-a-sub-requirement.md) to remove children that block an `anyxof` removal.
