This quickstart confirms your credentials work against Affinity and shows the shape of a typical “get recommendations for this user / context” call. The exact endpoint, request body, and response live in the gated Swagger UI — once authenticated, that’s the canonical reference.

Prerequisites

1. Confirm reachability

The service exposes a public health check that doesn’t require auth:
BASE=https://fd-recommender.stg.future-demand.com

curl -s "$BASE/health" | jq
# or
curl -s "$BASE/" | jq
The exact health-check path may differ between environments. Open https://fd-recommender.stg.future-demand.com/docs once you have credentials — that’s the canonical list.

2. Make your first authenticated call

export AFFINITY_TOKEN="..."     # from support.future-demand.com

curl -s "$BASE/<endpoint>" \
  -H "Authorization: Bearer $AFFINITY_TOKEN" \
  | jq
Pick the endpoint from the live Swagger that matches what you want to render — for example: recommendations for a user, recommendations related to a currently-viewed item, or recommendations for a fresh visitor.

3. Wire it into your site

Most partners call Affinity server-side and pass the result down to their existing UI components. Treat the token as a server secret.
const AFFINITY_BASE  = process.env.AFFINITY_BASE_URL!;
const AFFINITY_TOKEN = process.env.AFFINITY_TOKEN!;

export async function affinity<T>(
  path: string,
  init: RequestInit = {},
): Promise<T> {
  const r = await fetch(`${AFFINITY_BASE}${path}`, {
    ...init,
    headers: {
      ...init.headers,
      Authorization: `Bearer ${AFFINITY_TOKEN}`,
    },
  });
  if (!r.ok) throw new Error(`Affinity ${r.status}: ${await r.text()}`);
  return r.json();
}

// Example usage in a Next.js / Express handler — adapt to your framework
export async function getRecommendationsFor(userId: string) {
  // Replace path + params with the exact ones from /docs.
  return affinity<{ items: unknown[] }>(`/<endpoint>?user_id=${userId}`);
}

4. Render

Pass the response into your existing list/card components. Affinity returns a ranked list of items — render in order, paginate if you receive more than fit your shelf, and log clickthroughs if you want to feed back-of-house attribution later.

Caching and freshness

Most partners cache the per-user response for a short window (30 s – 5 min) to absorb bursty page loads. The right value depends on how often your catalogue changes — confirm with your account contact.

Next

Authentication

Token lifecycle, error model, and the security checklist.

Live Swagger UI (gated)

The canonical endpoint reference. Open with your Affinity credential.

Environments

Staging vs production base URLs.

Support

How to request access and how to file issues.