Attribute Options
Part of the Products API. Base URL https://your-domain.com/admin/api/v1 — replace the host with your own installation and the token placeholder with a real Bearer token (see Authentication).
List attribute options
GET/admin/api/v1/products/attributes/{attribute_id}/optionsRetrieve a paginated list of attribute options for a specific attribute with filtering and sorting
🔒 Requires a valid Bearer token.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
attribute_id | integer | Yes | The attribute ID |
Query parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
include | string | No | Comma-separated list of relationships to include. Available options: creator | attribute |
filter[id] | string | No | Comma-separated list of IDs to filter by | |
filter[name] | string | No | Filter by option name (partial match) | |
sort | string | Yes | Sort field | sort |
page | integer | Yes | Page number | 1 |
curl -X GET "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options?include=attribute&sort=sort&page=1" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options?include=attribute&sort=sort&page=1", {
method: "GET",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options?include=attribute&sort=sort&page=1', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options?include=attribute&sort=sort&page=1"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)Example response 200
{
"data": [
{
"id": null,
"name": "Morgan Hirthe",
"color": null,
"extra_price": 60.53,
"sort": 1031881,
"attribute_id": 1,
"created_at": null,
"updated_at": null
},
{
"id": null,
"name": "Miss Marianna Predovic",
"color": null,
"extra_price": 49.28,
"sort": 5066,
"attribute_id": 2,
"created_at": null,
"updated_at": null
}
],
"links": {
"first": "/?page=1",
"last": "/?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"page": null,
"active": false
},
{
"url": "/?page=1",
"label": "1",
"page": 1,
"active": true
},
{
"url": null,
"label": "Next »",
"page": null,
"active": false
}
],
"path": "/",
"per_page": 10,
"to": 2,
"total": 2
}
}Error response — 401
{
"message": "Unauthenticated."
}Create attribute option
POST/admin/api/v1/products/attributes/{attribute_id}/optionsCreate a new option for a specific attribute
🔒 Requires a valid Bearer token.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
attribute_id | integer | Yes | The attribute ID |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Option name (max 255 characters). Must not be greater than 255 characters. |
color | string | No | Option color in hex format (max 7 characters). Must not be greater than 7 characters. |
extra_price | number | No | Additional price for this option (minimum 0). Must be at least 0. |
sort | integer | No | Sort order (minimum 0). Must be at least 0. |
curl -X POST "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Large",
"color": "#FF5733",
"extra_price": 10.5,
"sort": 1
}'const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options", {
method: "POST",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Large",
"color": "#FF5733",
"extra_price": 10.5,
"sort": 1
}),
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'name' => 'Large',
'color' => '#FF5733',
'extra_price' => 10.5,
'sort' => 1,
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
payload = {
"name": "Large",
"color": "#FF5733",
"extra_price": 10.5,
"sort": 1,
}
response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data)Example response 201
{
"data": {
"id": null,
"name": "Ms. Audra Crooks II",
"color": null,
"extra_price": 54.27,
"sort": 73089432,
"attribute_id": 3,
"created_at": null,
"updated_at": null
},
"message": "Attribute option created successfully."
}Error response — 401
{
"message": "Unauthenticated."
}Show attribute option
GET/admin/api/v1/products/attributes/{attribute_id}/options/{id}Retrieve a specific attribute option by its ID
🔒 Requires a valid Bearer token.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
attribute_id | integer | Yes | The attribute ID |
id | integer | Yes | The attribute option ID |
Query parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
include | string | No | Comma-separated list of relationships to include. Available options: creator | attribute |
curl -X GET "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}?include=attribute" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}?include=attribute", {
method: "GET",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}?include=attribute', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}?include=attribute"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)Example response 200
{
"data": {
"id": null,
"name": "Morgan Hirthe",
"color": null,
"extra_price": 60.53,
"sort": 1031881,
"attribute_id": 4,
"created_at": null,
"updated_at": null
}
}Error response — 401
{
"message": "Unauthenticated."
}Update attribute option
PUT/admin/api/v1/products/attributes/{attribute_id}/options/{id}Update an existing attribute option
🔒 Requires a valid Bearer token.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
attribute_id | integer | Yes | The attribute ID |
id | integer | Yes | The attribute option ID |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Option name (max 255 characters). Must not be greater than 255 characters. |
color | string | No | Option color in hex format (max 7 characters). Must not be greater than 7 characters. |
extra_price | number | No | Additional price for this option (minimum 0). Must be at least 0. |
sort | integer | No | Sort order (minimum 0). Must be at least 0. |
curl -X PUT "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Large",
"color": "#FF5733",
"extra_price": 10.5,
"sort": 1
}'const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}", {
method: "PUT",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Large",
"color": "#FF5733",
"extra_price": 10.5,
"sort": 1
}),
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'name' => 'Large',
'color' => '#FF5733',
'extra_price' => 10.5,
'sort' => 1,
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
payload = {
"name": "Large",
"color": "#FF5733",
"extra_price": 10.5,
"sort": 1,
}
response = requests.put(url, headers=headers, json=payload)
data = response.json()
print(data)Example response 200
{
"data": {
"id": null,
"name": "Ms. Audra Crooks II",
"color": null,
"extra_price": 54.27,
"sort": 73089432,
"attribute_id": 5,
"created_at": null,
"updated_at": null
},
"message": "Attribute option updated successfully."
}Error response — 401
{
"message": "Unauthenticated."
}Delete attribute option
DELETE/admin/api/v1/products/attributes/{attribute_id}/options/{id}Delete an attribute option
🔒 Requires a valid Bearer token.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
attribute_id | integer | Yes | The attribute ID |
id | integer | Yes | The attribute option ID |
curl -X DELETE "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}", {
method: "DELETE",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/products/attributes/{attribute_id}/options/{id}"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
response = requests.delete(url, headers=headers)
data = response.json()
print(data)Example response 200
{
"message": "Attribute option deleted successfully."
}Error response — 401
{
"message": "Unauthenticated."
}