---
title: "Validate constraint"
method: POST
path: "/api/admin/constraints/validate"
tags: ["Features"]
---

# Validate constraint

`POST /api/admin/constraints/validate`

Validates a constraint definition. Checks whether the context field exists and whether the applied configuration is valid. Additional properties are not allowed on data objects that you send to this endpoint.

## Request body

- 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` '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', 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).
  - `caseInsensitive` boolean — Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).
  - `inverted` boolean — Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa.
  - `values` string[] — The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values.
  - `value` string — The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.

## Response `204`

The constraint is valid

## Other responses

- `400` — The request data does not match what we expect.
- `401` — Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`.
- `403` — The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation
- `415` — The operation does not support request payloads of the provided type. Please ensure that you're using one of the listed payload types and that you have specified the right content type in the "content-type" header.

---

[API](https://skmtc.net/unleash/apis/unleash-api-3.md) · [All operations](https://skmtc.net/unleash/apis/unleash-api-3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/unleash/unleash-api-3/revisions/b2c3116e633e/schema)
