For AI agents: markdown of this page — /docs-content-en/entities/basket-item-properties/create.md documentation index — /llms.txt
Create a basket item property
POST /v1/basket-item-properties
Creates a property on an existing basket item to store additional information about the product.
Request body fields
Pass fields at the root of the JSON body, without a fields wrapper.
| Field | Type | Required | Description |
|---|---|---|---|
FieldbasketId |
Typenumber | Requiredyes | DescriptionBasket item ID. Source: GET /v1/basket-items |
Fieldname |
Typestring | Requiredyes | DescriptionProperty name |
Fieldvalue |
Typestring | null | Requiredyes | DescriptionProperty value. Creation rejects null and an empty string |
Fieldcode |
Typestring | null | Requiredyes | DescriptionProperty symbolic code. Creation rejects null and an empty string |
Fieldsort |
Typenumber | Requiredno | DescriptionSort order |
FieldxmlId |
Typestring | null | Requiredno | DescriptionExternal ID |
Fieldid |
Typenumber | Requiredno | DescriptionProperty ID. Source: GET /v1/basket-item-properties. RO. Read-only, assigned by the server. |
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/basket-item-properties" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"basketId": 1001,
"name": "Color",
"value": "Blue",
"code": "COLOR",
"sort": 100
}'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/basket-item-properties" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"basketId": 1001,
"name": "Color",
"value": "Blue",
"code": "COLOR",
"sort": 100
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/basket-item-properties', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"basketId": 1001,
"name": "Color",
"value": "Blue",
"code": "COLOR",
"sort": 100
}),
})
const { success, data } = await res.json()
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/basket-item-properties', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"basketId": 1001,
"name": "Color",
"value": "Blue",
"code": "COLOR",
"sort": 100
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on success. HTTP status: 201 |
Fielddata |
Typeobject | DescriptionCreated basket item property |
Fielddata.id |
Typenumber | DescriptionProperty ID. Source: GET /v1/basket-item-properties |
Fielddata.basketId |
Typenumber | DescriptionBasket item ID. Source: GET /v1/basket-items |
Fielddata.name |
Typestring | DescriptionProperty name |
Fielddata.value |
Typestring | null | DescriptionProperty value |
Fielddata.code |
Typestring | null | DescriptionProperty symbolic code |
Fielddata.sort |
Typenumber | DescriptionSort order |
Fielddata.xmlId |
Typestring | null | DescriptionExternal ID |
Response example
{
"success": true,
"data": {
"basketId": 1001,
"code": "COLOR",
"id": 1037,
"name": "Color",
"sort": 100,
"value": "Blue",
"xmlId": "bx_6acd18b609cf1"
}
}
Error response example
400 — the required code field is missing:
{
"success": false,
"error": {
"code": "MISSING_REQUIRED_FIELDS",
"message": "Body field \"code\" is required to create basketItemProperty."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeMISSING_REQUIRED_FIELDS |
DescriptionA required field basketId, name, value or code is missing or null. The name, value or code field is an empty string |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionAn empty or nonnumeric string was supplied in basketId |
| HTTP400 | CodeREADONLY_FIELD |
DescriptionThe read-only id field was supplied |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionThe specified basket item was not found |
| HTTP415 | CodeFST_ERR_CTP_INVALID_MEDIA_TYPE |
DescriptionAn unsupported content type was supplied, such as application/xml |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 rejected the operation. The reason is in message |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is in read-only mode |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe API key does not have the sale scope |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
| HTTP429 | CodeRATE_LIMITED |
DescriptionThe request limit was exceeded |
For the full list of shared API errors, see Error codes.