Create an account-warehouse association
curl --request POST \
--url https://clarus-api.com/api/account_warehouses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "account_warehouses",
"attributes": {
"account_id": 1,
"warehouse_id": 1
}
}
}
'import requests
url = "https://clarus-api.com/api/account_warehouses"
payload = { "data": {
"type": "account_warehouses",
"attributes": {
"account_id": 1,
"warehouse_id": 1
}
} }
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: 'account_warehouses', attributes: {account_id: 1, warehouse_id: 1}}
})
};
fetch('https://clarus-api.com/api/account_warehouses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "1",
"type": "account_warehouses",
"relationships": {
"account": {
"data": {
"id": "1",
"type": "accounts"
}
},
"warehouse": {
"data": {
"id": "1",
"type": "warehouses"
}
}
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Account Warehouses
Create an account-warehouse association
Links an account to a warehouse, allowing the account to operate in that warehouse. The account_id + warehouse_id combination must be unique — duplicates return 422. A nested route alternative exists at /accounts/{account_id}/warehouses.
POST
/
api
/
account_warehouses
Create an account-warehouse association
curl --request POST \
--url https://clarus-api.com/api/account_warehouses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "account_warehouses",
"attributes": {
"account_id": 1,
"warehouse_id": 1
}
}
}
'import requests
url = "https://clarus-api.com/api/account_warehouses"
payload = { "data": {
"type": "account_warehouses",
"attributes": {
"account_id": 1,
"warehouse_id": 1
}
} }
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: 'account_warehouses', attributes: {account_id: 1, warehouse_id: 1}}
})
};
fetch('https://clarus-api.com/api/account_warehouses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "1",
"type": "account_warehouses",
"relationships": {
"account": {
"data": {
"id": "1",
"type": "accounts"
}
},
"warehouse": {
"data": {
"id": "1",
"type": "warehouses"
}
}
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Request Structure
{
"data": {
"type": "account_warehouses",
"attributes": {
"account_id": 1,
"warehouse_id": 1
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
account_id | Yes | The stock account to associate |
warehouse_id | Yes | The warehouse to associate |
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
FlowAuthorization Code
- Authorization URL
- https://clarus-api.com/oauth/authorize
- Token URL
- https://clarus-api.com/oauth/token
FlowClient Credentials
- Token URL
- https://clarus-api.com/oauth/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
Account-warehouse association created successfully
Show child attributes
Show child attributes

