Skip to main content
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
    }
  }
}
'
{
  "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
    }
  }
}

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

FieldRequiredDescription
codeYesAlternative code value (max 50, unique per parent + owner)
nameYesDisplay name (max 50)
alternative_code_type_idYesCategory (AlternativeCodeType)
alternative_codeable_type / _idNoParent record — one of Product, Supplier, Carrier, Warehouse
owner_type / owner_idNoOwning record; must be a different class than the parent

Authorizations

Authorization
string
header
required

OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.

X-Clarus-Subdomain
string
header
required

The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.

Body

application/json
data
object
required

Response

Created successfully

data
object