Create an alternative code
curl --request POST \
--url https://clarus-api.com/api/alternative_codes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "alternative_codes",
"attributes": {
"code": "ALT-12345",
"name": "Customer SKU",
"description": "Customer-facing alternate product code",
"alternative_code_type_id": 3,
"alternative_codeable_type": "Product",
"alternative_codeable_id": 42
}
}
}
'import requests
url = "https://clarus-api.com/api/alternative_codes"
payload = { "data": {
"type": "alternative_codes",
"attributes": {
"code": "ALT-12345",
"name": "Customer SKU",
"description": "Customer-facing alternate product code",
"alternative_code_type_id": 3,
"alternative_codeable_type": "Product",
"alternative_codeable_id": 42
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'alternative_codes',
attributes: {
code: 'ALT-12345',
name: 'Customer SKU',
description: 'Customer-facing alternate product code',
alternative_code_type_id: 3,
alternative_codeable_type: 'Product',
alternative_codeable_id: 42
}
}
})
};
fetch('https://clarus-api.com/api/alternative_codes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "88",
"type": "alternative_codes",
"attributes": {
"code": "ALT-12345",
"name": "Customer SKU",
"description": "Customer-facing alternate product code",
"alternative_code_type_id": 3,
"alternative_codeable_type": "Product",
"alternative_codeable_id": 42,
"owner_type": null,
"owner_id": null
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Alternative Codes
Create an alternative code
Create an alternative code — an additional identifier (e.g. customer SKU) attached to a product, supplier, carrier, or warehouse.
POST
/
api
/
alternative_codes
Create an alternative code
curl --request POST \
--url https://clarus-api.com/api/alternative_codes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "alternative_codes",
"attributes": {
"code": "ALT-12345",
"name": "Customer SKU",
"description": "Customer-facing alternate product code",
"alternative_code_type_id": 3,
"alternative_codeable_type": "Product",
"alternative_codeable_id": 42
}
}
}
'import requests
url = "https://clarus-api.com/api/alternative_codes"
payload = { "data": {
"type": "alternative_codes",
"attributes": {
"code": "ALT-12345",
"name": "Customer SKU",
"description": "Customer-facing alternate product code",
"alternative_code_type_id": 3,
"alternative_codeable_type": "Product",
"alternative_codeable_id": 42
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'alternative_codes',
attributes: {
code: 'ALT-12345',
name: 'Customer SKU',
description: 'Customer-facing alternate product code',
alternative_code_type_id: 3,
alternative_codeable_type: 'Product',
alternative_codeable_id: 42
}
}
})
};
fetch('https://clarus-api.com/api/alternative_codes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "88",
"type": "alternative_codes",
"attributes": {
"code": "ALT-12345",
"name": "Customer SKU",
"description": "Customer-facing alternate product code",
"alternative_code_type_id": 3,
"alternative_codeable_type": "Product",
"alternative_codeable_id": 42,
"owner_type": null,
"owner_id": null
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Request Structure
{
"data": {
"type": "alternative_codes",
"attributes": {
"code": "ALT-12345",
"name": "Customer SKU",
"alternative_code_type_id": 3,
"alternative_codeable_type": "Product",
"alternative_codeable_id": 42
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
code | Yes | Alternative code value (max 50, unique per parent + owner) |
name | Yes | Display name (max 50) |
alternative_code_type_id | Yes | Category (AlternativeCodeType) |
alternative_codeable_type / _id | No | Parent record — one of Product, Supplier, Carrier, Warehouse |
owner_type / owner_id | No | Owning record; must be a different class than the parent |
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Body
application/json
Show child attributes
Show child attributes
Response
Created successfully
Show child attributes
Show child attributes
⌘I

