Create Product Attribute Value
Creates a new attribute value
HTTP Request
POST/api/products/attributes/:attr_id/values
Authorization
Authorization
- Required: Yes
- Permission: Staff with AttributeValuePermission or Admin
- Permission Code: 1831
- Authentication: Token-based (Authorization: Token <your_api_key>)
| Parameter | Type | Required | Description |
|---|---|---|---|
| attr_id | Integer | Yes | Unique ID of the attribute |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| value | String | Yes | Name of the value (unique over the attribute) |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3url = "http://www.example.com/api/products/attributes/1/values"
4headers = {
5 "Authorization": "Token <your_api_key>",
6 "Content-Type": "application/json"
7}
8data = {
9 "value": "brown"
10}
11response = requests.post(url, headers=headers, json=data)
12
13print(response.json())1# Create a new product attribute
2curl -X POST "http://www.example.com/api/products/attributes/1/values" \
3-H "Authorization: Token <your_api_key>" \
4-H "Content-Type: application/json" \
5-d '{
6 "value": "brown",
7}'Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the attribute value |
| value | String | The value name (unique over the attribute) |
| created_at | String (ISO 8601) | Timestamp when attribute value was created |
| updated_at | String (ISO 8601) | Timestamp when attribute value was last updated |
Example Response
{
"id": 10,
"value": "brown",
"created_at": "2025-12-24T16:38:42.699563Z",
"updated_at": "2025-12-24T16:38:42.699570Z"
}
Notes
- The value should be unique over the attribute, meaning an attribute names
shoe_sizecan not have two values of32but the value32can be used for attributesshoe_sizeandjeans_size.