Affinity uses a dedicated credential, separate from any other Future Demand service. Request it via support.future-demand.com.

Getting a credential

  1. Open a ticket at support.future-demand.com requesting Affinity API access.
  2. Specify the environment(s): staging and/or production.
  3. Briefly describe the integration surface (homepage shelf, detail-page “you might also like”, email recommendations, etc.). This helps Future Demand provision the right scope.
You’ll receive a token bound to your partner and the requested environment.

Sending requests

Send the API key on every request. Affinity scopes requests via the key itself — no additional tenant header is required.
curl -s "https://fd-recommender.stg.future-demand.com/<endpoint>" \
  -H "X-API-Key: $AFFINITY_API_KEY"
The exact header name (X-API-Key, Authorization: Bearer ..., etc.) is set when your credential is provisioned — your account contact will confirm the convention for your token.

Token lifecycle

Confirm with your account contact:
  • Expiry — whether the token rotates on a schedule.
  • Refresh — whether there’s a refresh endpoint, or whether you request a new token via support each cycle.
  • Rotation — request a new credential ahead of expiry; both will be honoured during a grace window.

Error responses

Affinity is a FastAPI service and returns errors in the standard FastAPI shape:
StatusMeaning
401Missing or invalid credential.
403Authenticated but not authorised for this endpoint or partner scope.
404Resource not found.
422Validation error — see detail[] in the body.
429Rate limit.
5xxServer error — retry with backoff.
Validation error body:
{
  "detail": [
    {
      "loc":  ["body", "user_id"],
      "msg":  "field required",
      "type": "value_error.missing"
    }
  ]
}

Security checklist

Call Affinity from your backend (server-rendered pages, API routes, edge functions). If you need to render recommendations in a SPA, proxy the call through your own backend so the token never leaves your origin.
Don’t reuse staging tokens in production or vice versa. Future Demand issues distinct credentials per environment.
Affinity credentials are bound to your partner, not individual users. If the human who requested it leaves, rotate via support.
Make sure your request logs strip Authorization / X-API-Key headers. The x-request-id response header is what you want in support tickets.