---
title: "Create a context"
method: POST
path: "/v2/contexts"
tags: ["Contexts"]
---

# Create a context

`POST /v2/contexts`

Create a new context with the specified type, id, and data. Returns 409 if context already exists.
      **type** and **id** are required fields, **data** is optional, if the context already exists, it returns the 409 response

## Request body

- CreateContextRequestDto
  - `type` string, required — Context type (e.g., tenant, app, workspace). Must be lowercase alphanumeric with optional separators.
  - `id` string, required — Unique identifier for this context. Must be lowercase alphanumeric with optional separators.
  - `data` object — Optional custom data to associate with this context.

## Response `201`

Created

- GetContextResponseDto
  - `type` string, required — Context type (e.g., tenant, app, workspace)
  - `id` string, required — Unique identifier for this context
  - `data` object, required — Custom data associated with this context
  - `createdAt` string, required — Creation timestamp
  - `updatedAt` string, required — Last update timestamp

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `405` — Method Not Allowed
- `409` — Conflict
- `413` — Payload Too Large
- `414` — URI Too Long
- `415` — Unsupported Media Type
- `422` — Unprocessable Entity
- `429` — The client has sent too many requests in a given amount of time.
- `500` — Internal Server Error
- `503` — The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.

---

[API](https://skmtc.net/novu/apis/deprecated-novu-api-use-openapi-json-yaml-instead.md) · [All operations](https://skmtc.net/novu/apis/deprecated-novu-api-use-openapi-json-yaml-instead/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/novu/deprecated-novu-api-use-openapi-json-yaml-instead/versions/986fe259fa85/schema)
