New: Landing Page BuilderCheck it out
Skip to content

Authentication

Base URL, the affinix-api-key header and rotating keys without downtime.

Base URL

Every brand has its own base URL on its tracking domain. Calls to one brand’s domain only ever affect that brand.

Base URL
https://go.yourbrand.com/api/v1

Send JSON with Content-Type: application/json, over HTTPS only. Request bodies can be up to 20 MB.

API key

Authenticate every call with the brand’s API key in the affinix-api-key header.

Header
affinix-api-key: <your brand's API key>
  • Keys are per brand. Use each brand’s own key with its own base URL.
  • Affinix stores only a hash of the key, so it cannot show it again. If it is lost, rotate it.
  • Call the API from your servers only. Never put the key in a browser, app or public repository.

A missing or wrong key returns 401 with {"error":"Unauthorized"}. A request to a domain that is not a tracking domain returns 404 with {"error":"Unknown site"}.

Rotating a key without downtime

  1. 1

    Rotate in the console

    On the brand’s Connection page choose Rotate key and copy the new key.
  2. 2

    Deploy the new key

    The previous key keeps working for 24 hours, so you can update your platform at a convenient time.
  3. 3

    Revoke the old key

    Once Monitoring shows calls with the new key, revoke the previous one, or let it expire after 24 hours.
If a key may have leaked, rotate it and revoke the previous key straight away instead of waiting for it to expire.

Stuck? Email hello@affinix360.com with your brand name and the time of the call.