Skip to content

Product Variants ​

Part of the Accounts 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 product variants ​

GET /admin/api/v1/accounts/products/{product_id}/variants

Retrieve a paginated list of variants for a specific product

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
product_idintegerYesThe product ID

Query parameters

ParameterTypeRequiredDescriptionExample
includestringNoComma-separated list of relationships to include. Available options: parent, uom, uomPO, category, tags, attributes, attribute_values, company, creator, propertyAccountIncome, propertyAccountExpenseattributes
filter[id]stringNoComma-separated list of IDs to filter by
filter[type]stringNoFilter by product type
filter[enable_sales]booleanNoFilter by sales enabledtrue
filter[enable_purchase]booleanNoFilter by purchase enabledfalse
filter[category_id]stringNoComma-separated list of category IDs to filter by
filter[trashed]stringNoFilter by trashed status: "with" (include trashed), "only" (only trashed), or any other value for non-trashed onlywith
sortstringYesSort field-created_at
pageintegerYesPage number1
bash
curl -X GET "https://your-domain.com/admin/api/v1/accounts/products/{product_id}/variants?include=attributes&filter%5Benable_sales%5D=true&filter%5Benable_purchase%5D=false&filter%5Btrashed%5D=with&sort=-created_at&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/accounts/products/{product_id}/variants?include=attributes&filter%5Benable_sales%5D=true&filter%5Benable_purchase%5D=false&filter%5Btrashed%5D=with&sort=-created_at&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/accounts/products/{product_id}/variants?include=attributes&filter%5Benable_sales%5D=true&filter%5Benable_purchase%5D=false&filter%5Btrashed%5D=with&sort=-created_at&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/accounts/products/{product_id}/variants?include=attributes&filter%5Benable_sales%5D=true&filter%5Benable_purchase%5D=false&filter%5Btrashed%5D=with&sort=-created_at&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": 1,
      "type": "goods",
      "name": "T-Shirt",
      "service_tracking": "none",
      "reference": null,
      "barcode": null,
      "price": 250,
      "cost": 220,
      "volume": 2501,
      "weight": 1,
      "description": "<p>Men&#039;s wear tshirt in multiple variant colors like that tell me.</p>",
      "description_purchase": null,
      "description_sale": null,
      "enable_sales": false,
      "enable_purchase": false,
      "is_favorite": false,
      "is_configurable": false,
      "images": [
        "01M4G1WMQZ0T9EBB2F6CERDFTV.jpg"
      ],
      "sort": 1,
      "parent_id": null,
      "uom_id": 1,
      "uom_po_id": 1,
      "category_id": 1,
      "creator_id": 1,
      "company_id": 1,
      "created_at": "2026-10-09T10:03:40.000000Z",
      "updated_at": "2026-10-09T10:41:57.000000Z",
      "deleted_at": null,
      "property_account_income_id": 27,
      "property_account_expense_id": 33,
      "image": null,
      "service_type": null,
      "sale_line_warn": "no-message",
      "expense_policy": null,
      "invoice_policy": "order",
      "sale_line_warn_msg": null,
      "sales_ok": true,
      "purchase_ok": true
    },
    {
      "id": 1,
      "type": "goods",
      "name": "T-Shirt",
      "service_tracking": "none",
      "reference": null,
      "barcode": null,
      "price": 250,
      "cost": 220,
      "volume": 2501,
      "weight": 1,
      "description": "<p>Men&#039;s wear tshirt in multiple variant colors like that tell me.</p>",
      "description_purchase": null,
      "description_sale": null,
      "enable_sales": false,
      "enable_purchase": false,
      "is_favorite": false,
      "is_configurable": false,
      "images": [
        "01M4G1WMQZ0T9EBB2F6CERDFTV.jpg"
      ],
      "sort": 1,
      "parent_id": null,
      "uom_id": 1,
      "uom_po_id": 1,
      "category_id": 1,
      "creator_id": 1,
      "company_id": 1,
      "created_at": "2026-10-09T10:03:40.000000Z",
      "updated_at": "2026-10-09T10:41:57.000000Z",
      "deleted_at": null,
      "property_account_income_id": 27,
      "property_account_expense_id": 33,
      "image": null,
      "service_type": null,
      "sale_line_warn": "no-message",
      "expense_policy": null,
      "invoice_policy": "order",
      "sale_line_warn_msg": null,
      "sales_ok": true,
      "purchase_ok": true
    }
  ],
  "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."
}

Sync product variants ​

POST /admin/api/v1/accounts/products/{product_id}/variants

Sync variants for a specific product based on attributes

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
product_idintegerYesThe product ID
bash
curl -X POST "https://your-domain.com/admin/api/v1/accounts/products/{product_id}/variants" \
  -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/accounts/products/{product_id}/variants", {
  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/accounts/products/{product_id}/variants', [
    '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/accounts/products/{product_id}/variants"

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 201

json
{
  "data": [
    {
      "id": 1,
      "type": "goods",
      "name": "T-Shirt",
      "service_tracking": "none",
      "reference": null,
      "barcode": null,
      "price": 250,
      "cost": 220,
      "volume": 2501,
      "weight": 1,
      "description": "<p>Men&#039;s wear tshirt in multiple variant colors like that tell me.</p>",
      "description_purchase": null,
      "description_sale": null,
      "enable_sales": false,
      "enable_purchase": false,
      "is_favorite": false,
      "is_configurable": false,
      "images": [
        "01M4G1WMQZ0T9EBB2F6CERDFTV.jpg"
      ],
      "sort": 1,
      "parent_id": null,
      "uom_id": 1,
      "uom_po_id": 1,
      "category_id": 1,
      "creator_id": 1,
      "company_id": 1,
      "created_at": "2026-10-09T10:03:40.000000Z",
      "updated_at": "2026-10-09T10:41:57.000000Z",
      "deleted_at": null,
      "property_account_income_id": 27,
      "property_account_expense_id": 33,
      "image": null,
      "service_type": null,
      "sale_line_warn": "no-message",
      "expense_policy": null,
      "invoice_policy": "order",
      "sale_line_warn_msg": null,
      "sales_ok": true,
      "purchase_ok": true
    },
    {
      "id": 1,
      "type": "goods",
      "name": "T-Shirt",
      "service_tracking": "none",
      "reference": null,
      "barcode": null,
      "price": 250,
      "cost": 220,
      "volume": 2501,
      "weight": 1,
      "description": "<p>Men&#039;s wear tshirt in multiple variant colors like that tell me.</p>",
      "description_purchase": null,
      "description_sale": null,
      "enable_sales": false,
      "enable_purchase": false,
      "is_favorite": false,
      "is_configurable": false,
      "images": [
        "01M4G1WMQZ0T9EBB2F6CERDFTV.jpg"
      ],
      "sort": 1,
      "parent_id": null,
      "uom_id": 1,
      "uom_po_id": 1,
      "category_id": 1,
      "creator_id": 1,
      "company_id": 1,
      "created_at": "2026-10-09T10:03:40.000000Z",
      "updated_at": "2026-10-09T10:41:57.000000Z",
      "deleted_at": null,
      "property_account_income_id": 27,
      "property_account_expense_id": 33,
      "image": null,
      "service_type": null,
      "sale_line_warn": "no-message",
      "expense_policy": null,
      "invoice_policy": "order",
      "sale_line_warn_msg": null,
      "sales_ok": true,
      "purchase_ok": true
    }
  ],
  "message": "Product variants synced successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Show product variant ​

GET /admin/api/v1/accounts/products/{product_id}/variants/{id}

Retrieve a specific product variant by its ID

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
product_idintegerYesThe product ID
idintegerYesThe variant ID

Query parameters

ParameterTypeRequiredDescriptionExample
includestringNoComma-separated list of relationships to include. Available options: parent, uom, uomPO, category, tags, attributes, attribute_values, company, creator, propertyAccountIncome, propertyAccountExpenseattributes
bash
curl -X GET "https://your-domain.com/admin/api/v1/accounts/products/{product_id}/variants/{id}?include=attributes" \
  -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/accounts/products/{product_id}/variants/{id}?include=attributes", {
  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/accounts/products/{product_id}/variants/{id}?include=attributes', [
    '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/accounts/products/{product_id}/variants/{id}?include=attributes"

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": 1,
    "type": "goods",
    "name": "T-Shirt",
    "service_tracking": "none",
    "reference": null,
    "barcode": null,
    "price": 250,
    "cost": 220,
    "volume": 2501,
    "weight": 1,
    "description": "<p>Men&#039;s wear tshirt in multiple variant colors like that tell me.</p>",
    "description_purchase": null,
    "description_sale": null,
    "enable_sales": false,
    "enable_purchase": false,
    "is_favorite": false,
    "is_configurable": false,
    "images": [
      "01M4G1WMQZ0T9EBB2F6CERDFTV.jpg"
    ],
    "sort": 1,
    "parent_id": null,
    "uom_id": 1,
    "uom_po_id": 1,
    "category_id": 1,
    "creator_id": 1,
    "company_id": 1,
    "created_at": "2026-10-09T10:03:40.000000Z",
    "updated_at": "2026-10-09T10:41:57.000000Z",
    "deleted_at": null,
    "property_account_income_id": 27,
    "property_account_expense_id": 33,
    "image": null,
    "service_type": null,
    "sale_line_warn": "no-message",
    "expense_policy": null,
    "invoice_policy": "order",
    "sale_line_warn_msg": null,
    "sales_ok": true,
    "purchase_ok": true
  }
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Update product variant ​

PUT /admin/api/v1/accounts/products/{product_id}/variants/{id}

Update an existing product variant

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
product_idintegerYesThe product ID
idintegerYesThe variant ID

Body parameters

ParameterTypeRequiredDescription
typestringNoProduct type: goods, service, consu (consumable).
namestringNoProduct name (max 255 characters). Must not be greater than 255 characters.
service_trackingstringNoMust not be greater than 255 characters.
referencestringNoInternal reference code (max 255 characters). Must not be greater than 255 characters.
barcodestringNoProduct barcode (max 255 characters). Must not be greater than 255 characters.
pricenumberNoSales price (minimum 0). Must be at least 0.
costnumberNoProduct cost (minimum 0). Must be at least 0.
volumenumberNoProduct volume (min 0, max 99999999999). Must be at least 0. Must not be greater than 99999999999.
weightnumberNoProduct weight (min 0, max 99999999999). Must be at least 0. Must not be greater than 99999999999.
descriptionstringNoProduct description.
description_purchasestringNoPurchase description.
description_salestringNoSales description.
enable_salesbooleanNoWhether this product can be sold.
enable_purchasebooleanNoWhether this product can be purchased.
is_favoritebooleanNoMark this product as favorite.
imagesstring[]No
uom_idintegerNoUnit of measure ID.
uom_po_idintegerNoPurchase unit of measure ID.
category_idintegerNoProduct category ID. Must match an existing stored value.
company_idintegerNoCompany ID this product belongs to.
tagsinteger[]NoMust match an existing stored value.
property_account_income_idintegerNoIncome account ID for this product. Must match an existing stored value.
property_account_expense_idintegerNoExpense account ID for this product. Must match an existing stored value.
imagestringNo
service_typestringNo
sale_line_warnstringNo
expense_policystringNo
invoice_policystringNoInvoice policy: "order" (invoice on order) or "delivery" (invoice on delivery).
sale_line_warn_msgstringNo
sales_okbooleanNoWhether this product can be sold.
purchase_okbooleanNoWhether this product can be purchased.
bash
curl -X PUT "https://your-domain.com/admin/api/v1/accounts/products/{product_id}/variants/{id}" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "goods",
  "name": "Laptop Computer",
  "service_tracking": "b",
  "reference": "PROD-001",
  "barcode": "1234567890",
  "price": 999.99,
  "cost": 750,
  "volume": 0.5,
  "weight": 2.5,
  "description": "High-performance laptop with latest specifications.",
  "description_purchase": "Enterprise laptop for business use.",
  "description_sale": "Perfect for professionals and power users.",
  "enable_sales": true,
  "enable_purchase": true,
  "is_favorite": false,
  "images": [
    "architecto"
  ],
  "uom_id": 1,
  "uom_po_id": 1,
  "category_id": 1,
  "company_id": 1,
  "tags": [
    16
  ],
  "property_account_income_id": 1,
  "property_account_expense_id": 2,
  "image": "architecto",
  "service_type": "architecto",
  "sale_line_warn": "architecto",
  "expense_policy": "architecto",
  "invoice_policy": "order",
  "sale_line_warn_msg": "architecto",
  "sales_ok": true,
  "purchase_ok": true
}'
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/accounts/products/{product_id}/variants/{id}", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "type": "goods",
  "name": "Laptop Computer",
  "service_tracking": "b",
  "reference": "PROD-001",
  "barcode": "1234567890",
  "price": 999.99,
  "cost": 750,
  "volume": 0.5,
  "weight": 2.5,
  "description": "High-performance laptop with latest specifications.",
  "description_purchase": "Enterprise laptop for business use.",
  "description_sale": "Perfect for professionals and power users.",
  "enable_sales": true,
  "enable_purchase": true,
  "is_favorite": false,
  "images": [
    "architecto"
  ],
  "uom_id": 1,
  "uom_po_id": 1,
  "category_id": 1,
  "company_id": 1,
  "tags": [
    16
  ],
  "property_account_income_id": 1,
  "property_account_expense_id": 2,
  "image": "architecto",
  "service_type": "architecto",
  "sale_line_warn": "architecto",
  "expense_policy": "architecto",
  "invoice_policy": "order",
  "sale_line_warn_msg": "architecto",
  "sales_ok": true,
  "purchase_ok": true
}),
});

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/accounts/products/{product_id}/variants/{id}', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    'json' => [
    'type' => 'goods',
    'name' => 'Laptop Computer',
    'service_tracking' => 'b',
    'reference' => 'PROD-001',
    'barcode' => '1234567890',
    'price' => 999.99,
    'cost' => 750,
    'volume' => 0.5,
    'weight' => 2.5,
    'description' => 'High-performance laptop with latest specifications.',
    'description_purchase' => 'Enterprise laptop for business use.',
    'description_sale' => 'Perfect for professionals and power users.',
    'enable_sales' => true,
    'enable_purchase' => true,
    'is_favorite' => false,
    'images' => [
      'architecto',
    ],
    'uom_id' => 1,
    'uom_po_id' => 1,
    'category_id' => 1,
    'company_id' => 1,
    'tags' => [
      16,
    ],
    'property_account_income_id' => 1,
    'property_account_expense_id' => 2,
    'image' => 'architecto',
    'service_type' => 'architecto',
    'sale_line_warn' => 'architecto',
    'expense_policy' => 'architecto',
    'invoice_policy' => 'order',
    'sale_line_warn_msg' => 'architecto',
    'sales_ok' => true,
    'purchase_ok' => true,
  ],
]);

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

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

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

payload = {
    "type": "goods",
    "name": "Laptop Computer",
    "service_tracking": "b",
    "reference": "PROD-001",
    "barcode": "1234567890",
    "price": 999.99,
    "cost": 750,
    "volume": 0.5,
    "weight": 2.5,
    "description": "High-performance laptop with latest specifications.",
    "description_purchase": "Enterprise laptop for business use.",
    "description_sale": "Perfect for professionals and power users.",
    "enable_sales": True,
    "enable_purchase": True,
    "is_favorite": False,
    "images": [
        "architecto",
    ],
    "uom_id": 1,
    "uom_po_id": 1,
    "category_id": 1,
    "company_id": 1,
    "tags": [
        16,
    ],
    "property_account_income_id": 1,
    "property_account_expense_id": 2,
    "image": "architecto",
    "service_type": "architecto",
    "sale_line_warn": "architecto",
    "expense_policy": "architecto",
    "invoice_policy": "order",
    "sale_line_warn_msg": "architecto",
    "sales_ok": True,
    "purchase_ok": True,
}

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

data = response.json()
print(data)

Example response 200

json
{
  "data": {
    "id": 1,
    "type": "goods",
    "name": "T-Shirt",
    "service_tracking": "none",
    "reference": null,
    "barcode": null,
    "price": 250,
    "cost": 220,
    "volume": 2501,
    "weight": 1,
    "description": "<p>Men&#039;s wear tshirt in multiple variant colors like that tell me.</p>",
    "description_purchase": null,
    "description_sale": null,
    "enable_sales": false,
    "enable_purchase": false,
    "is_favorite": false,
    "is_configurable": false,
    "images": [
      "01M4G1WMQZ0T9EBB2F6CERDFTV.jpg"
    ],
    "sort": 1,
    "parent_id": null,
    "uom_id": 1,
    "uom_po_id": 1,
    "category_id": 1,
    "creator_id": 1,
    "company_id": 1,
    "created_at": "2026-10-09T10:03:40.000000Z",
    "updated_at": "2026-10-09T10:41:57.000000Z",
    "deleted_at": null,
    "property_account_income_id": 27,
    "property_account_expense_id": 33,
    "image": null,
    "service_type": null,
    "sale_line_warn": "no-message",
    "expense_policy": null,
    "invoice_policy": "order",
    "sale_line_warn_msg": null,
    "sales_ok": true,
    "purchase_ok": true
  },
  "message": "Product variant updated successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Delete product variant ​

DELETE /admin/api/v1/accounts/products/{product_id}/variants/{id}

Soft delete a product variant

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
product_idintegerYesThe product ID
idintegerYesThe variant ID
bash
curl -X DELETE "https://your-domain.com/admin/api/v1/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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": "Product variant deleted successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Restore product variant ​

POST /admin/api/v1/accounts/products/{product_id}/variants/{id}/restore

Restore a soft-deleted product variant

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
product_idintegerYesThe product ID
idintegerYesThe variant ID
bash
curl -X POST "https://your-domain.com/admin/api/v1/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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": 1,
    "type": "goods",
    "name": "T-Shirt",
    "service_tracking": "none",
    "reference": null,
    "barcode": null,
    "price": 250,
    "cost": 220,
    "volume": 2501,
    "weight": 1,
    "description": "<p>Men&#039;s wear tshirt in multiple variant colors like that tell me.</p>",
    "description_purchase": null,
    "description_sale": null,
    "enable_sales": false,
    "enable_purchase": false,
    "is_favorite": false,
    "is_configurable": false,
    "images": [
      "01M4G1WMQZ0T9EBB2F6CERDFTV.jpg"
    ],
    "sort": 1,
    "parent_id": null,
    "uom_id": 1,
    "uom_po_id": 1,
    "category_id": 1,
    "creator_id": 1,
    "company_id": 1,
    "created_at": "2026-10-09T10:03:40.000000Z",
    "updated_at": "2026-10-09T10:41:57.000000Z",
    "deleted_at": null,
    "property_account_income_id": 27,
    "property_account_expense_id": 33,
    "image": null,
    "service_type": null,
    "sale_line_warn": "no-message",
    "expense_policy": null,
    "invoice_policy": "order",
    "sale_line_warn_msg": null,
    "sales_ok": true,
    "purchase_ok": true
  },
  "message": "Product variant restored successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Force delete product variant ​

DELETE /admin/api/v1/accounts/products/{product_id}/variants/{id}/force

Permanently delete a product variant (cannot be restored)

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
product_idintegerYesThe product ID
idintegerYesThe variant ID
bash
curl -X DELETE "https://your-domain.com/admin/api/v1/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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/accounts/products/{product_id}/variants/{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": "Product variant permanently deleted."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Released under the MIT License.