Before you start
You need an API key. If you do not have one, see Get a key. Export the key as an environment variable. Every sample in these docs reads it fromSURFAIS_API_KEY.
requests, and Node.js 18 or later, which has fetch built in. Run them from a server or your own machine — the API does not accept calls from a browser.
1
List the organisations your key can reach
Call With an organisation key, the response holds exactly one organisation:
GET /orgs.Response
dataholds the payload. Here it is a list, sopaginationcomes with it.paginationappears on every list.has_more: falsewithnext_cursor: nullmeans this is the last page. Whenhas_moreistrue, passnext_cursorback as?cursor=to read the next page — see Pagination.link_scope: "owner"means you are using an organisation key. A partner key returns one item per linked organisation, withlink_scopeset toread_onlyorread_write, andexternal_refset to your own id for that organisation if you have stored one.tieris the identifier of the organisation’s plan, in lower case (scalehere). Treat it as an open string rather than a fixed list.
id. Every endpoint that reads or changes an organisation’s data sits under /orgs/{orgId}.2
Get a one-call rollup of every own brand
Call
GET /orgs/{orgId}/brands/summary. It returns one item per own brand, leaving out archived brands.Response
latestandpreviousare the brand’s two most recent score points.scoreis the AIS Score out of 100 on thatdate.latestisnulluntil the brand has been scored, andpreviousisnulluntil there is an earlier point. A brand with no scores yet reportsnull, never0.deltaislatest.scoreminusprevious.score, to one decimal place. It isnullwhen either score is missing. It is alsonullwhen the two scores are not comparable, because they were produced by different scoring models (score_version) or measured over different sets of AI models (panel_version).delta_reasonthen names the case. Do not subtract the scores yourself across a version change — see Data model.avg_sentimentis the mean sentiment of the brand’s mentions on the latest date, from 0 to 100.sovis the brand’s share of voice on that date, as a percentage: its mentions divided by its own plus its tracked competitors’ mentions.sovisnullwhen nothing was mentioned.last_scan_atis when the brand’s latest scan was finalised.changed_atis a change token: it moves whenever something this endpoint reports can have changed — a scan being finalised or removed, the brand or one of its competitors being edited, or the organisation’s scan schedule changing. Pollchanged_at, notlast_scan_at, to decide when to read again.
3
Check your limits
Every successful response tells you where your key stands against its per-minute rate limit, and carries an id for the request.Limits are set per key, so read them from these headers rather than hard-coding a number. Over the limit, the API answers
Print them for your key:
429 rate_limited with a Retry-After header: wait that many seconds, then retry. A key can also carry a monthly quota, which answers 429 quota_exceeded once it is used up. See Rate limits.Rate limits count requests. Your plan’s tracking caps — active prompts, own brands and countries — are separate: read them, with current usage, from usage on GET /orgs/{orgId}.If a call fails
Every error uses one envelope. Switch onerror.code, never on message.
Errors lists every code.
Next steps
- Authentication — organisation and partner keys, scopes, and the write rule.
- Pagination — walk a list to the end, and how date windows work.
- Provision a property — create an own brand with its competitors. Needs write access.
- Sync a brand’s prompts — send the prompt set you want and let the API work out the changes. Needs write access.
- Request a scan — start an on-demand scan and wait for the results. Needs write access.
- Export results — pull results and mentions into your own store.
- Webhooks — for platform partners: signed events when a scan completes.