# Create context

Create a context within your organization. Creating a context means issuing a new context ID and defining what it can access.
NOTE: `products` and `resources` cannot be present together.

Endpoint: POST /api/context/user/v1/contexts
Version: 1.0
Security: BearerAuth

## Security:

  - `BearerAuth` (unknown)
    http bearer JWT

## Request fields (application/json):

  - `allowTracing` (string)
    Example: false

  - `products` (array)
    Cannot be present with resources

  - `products.productCode` (string, required)
    Available values: "XMCloud" | "Personalize" | "CDP" | "contenthub"
    Example: XMCloud

  - `products.tenantId` (string, required)
    Example: g6c3b17d-1816-40ef-bbf3-ae670311452c

  - `products.environment` (string)
    Only for XMCloud product. Available values: "Live" | "Preview"
    Example: Live

  - `resources` (array)
    Cannot be present with products

  - `resources.id` (string)
    Example: SitecorePesonalizeResource

  - `resources.name` (string)
    Example: My Sitecore personalize resource

  - `resources.type` (string, required)
    personalize | edge | search | forms | files
    Example: personalize

  - `resources.tenantId` (string, required)
    Example: g6c3b17d-1816-40ef-bbf3-ae670311452c

  - `resources.properties` (array)

  - `resources.properties.id` (string, required)
    Property id
    Example: POS

  - `resources.properties.value` (string, required)
    Property value
    Example: playwebsite

  - `name` (string)
    Example: My Context

  - `description` (string)
    Example: This is my context

## Response 201:

  - `201` (unknown)
    Created

## Response 201 fields (application/json):

  - `organizationId` (string, required)
    Example: org_123ABC

  - `sitecoreContextId` (string, required)
    Example: f9c3b17d181640efbbf3ae670311452d

  - `allowTracing` (string, required)
    Example: false

  - `type` (string, required)
    Example: custom

  - `accountId` (string, required)
    Example: account001

  - `resources` (array)

  - `resources.id` (string, required)
    Example: SitecoreSearchResource

  - `resources.name` (string, required)
    Example: My Sitecore search resource

  - `resources.type` (string, required)
    Example: search

  - `resources.tenantId` (string, required)
    Example: g6c3b17d-1816-40ef-bbf3-ae670311452c

  - `resources.properties` (array, required)

  - `resources.properties.id` (string, required)
    Property id
    Example: POS

  - `resources.properties.value` (string, required)
    Property value
    Example: playwebsite

  - `resources.tenantName` (string, required)
    Example: tenant name

  - `resources.tenantProductCode` (string, required)
    Example: Search

  - `name` (string)
    Example: My Context

  - `description` (string)
    Example: This is my context

  - `createdAt` (string)
    Example: 2025-09-22T01:00:00Z

  - `updatedAt` (string)
    Example: 2025-09-22T01:00:00Z

## Response 401:

  - `401` (unknown)
    Unauthorized request or invalid access token

## Response 401 fields (application/json):

  - `title` (string, required)
    Example: Unauthorized

  - `type` (string, required)
    Example: Unauthorized

  - `instance` (string, required)
    Example: /v1/context

  - `status` (integer, required)
    Example: 500

## Response 409:

  - `409` (unknown)
    Conflict

## Response 409 fields (application/json):

  - `title` (string, required)
    Example: Unauthorized

  - `type` (string, required)
    Example: Unauthorized

  - `instance` (string, required)
    Example: /v1/context

  - `status` (integer, required)
    Example: 500

## Response 422:

  - `422` (unknown)
    Unprocessable

## Response 422 fields (application/json):

  - `title` (string, required)
    Example: Unauthorized

  - `type` (string, required)
    Example: Unauthorized

  - `instance` (string, required)
    Example: /v1/context

  - `status` (integer, required)
    Example: 500

## Response 500:

  - `500` (unknown)
    Server-side exception during request execution

## Response 500 fields (application/json):

  - `title` (string, required)
    Example: Unauthorized

  - `type` (string, required)
    Example: Unauthorized

  - `instance` (string, required)
    Example: /v1/context

  - `status` (integer, required)
    Example: 500

