# Audience Intelligence API

Customer-facing reference for the audience-intelligence outputs — the data produced by
joining an event's **attendee roster** with its **transcript analysis** (topics, entities,
themes, sentiment) through the shared **Company** entity.

Every output endpoint here is read-only, deterministic, org-scoped, and fetchable with an
**API key**. The exhaustive request/response schemas are in the API reference; this page is
the orientation and the field-by-field meaning.

- API reference: dashboard → **API Docs** (signed-in users)
- OpenAPI JSON (import into Postman/Insomnia/codegen): **`GET /v1/openapi.json`** — send your API key
- Postman collection (committed): [`audiobly.postman_collection.json`](/developers/downloads/audiobly.postman_collection.json)

## Authentication & access

All endpoints accept either a signed-in user's token or an **organisation API key**. Create a
key at `POST /v1/api-keys` (the secret is returned **once**), then send it as a bearer token:

```bash
curl https://api.audiobly.com/v1/events/{event_id}/demand \
  -H "Authorization: Bearer sk_live_…"
```

Keys are scoped to your organisation; every response is filtered to your organisation's data.
A valid key is not always enough:

- **Plan.** API keys come with the **Enterprise** plan, which includes every module: all the
  outputs below (audience, resonance, demand, leads, voice, influence, network, analysis) and
  the cross-event company profile `GET /v1/companies/{company_id}` answer for any key. An
  organisation not on Enterprise gets `403 PLAN_REQUIRED` on every API call.
- **Key scopes.** A key created with explicit `scopes` is refused (`403 FORBIDDEN`) for any
  call its scopes don't cover — e.g. a `read`-only key cannot import attendees (which needs
  `prep_manage`) or edit taxonomy (`taxonomy_manage`).

Other errors: `401` = missing, expired or revoked credential; `404` = event not in your
organisation.

## Privacy model (important for consumers)

- **k-anonymity.** Company/industry/segment breakdowns collapse any bucket smaller than
  `min_audience_group` (default **5**) into a single `"Other (n)"` row flagged
  `"suppressed": true`. `min_group` is echoed in each response so you can label it. Fixed
  categories (seniority, function) can't single anyone out and are shown in full.
- **Consent gate.** Buyer–Seller lead packs are **company-level aggregates**. Individual
  contact detail (name/email) appears **only** for delegates who opted in
  (`marketing_consent = true`) **and** only when your org has enabled `sponsor_lead_sharing`.
  Otherwise `contacts` is empty and `contacts_locked = true`, with a `consented_contacts`
  count. Delegates who did not opt in are never returned.
- **Networking** output is company-level only — individuals are never named.

## Inputs — where the data comes from

These produce the roster and analysis the intelligence is computed from:

| Purpose | Endpoint |
| --- | --- |
| Import attendees (CSV columns: **Title** (Dr/Lord/Sir), First name, Last name, Job title, Company, Email, Delegate Type, Marketing consent) | `POST /v1/events/{id}/attendees/import` |
| Create / edit / list attendees (each carries `company_id`, `honorific`, `country`, `seniority`, `function`, `needs_review`, `marketing_consent`, `bio`, `headshot_url`, `registration_status`, `answers`; write `company_website` to enrich the linked Company) | `POST` / `PUT` / `GET /v1/events/{id}/attendees` |
| Re-run seniority & function classification (`?force=true` re-classifies everyone, including manual overrides; default fills only attendees still missing one) | `POST /v1/events/{id}/attendees/reclassify` (202) |
| Progress of the background company enrichment + classification after an import | `GET /v1/events/{id}/attendees/enrichment-status` |
| Resolve/link a free-text company to a shared Company profile | `POST /v1/events/{id}/companies/resolve` |
| Re-enrich a company profile from its website | `POST /v1/companies/{company_id}/refresh` |
| Run transcript analysis (topics/entities/themes/sentiment) — event-wide and per session | `POST /v1/events/{id}/analysis`, `POST /v1/events/{id}/sessions/{session_id}/analysis` |

Attendee imports auto-resolve each delegate's company to the same enriched **Company**
entity used by speakers/sponsors (`company_id`), reusing an existing profile of the same
name and seeding a new one from a matching sponsor when possible. After the company is
enriched (so its **Industry** is known), each attendee's **Seniority** and **Function** are
classified from the job title with that industry as context — see below.

## Outputs

### Room composition — `GET /v1/events/{id}/audience`
Who was in the room. `total`, `senior_total`, and k-anonymised breakdowns
`by_seniority`, `by_function`, `by_industry`, `by_delegate_type`, `top_companies` (each a
list of `{label, count, suppressed}`), plus `min_group`. When the **Audience Intelligence**
classification has run, two more breakdowns appear: **`by_persona`** (derived buyer/operator
archetype) and **`by_value_chain_role`** (the delegate's employer's supply-chain position).
Both are empty until the roster is classified — omitted, never fabricated.

**Seniority & Function** are classified per attendee (industry-aware — see below), so
`by_seniority` and `by_function` reflect that classification. Values:

- `seniority` ∈ `C-level`, `VP`, `Director`, `Manager`, `Individual`, `Unknown`
  (`senior_total` counts C-level/VP/Director).
- `function` ∈ `Corporate Strategy / GM`, `Sales / Commercial`, `Marketing`, `Product`,
  `Engineering / R&D`, `Operations`, `Human Resources`, `Finance / Legal`,
  `Clinical / Medical`, `Production / Manufacturing`, `Editorial / Content`, `Other`.

### Room Resonance Index — `GET /v1/events/{id}/audience/resonance`
`profile` (as above) plus `sessions[]`, one per analysed session, sorted by
**`audience_match`**:

- **Audience-Match Score** `audience_match` (0–100) — how well-matched the room was to the
  session, weighting each attendee by seniority, delegate type and company and scaling by the
  session's sentiment. Higher = the right (more senior, better-fit) people were present.
  Supporting fields: `senior_share` (% senior decision-makers), `avg_rs` (mean per-attendee
  Resonance Score), `sentiment` (session sentiment, −1..1).
- **Room Resonance** `score` (0–100) — the % of the room whose company/industry connected to
  what the session discussed, with `reach`, `senior_reach`, `audience_total`,
  `matched_companies[]` (named on stage **and** in the room), `aligned_industries[]`.

### Seniority & Function classification
Every attendee's job title is normalised to one `seniority` tier and one `function` group
(values above), using the company's **Industry** as context so industry-specific titles are
read correctly — e.g. a Pharma *"Principal Scientist"* is an Individual in R&D (not a
Director), an F&B *"Head Brewer"* is a Manager in Production (not C-suite). Titles the rules
can't confidently place set `needs_review: true` for manual correction. Send `seniority`
and/or `function` explicitly on `POST`/`PUT /attendees` to override the classification
(which also clears `needs_review`).

### Audience Intelligence — company & person classification
Beyond seniority/function, every **company** and **person** is classified on a multi-dimensional
taxonomy, **source-agnostically** (any source — import, connector, web-scrape, manual — resolves
to one canonical `Company`/`Contact` and is classified once).

- **Company** (on the enriched Company profile, see Company 360): `primary_industry` +
  `secondary_industries`, `subsectors`, **`value_chain_role`** (Brand Owner / Ingredient
  Supplier / Contract Manufacturer / Equipment & Technology Supplier / Retailer & Distributor /
  Service Provider / Media & Intelligence / Association & Regulatory / Academic & Research),
  `target_markets`, each with `confidence`, plus a `classification` meta object
  (`taxonomy_version`, `source`, `is_relevant`).
- **Person** (on attendees/speakers/contacts, in the `classification` object): `seniority`,
  primary + secondary `function`, `scope` (Global/Regional/Local), `specialisms[]`, a derived
  `persona`, `confidence`, and `taxonomy_version`. The person **inherits** its employer's
  industry/value-chain context.

**Tenant taxonomy onboarding** (needs the `taxonomy_manage` permission):

| Purpose | Endpoint |
| --- | --- |
| The industry families a customer can pick from | `GET /v1/organizations/current/taxonomy/available-industries` |
| Current scope (activated industries + override count) | `GET /v1/organizations/current/taxonomy` |
| Set the industry scope (the scoping filter) | `POST /v1/organizations/current/taxonomy/scope` `{industries: [...]}` |
| Draft a title-ontology validation grid from existing titles | `POST /v1/organizations/current/taxonomy/bootstrap` |
| Persist validated title classifications (tenant hard-exceptions) | `POST /v1/organizations/current/taxonomy/decisions` `{decisions: [...]}` |
| Publish an immutable taxonomy version (version-locking) | `POST /v1/organizations/current/taxonomy/publish` `{version}` |
| This tenant's corrections by frequency (learning loop) | `GET /v1/organizations/current/taxonomy/corrections` |

The **scoping filter** governs egress: a company whose industry is outside the tenant's
activated scope is marked `is_relevant: false` and excluded from Insights **and** from any
connected-CRM writeback (for example Salesforce). Classifications carry a `taxonomy_version` so downstream segments
never silently re-classify.

### Demand Intelligence — `GET /v1/events/{id}/demand`
Agenda–market fit. `topics[]` and `themes[]` ranked by room reach × positive sentiment,
each `{label, reach, sentiment, demand_score (0–100), sessions[]}`; `coverage_gaps[]`
(`{segment, attendees, share, aligned_sessions}`) — sectors present that no session
addressed; and a plain-language `brief[]`.

### Buyer–Seller Matching — `GET /v1/events/{id}/leads`
Per sponsor, a ranked + explainable lead shortlist. `sponsor_lead_sharing` (bool) and
`sponsors[]`, each `{sponsor{id,name,industry}, keywords[], pain_point_sessions[], leads[],
lead_count, contacts_enabled}`. Each lead:
`{company, industry, value_chain_role, senior_count, total_delegates, matched_keywords[],
industry_match, fit_score, why, consented_contacts, contacts[], contacts_locked}`. When the
company's **value-chain role** is a buyer of what the sponsor sells (Retailer/Distributor,
Brand Owner, Contract Manufacturer), the lead is relevant on that basis alone and its
`fit_score` is boosted. See the consent gate above.

### Segmented Voice-of-the-Room — `GET /v1/events/{id}/voice`
Sentiment + themes sliced by segment instead of one blob: `by_industry`, `by_function`,
`by_seniority`, each a list of `{segment, reach (distinct delegates), sessions, sentiment,
sentiment_score, top_themes[]}`. Industry slices are k-anonymised; `min_group` echoed.

### Influence & Share-of-Voice — `GET /v1/events/{id}/influence`
Who owned the conversation, reach-weighted. `speakers[]`
(`{name, company, stage_sessions, stage_reach, quotes, share}`) and `companies[]`
(`{company, weighted_mentions, stage_sessions, stage_reach, themes[], share}`). `share` is a
% of room-weighted influence (mentions × session reach + stage reach) — a short high-reach
slot can outrank a long one to an empty room.

### Networking / Relationship Graph — `GET /v1/events/{id}/network`
`dual_presence[]` (companies that brought both speakers and delegates:
`{company, industry, speakers, delegates}`), `clusters[]` (industry groups:
`{industry, company_count, speaker_companies[], delegate_companies[]}`), and aggregate
`suggestions[]`. `min_group` echoed. Company-level only.

### Company 360 — `GET /v1/events/{id}/companies/{company_id}`
Everything about one company at the event. `company` (the enriched profile:
`{id, name, website, logo_url, industry, summary, products[], services[], technologies[],
tags[], enrichment_status}`, plus the Audience-Intelligence dimensions once classified:
`primary_industry_id`, `value_chain_role_id`, `subsectors[]`, `target_markets[]`,
`classification{taxonomy_version, source, is_relevant}`), `speakers[]` and `delegates[]` from that company,
`delegate_seniority[]` (`{label, count}`), `speaker_sessions[]`, `discussed_themes[]`, and
`sponsored_events[]`. Company profiles are auto-enriched from the website (industry, summary,
logo); `POST /v1/companies/{company_id}/refresh` re-runs enrichment. `enrichment_status` ∈
`pending`, `enriching`, `enriched`, `failed`.

### Company profile across events — `GET /v1/companies/{company_id}`
*Requires the **Intelligence** module.* Everything your organisation knows about one company,
aggregated across every event it touched:

- `profile` — `{id, name, industry, website, logo_url, summary, products[], services[],
  technologies[], employee_count, value_chain_role, lifecycle_stage}`.
- `metrics` — `events_engaged`, `events_attended`, `events_spoken`, `events_sponsored`,
  `attendees`, `speakers`, `sponsorships`, `sponsorship_value`, `ltv`, `lifecycle_stage`.
- `events` — `attended[]`, `spoke_at[]`, `sponsored[]`.
- `people[]` (with `people_truncated`), `themes_associated[]`.
- `visibility` — how often the company itself is named in those events' transcripts:
  `total_mentions`, `per_event[]`, `concepts[]`, and `source` (`mentions` = resolved entity
  mentions, `analysis` = from the transcript analysis).
- `sponsor_value` — `tiers[]`, `total_agreed`, `total_paid`, `events_sponsored`, `renewal_signal`.

### Share of voice — `GET /v1/events/{id}/share-of-voice`
Resolved mentions per **sponsor** and per **company** in the event's transcripts:
`{event_id, tagged, concept_uri, total_mentions, sponsors[], companies[]}`, each item
`{id, name, mentions, share, sessions[], concepts[]}` — `share` is the item's share of all
resolved company/sponsor mentions at the event, `sessions[]` where it was named, `concepts[]`
the topics it was named alongside. Pass `?concept_uri=` to count only mentions in passages
tagged with that concept. `tagged` is `false` (lists empty) until the event's sessions have
been tagged. Available on every plan.

### Transcript Analysis — `GET /v1/events/{id}/analysis`
The content graph the intelligence is joined against. Audiobly's analysis extracts, per transcript:
`topics[]`, `entities[]`, `themes[]`, `sentiment` (`{overall{label,score}, by_speaker[], and
a sentiment `trajectory[]`}`), plus `questions[]`, `opportunities[]`, `risks[]`. Runs at two
scopes: `session` (one row per session with usable timing) and `event` (a single
full-transcript row). Endpoints:

- `POST /v1/events/{id}/analysis` — queue event + per-session analysis (202).
- `POST /v1/events/{id}/sessions/{session_id}/analysis` — (re)analyse one session.
- `GET /v1/events/{id}/analysis` — list analyses (`?current=true` for the current event view
  plus each session's newest analysis); `GET /v1/events/{id}/analysis/{scope}` for `event` or `session`.
- `GET /v1/events/{id}/analysis/status` — live progress: `{event, sessions[]}`, each
  `{session_id, title, status, progress_pct, queue_position, queue_total, has_analysis}`.

## Example

```bash
curl -s https://api.audiobly.com/v1/events/$EVENT/demand \
  -H "Authorization: Bearer $AUDIOBLY_API_KEY"
```

```json
{
  "total": 242,
  "analysed_sessions": 4,
  "min_group": 5,
  "topics": [
    { "label": "Embracing AI across the whole organization", "reach": 14,
      "sentiment": "positive", "demand_score": 100,
      "sessions": ["Fireside chat: What AI means to Immediate Media"] }
  ],
  "coverage_gaps": [
    { "segment": "Media and Publishing", "attendees": 6, "share": 2, "aligned_sessions": 0 }
  ],
  "brief": ["Double down on Embracing AI across the whole organization …"]
}
```

## Notes

- All figures are computed deterministically from your roster + analysis (no AI model in the
  scoring path), so results are stable and explainable.
- Resonance/demand/voice/influence require **session-scope analysis** to exist; run
  `POST /v1/events/{id}/analysis` first. Endpoints return empty arrays (not errors) when
  there's no analysis or no roster yet.
