Skip to main content
POST
/
api
/
sites
Create a site
curl --request POST \
  --url https://clarus-api.com/api/sites \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Clarus-Subdomain: <api-key>' \
  --data '
{
  "data": {
    "type": "sites",
    "attributes": {
      "code": "SITE-NORTH",
      "name": "Northern Distribution Centre",
      "tier": "upper"
    }
  }
}
'
{
  "data": {
    "id": "4",
    "type": "sites",
    "attributes": {
      "code": "SITE-NORTH",
      "name": "Northern Distribution Centre",
      "tier": "upper",
      "default": false
    }
  }
}

Request Structure

{
  "data": {
    "type": "sites",
    "attributes": {
      "code": "SITE-NORTH",
      "name": "Northern Distribution Centre",
      "tier": "upper"
    }
  }
}

Key Fields

FieldRequiredDescription
codeYesUnique site code (max 50)
nameYesSite display name (max 50)
defaultNoWhether this is the default site
tierNoOne of none, lower, upper
Sites also support custom fields (string1string5, integer1integer5, boolean1boolean5, datetime1datetime5) and a nested address.

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

Site created successfully

data
object