Skip to content

Quickstart

This page takes you from nothing to a working GraphQL request against an audience, then shows the same call through an SDK. It uses Hot Mess as the example audience; swap in your own.

  1. Find the audience. Every audience answers GET /v1/branding for its hosts, with no credential. <subdomain>.admin.audiencekit.com works for every audience; its own domain works once it is verified.

    Terminal window
    curl -s "https://api.audiencekit.com/v1/branding?host=hotmess.admin.audiencekit.com"

    The response carries audience.id (a UUID), the audience’s name, the sign-in methods its apps offer, and its theme. Keep the id: it is the scope of every GraphQL request. See REST: Branding.

  2. Get a credential. Which one depends on who is calling:

    You are building Use How you get it
    A server or website acting as one audience’s app An application API key From the audience’s admin console
    An app people sign in to A user token Sign the person in (Facebook, Apple, Google and others), then exchange that for a session
    A worker, bot or import job A service token Minted in the admin console with only the scopes it needs

    Authentication explains each one, and Service tokens walks through minting one.

  3. Send a query. The audience is the query root, so this lists five of its venues:

    Terminal window
    curl https://api.audiencekit.com/v1/audience/$AUDIENCE_ID/graphql \
    -H "Authorization: Bearer $AUDIENCE_KIT_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"query":"{ name venues { list(first: 5) { nodes { id name } } } }"}'

    Errors come back in the usual GraphQL errors array, with an extensions.code; see Errors. A field from a module the audience hasn’t installed is refused as undefinedField, which the SDKs handle for you.

  4. Explore the graph. The GraphQL reference documents the consumer view one module at a time, with the permissions every field needs. Staff tools use the wider StaffQL view. Download the schema for your own tooling from /graphql/schema.graphql.

  5. Check your documents in CI. Run the document validator against the published schema so a renamed or deprecated field fails your build, not your users.

The SDKs sign people in, keep the session, send the API version header, and retry around modules an audience doesn’t have. They all speak to https://api.audiencekit.com by default.

import { AudienceKitClient } from "audience-kit";
const client = new AudienceKitClient({
configuration: { host: "hotmess.admin.audiencekit.com" },
});
// Sign in (or adopt a credential you minted), then read the audience.

Node and TypeScript SDK

PHP, Rust and Ruby clients work the same way; the SDK overview lists them all.