# addCartItem

Source: <https://telegafirst.com/docs/api-op-addcartitem>
Locale: ru
releaseGitSha: ea133cd4ad87fe549ef000b139be145be9bd1717
sourceContentDigest: a7e453c644fee2e6d3663c9760313c74126170405bfbb39b6a2e1bdc1886cb61
Version: 2

# addCartItem

`POST /api/v1/carts/{code}/items`

addCartItem

## Авторизация и права

Scopes: ALL. Auth alternatives: OR; scopes внутри альтернативы: ALL.

| Поле | Значение |
| - | - |
| security.0.hubApiKey | \[] |
| security.1.hubBearer | \[] |
| securitySchemes.hubApiKey.in | "header" |
| securitySchemes.hubApiKey.name | "X-Api-Key" |
| securitySchemes.hubApiKey.type | "apiKey" |
| securitySchemes.hubBearer.scheme | "bearer" |
| securitySchemes.hubBearer.type | "http" |
| x-required-scopes | \["orders"] |

## Параметры запроса

| Поле | Значение |
| - | - |
| 0.in | "path" |
| 0.name | "code" |
| 0.required | true |
| 0.schema | [0.schema](https://telegafirst.com/docs/schema-46feeaff5156934ff5aa18bda9501891f2b15e520703af2ac60c0fa351d0127d) |
| 1.in | "header" |
| 1.name | "If-Match" |
| 1.required | true |
| 1.schema | [1.schema](https://telegafirst.com/docs/schema-c368c9e6d62cd43841854a0c6b6f706bca622d6fb3feae05cb9569025bbfe2d8) |
| 2.in | "header" |
| 2.name | "Idempotency-Key" |
| 2.required | true |
| 2.schema | [2.schema](https://telegafirst.com/docs/schema-9ac136edb99a2063b3091602181c8d2022fdccb5b514991319d58544c2e57e95) |

## Тело запроса

| Поле | Значение |
| - | - |
| content.application/json.schema | [AddCartItemRequest](https://telegafirst.com/docs/schema-573df402b71c1a2aca8cf2317b4ac71b8dbf89b8984b1c9bc6a17e309a0ef51c) |
| required | true |

## Ответы

| Поле | Значение |
| - | - |
| 200.content.application/json.schema | [CartProjection](https://telegafirst.com/docs/schema-14c8c8839d36ba8567ab99849fc8eb9e0980131dd606d30149dcb62f8e8a529b) |
| 200.description | "Line added or a canonical equal line increased" |
| 200.headers.ETag.description | "Strong Cart composition validator" |
| 200.headers.ETag.required | true |
| 200.headers.ETag.schema | [200.headers.ETag.schema](https://telegafirst.com/docs/schema-c368c9e6d62cd43841854a0c6b6f706bca622d6fb3feae05cb9569025bbfe2d8) |

## Ошибки

| Поле | Значение |
| - | - |
| 400.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-c4113f3de00d728702a8663612e2074cbe3e8b3bb70d2b0dee6f3503fe89bd41) |
| 400.description | "Idempotency-Key is absent or If-Match is malformed" |
| 400.x-error-codes | \["IDEMPOTENCY\_KEY\_REQUIRED","MALFORMED\_IF\_MATCH"] |
| 401.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-c4113f3de00d728702a8663612e2074cbe3e8b3bb70d2b0dee6f3503fe89bd41) |
| 401.description | "Missing, invalid, revoked, or expired Hub credential" |
| 401.x-error-codes | \["INVALID\_API\_KEY","INVALID\_JWT"] |
| 403.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-c4113f3de00d728702a8663612e2074cbe3e8b3bb70d2b0dee6f3503fe89bd41) |
| 403.description | "The authenticated credential lacks the required Cart operation scope" |
| 403.x-error-codes | \["INSUFFICIENT\_SCOPE"] |
| 404.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-c4113f3de00d728702a8663612e2074cbe3e8b3bb70d2b0dee6f3503fe89bd41) |
| 404.description | "Cart is unknown or belongs to a different tenant" |
| 409.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-c4113f3de00d728702a8663612e2074cbe3e8b3bb70d2b0dee6f3503fe89bd41) |
| 409.description | "Cart is inactive or the idempotency request hash differs" |
| 409.x-error-codes | \["CART\_INACTIVE","IDEMPOTENCY\_KEY\_MISMATCH"] |
| 412.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-c4113f3de00d728702a8663612e2074cbe3e8b3bb70d2b0dee6f3503fe89bd41) |
| 412.description | "If-Match does not match the current Cart revision" |
| 412.headers.ETag.description | "Strong Cart composition validator" |
| 412.headers.ETag.required | true |
| 412.headers.ETag.schema | [412.headers.ETag.schema](https://telegafirst.com/docs/schema-c368c9e6d62cd43841854a0c6b6f706bca622d6fb3feae05cb9569025bbfe2d8) |
| 422.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-c4113f3de00d728702a8663612e2074cbe3e8b3bb70d2b0dee6f3503fe89bd41) |
| 422.description | "Cart item is not purchasable or violates Cart business rules" |
| 428.content.application/problem+json.schema | [ProblemDetails](https://telegafirst.com/docs/schema-c4113f3de00d728702a8663612e2074cbe3e8b3bb70d2b0dee6f3503fe89bd41) |
| 428.description | "If-Match and Idempotency-Key are required" |
| 428.x-error-codes | \["ETAG\_REQUIRED","PRICING\_QUOTE\_REQUIRED"] |

## Дополнительные условия

| Поле | Значение |
| - | - |
| operationId | "addCartItem" |
| tags | \["Carts"] |
| x-idempotency | "none" |
| x-idempotency-boundary.implementation | "cart-local-durable-receipt" |
| x-idempotency-boundary.rationale | "Cart owns the transaction-atomic replay result; the global 24-hour interceptor must not shadow its receipt or change its conflict semantics." |
| x-idempotency-boundary.skip\_global\_interceptor | true |
