# Create Variant

Creates a new Variant resource from the supplied JSON body and returns its location in the `Location` header.
## Authentication
Requires a valid API key in the `X-API-KEY` header.
## Headers
### Accept-Language
Culture used to interpret the localized field values supplied in the request body.
- **omitted / null**
: tenant's default culture.
- **culture-code**
 (e.g.
`en-US`
,
`es`
): the specified culture.

## Request Body
A single JSON object whose properties match the writable fields published by
`/Variants/$metadata`. The body is normalized before reaching the application layer:
- Must be a non-empty JSON object.
- A JSON array is accepted only if it contains exactly one element.
- Values are coerced to CLR primitives (
`string`
,
`long`
,
`double`
,
`bool`
,
`null`
),

nested objects and arrays.
- A date attribute is a date and time with no time zone, stored and returned as written

(
`"frmt_date": "2026-10-21T16:22:00"`
). A value with
`Z`
 or an offset (
`2026-10-21T14:22:00Z`
) is converted to

its date and time in Spain (Europe/Madrid), the time the app shows (
`2026-10-21T16:22:00`
). System dates (
`_creation`
,
`_modify`
) are set by the service.

## Response
**201 Created** — The `Location` header points to the new resource: `/Variants({id})`.
No response body.
## Error Responses
- **400 Bad Request**
 — The body cannot be written: empty, an array of more than one

object, an attribute the entity does not have, one that cannot be assigned or a value the

attribute does not take. Answered as a message naming why, a JSON string

(
`"Value: ZZ not allowed"`
,
`"Invalid attribute name: nope_field"`
).
- **401 Unauthorized**
 — Missing or invalid API key. Returned by the API gateway as

`{ "message": "Unauthorized", "request_id": "d8aafa5b8f3e400b60bea0123dd33317" }`
.
- **403 Forbidden**
 — The API key does not have write permissions for this operation.
- **404 Not Found**
 — The product, or a file or image the body references, does not exist (
`"Product 4 not found."`
).
- **500 Internal Server Error**
 — Unexpected technical error.

## Example
**Request:**

```http
POST /Variants HTTP/1.1
X-API-KEY: your-api-key-here
Accept-Language: en-US
Content-Type: application/json
            
{
  "frmt_ref": "SKU-001-RED-M",
  "prod_id": 456
}
```
**Response:**

```http
HTTP/1.1 201 Created
Location: /Variants(789)
```

Endpoint: POST /Variants
Version: 2.0.0

## Description:

  - `Authentication` ()
    Requires a valid API key in the `X-API-KEY` header.

  - `Headers` ()

  - `Accept-Language` ()
    Culture used to interpret the localized field values supplied in the request body. - **omitted / null**
: tenant's default culture.
- **culture-code**
 (e.g.
`en-US`
,
`es`
): the specified culture.

  - `Request Body` ()
    A single JSON object whose properties match the writable fields published by
`/Variants/$metadata`. The body is normalized before reaching the application layer: - Must be a non-empty JSON object.
- A JSON array is accepted only if it contains exactly one element.
- Values are coerced to CLR primitives (
`string`
,
`long`
,
`double`
,
`bool`
,
`null`
),

nested objects and arrays.
- A date attribute is a date and time with no time zone, stored and returned as written

(
`"frmt_date": "2026-10-21T16:22:00"`
). A value with
`Z`
 or an offset (
`2026-10-21T14:22:00Z`
) is converted to

its date and time in Spain (Europe/Madrid), the time the app shows (
`2026-10-21T16:22:00`
). System dates (
`_creation`
,
`_modify`
) are set by the service.

  - `Response` ()
    **201 Created** — The `Location` header points to the new resource: `/Variants({id})`.
No response body.

  - `Error Responses` ()
    - **400 Bad Request**
 — The body cannot be written: empty, an array of more than one

object, an attribute the entity does not have, one that cannot be assigned or a value the

attribute does not take. Answered as a message naming why, a JSON string

(
`"Value: ZZ not allowed"`
,
`"Invalid attribute name: nope_field"`
).
- **401 Unauthorized**
 — Missing or invalid API key. Returned by the API gateway as

`{ "message": "Unauthorized", "request_id": "d8aafa5b8f3e400b60bea0123dd33317" }`
.
- **403 Forbidden**
 — The API key does not have write permissions for this operation.
- **404 Not Found**
 — The product, or a file or image the body references, does not exist (
`"Product 4 not found."`
).
- **500 Internal Server Error**
 — Unexpected technical error.

  - `Example` ()
    **Request:** ```http
POST /Variants HTTP/1.1
X-API-KEY: your-api-key-here
Accept-Language: en-US
Content-Type: application/json
            
{
  "frmt_ref": "SKU-001-RED-M",
  "prod_id": 456
}
``` **Response:** ```http
HTTP/1.1 201 Created
Location: /Variants(789)
```

## Header parameters:

  - `X-API-KEY` (string)
    Tenant's API key (required)

  - `Accept-Language` (string)
    Culture for localized field values in the request body (Accept-Language header)

## Request body:

  - `application/json` (unknown)
    JSON object with the Variant fields to create

## Response 201:

  - `201` (unknown)
    Created

## Response 201 headers:

  - `Location` (string)
    URL of the created resource. Its identifier is the number in the last parentheses: `…/Products(46)` → `46`.

## Response 400:

  - `400` (unknown)
    Bad Request

## Response 400 fields (application/json):

  - `validationFailures` (object)

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `message` (string)

  - `request_id` (string)

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `message` (string)

  - `request_id` (string)

## Response 404:

  - `404` (unknown)
    Not Found

## Response 404 fields (application/json):

  - `type` (string)

  - `title` (string)

  - `status` (integer)

  - `detail` (string)

  - `instance` (string)

## Response 500:

  - `500` (unknown)
    Internal Server Error

## Response 500 fields (application/json):

  - `error` (string)

  - `details` (any)

## Response 400 examples:

  - `A status the variant cannot take (frmt_stat: "ZZ")` (unknown)

  - `An attribute the variant does not have` (unknown)

  - `An attribute the service sets itself` (unknown)

  - `A reference another variant already has` (unknown)

  - `An empty body` (unknown)

