Skip to content

Attributes ​

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 attributes ​

GET /admin/api/v1/products/attributes

Retrieve a paginated list of attributes with filtering and sorting

🔒 Requires a valid Bearer token.

Query parameters

ParameterTypeRequiredDescriptionExample
includestringNoComma-separated list of relationships to include. Available options: options, creatoroptions
filter[id]stringNoComma-separated list of IDs to filter by
filter[name]stringNoFilter by attribute name (partial match)
filter[type]stringNoFilter by attribute type
filter[trashed]stringNoFilter by trashed status: "with" (include trashed), "only" (only trashed), or any other value for non-trashed onlywith
sortstringYesSort fieldsort
pageintegerYesPage number1
bash
curl -X GET "https://your-domain.com/admin/api/v1/products/attributes?include=options&filter%5Btrashed%5D=with&sort=sort&page=1" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes?include=options&filter%5Btrashed%5D=with&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
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://your-domain.com/admin/api/v1/products/attributes?include=options&filter%5Btrashed%5D=with&sort=sort&page=1', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/products/attributes?include=options&filter%5Btrashed%5D=with&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

json
{
  "data": [
    {
      "id": null,
      "name": "Jessyca Ernser",
      "type": "radio",
      "sort": 24634,
      "creator_id": 1,
      "created_at": null,
      "updated_at": null,
      "deleted_at": null
    },
    {
      "id": null,
      "name": "Juvenal Donnelly DVM",
      "type": "radio",
      "sort": 6339,
      "creator_id": 1,
      "created_at": null,
      "updated_at": null,
      "deleted_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": "&laquo; Previous",
        "page": null,
        "active": false
      },
      {
        "url": "/?page=1",
        "label": "1",
        "page": 1,
        "active": true
      },
      {
        "url": null,
        "label": "Next &raquo;",
        "page": null,
        "active": false
      }
    ],
    "path": "/",
    "per_page": 10,
    "to": 2,
    "total": 2
  }
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Create attribute ​

POST /admin/api/v1/products/attributes

Create a new product attribute

🔒 Requires a valid Bearer token.

Body parameters

ParameterTypeRequiredDescription
namestringYesAttribute name (max 255 characters). Must not be greater than 255 characters.
typestringYesAttribute type: radio, select, or color.
sortintegerNoSort order (minimum 0). Must be at least 0.
bash
curl -X POST "https://your-domain.com/admin/api/v1/products/attributes" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Size",
  "type": "select",
  "sort": 1
}'
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes", {
  method: "POST",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "name": "Size",
  "type": "select",
  "sort": 1
}),
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your-domain.com/admin/api/v1/products/attributes', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    'json' => [
    'name' => 'Size',
    'type' => 'select',
    'sort' => 1,
  ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/products/attributes"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

payload = {
    "name": "Size",
    "type": "select",
    "sort": 1,
}

response = requests.post(url, headers=headers, json=payload)

data = response.json()
print(data)

Example response 201

json
{
  "data": {
    "id": null,
    "name": "Ms. Audra Crooks II",
    "type": "radio",
    "sort": 73089432,
    "creator_id": 1,
    "created_at": null,
    "updated_at": null,
    "deleted_at": null
  },
  "message": "Attribute created successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Show attribute ​

GET /admin/api/v1/products/attributes/{id}

Retrieve a specific attribute by its ID

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe attribute ID

Query parameters

ParameterTypeRequiredDescriptionExample
includestringNoComma-separated list of relationships to include. Available options: options, creatoroptions
bash
curl -X GET "https://your-domain.com/admin/api/v1/products/attributes/{id}?include=options" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{id}?include=options", {
  method: "GET",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://your-domain.com/admin/api/v1/products/attributes/{id}?include=options', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/products/attributes/{id}?include=options"

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

json
{
  "data": {
    "id": null,
    "name": "Morgan Hirthe",
    "type": "radio",
    "sort": 1031881,
    "creator_id": 1,
    "created_at": null,
    "updated_at": null,
    "deleted_at": null
  }
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Update attribute ​

PUT /admin/api/v1/products/attributes/{id}

Update an existing attribute

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe attribute ID

Body parameters

ParameterTypeRequiredDescription
namestringNoAttribute name (max 255 characters). Must not be greater than 255 characters.
typestringNoAttribute type: radio, select, or color.
sortintegerNoSort order (minimum 0). Must be at least 0.
bash
curl -X PUT "https://your-domain.com/admin/api/v1/products/attributes/{id}" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Size",
  "type": "select",
  "sort": 1
}'
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{id}", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "name": "Size",
  "type": "select",
  "sort": 1
}),
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://your-domain.com/admin/api/v1/products/attributes/{id}', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    'json' => [
    'name' => 'Size',
    'type' => 'select',
    'sort' => 1,
  ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/products/attributes/{id}"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

payload = {
    "name": "Size",
    "type": "select",
    "sort": 1,
}

response = requests.put(url, headers=headers, json=payload)

data = response.json()
print(data)

Example response 200

json
{
  "data": {
    "id": null,
    "name": "Ms. Audra Crooks II",
    "type": "radio",
    "sort": 73089432,
    "creator_id": 1,
    "created_at": null,
    "updated_at": null,
    "deleted_at": null
  },
  "message": "Attribute updated successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Delete attribute ​

DELETE /admin/api/v1/products/attributes/{id}

Soft delete an attribute

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe attribute ID
bash
curl -X DELETE "https://your-domain.com/admin/api/v1/products/attributes/{id}" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{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
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://your-domain.com/admin/api/v1/products/attributes/{id}', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/products/attributes/{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

json
{
  "message": "Attribute deleted successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Restore attribute ​

POST /admin/api/v1/products/attributes/{id}/restore

Restore a soft-deleted attribute

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe attribute ID
bash
curl -X POST "https://your-domain.com/admin/api/v1/products/attributes/{id}/restore" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{id}/restore", {
  method: "POST",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your-domain.com/admin/api/v1/products/attributes/{id}/restore', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/products/attributes/{id}/restore"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

response = requests.post(url, headers=headers)

data = response.json()
print(data)

Example response 200

json
{
  "data": {
    "id": null,
    "name": "Morgan Hirthe",
    "type": "radio",
    "sort": 1031881,
    "creator_id": 1,
    "created_at": null,
    "updated_at": null,
    "deleted_at": null
  },
  "message": "Attribute restored successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Force delete attribute ​

DELETE /admin/api/v1/products/attributes/{id}/force

Permanently delete an attribute (cannot be restored)

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe attribute ID
bash
curl -X DELETE "https://your-domain.com/admin/api/v1/products/attributes/{id}/force" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/products/attributes/{id}/force", {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://your-domain.com/admin/api/v1/products/attributes/{id}/force', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/products/attributes/{id}/force"

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

json
{
  "message": "Attribute permanently deleted."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Released under the MIT License.