Commercial Units Developer API commercialunits.com →

Authentication

Every request to the developer API must carry an API key in the Authorization header as a Bearer token.

Authorization: Bearer sg_live_3f9aK2pLqWzXyR7vT1mN8cD4

Creating an API key

  1. Sign in to your Commercial Units dashboard.
  2. Go to Settings → Developer.
  3. Click Create API key, give it a label (e.g. "Company website"), and create it.
  4. Copy the key now. It is shown once, at creation time, and never again.

Store it securely. We only keep a hash of your key — we cannot show it to you again, and we cannot recover it. Treat it like a password: keep it in a secret manager or server-side environment variable, never commit it to a public repo, and never expose a live key in client-side code you don't control. If a key is lost or leaked, revoke it in Settings → Developer and create a new one.

You can hold multiple keys at once (e.g. one per website, or one to rotate in while retiring another). Revoking a key takes effect immediately.

The key format: country-prefixed

Keys look like this:

sg_live_3f9aK2pLqWzXyR7vT1mN8cD4
└┘ └──┘ └──────────────────────┘
│   │            └─ the secret (random, opaque)
│   └────────────── environment: always "live"
└────────────────── country prefix (lowercase country code)

The country prefix is the lowercase Commercial Units country code for the country your organisation operates in. The prefix is meaningful — it routes the request to that country's API and data. A sg_live_… key only ever sees Singapore listings; a my_live_… key only ever sees Malaysia listings.

PrefixCountryPrefixCountry
sg_Singaporeus_United States
my_Malaysiaca_Canada
uk_United Kingdomau_Australia
in_Indianz_New Zealand

If you operate in more than one country, create one key per country from the dashboard for that country's account. There is no single "all-countries" key — per-country isolation is by design.

Sending the key

Pass the key as a Bearer token on every request:

curl https://api.commercialunits.com/v1/listings \
  -H "Authorization: Bearer sg_live_3f9aK2pLqWzXyR7vT1mN8cD4"
fetch('https://api.commercialunits.com/v1/listings', {
  headers: { Authorization: 'Bearer sg_live_3f9aK2pLqWzXyR7vT1mN8cD4' },
});

What can go wrong

StatusMeaningFix
401 UnauthorizedMissing, malformed, revoked, or unknown keyCheck the header is Authorization: Bearer <key> and the key is current
403 ForbiddenKey is valid but the request's Origin isn't on your allow-listAdd your site's origin in Settings → Developer (see CORS & Embedding)

See Rate Limits & Errors for the full error reference.