---
title: "Create context restriction"
method: POST
path: "/context/{context_id}/restrictions"
tags: ["Context"]
---

# Create context restriction

`POST /context/{context_id}/restrictions`

Creates project or expression restriction on a context.

## Request body

- object
  - `restriction_type` 'project' | 'expression' | 'group' — Type of the restriction.
  - `restriction_value` string — Value used to evaluate the restriction. If the `restriction_type` is `project`, this will be the project UUID. If the `restriction_type` is `expression`, this will be the expression rule.

## Response `201`

Successful response.

- RestrictionCreated
  - `id` string, uuid — UUID of the project restriction
  - `project_id` string, uuid — Deprecated - For "project" restrictions read the project ID from "restriction_value" instead. UUID of the project used in a project restriction.
  - `name` string — Contains a human-readable reference for the restriction. For "project" restrictions this is the name of the project. May be null.
  - `restriction_type` 'project' | 'expression' | 'group' — Type of the restriction
  - `restriction_value` string — Value used to evaluate the restriction

## Other responses

- `400` — Bad request.
- `401` — Credentials provided are invalid.
- `404` — Entity not found.
- `409` — Request conflict.
- `429` — API rate limits exceeded.
- `500` — Internal server error.

---

[API](https://skmtc.net/circleci/apis/api-v2.md) · [All operations](https://skmtc.net/circleci/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/circleci/api-v2/versions/b9c0e0c24058/schema)
