> For the complete documentation index, see [llms.txt](https://saviorofhealth.gitbook.io/saviorofhealth-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://saviorofhealth.gitbook.io/saviorofhealth-docs/partners-and-data-api/data-api/authentication.md). Agents can also search and read this documentation through its [MCP server](https://saviorofhealth.gitbook.io/saviorofhealth-docs/~gitbook/mcp).

# Authentication

Every request needs the organisation's access key in the `Authorization` header.

```bash
curl https://saviorofhealth.app/api/v1/insights \
  -H "Authorization: Bearer hs_live_xxxxxxxxxxxxxxxxxxxx"
```

## Keys

* Keys look like `hs_live_…`.
* A key is shown **exactly once**, at issuance. The Platform stores only its SHA-256 hash and a short prefix; a lost key cannot be recovered, only replaced.
* Keys are bound to a client (organisation) and can be revoked at any time.

## Scopes

Each key carries a set of scopes fixed by the client's plan at issuance. A call to an endpoint outside the key's scopes returns `403`.

### Scopes by plan

| Plan         | Scopes                                                               | Endpoints the key can call                                                               |
| ------------ | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `basic`      | `campaigns:read`, `campaigns:write`, `insights:read`                 | `/surveys`, `/insights`, `/insights/{key}`, `/meta/usage`, `/campaigns`, `/my/campaigns` |
| `pro`        | `basic` scopes plus `radar:read`, `trends:read`, `demographics:read` | `basic` endpoints plus `/radar`, `/trends`, `/demographics`                              |
| `enterprise` | All scopes: adds `cohorts:read`, `panel:read`, `reports:read`        | All endpoints, including `/cohorts`, `/panel`, `/reports/weekly`                         |

The scopes on a key are returned by [`GET /meta/usage`](https://saviorofhealth.gitbook.io/saviorofhealth-docs/partners-and-data-api/endpoints/meta-usage.md).

## Partner Portal sign-in

The Partner Portal at `/partner` accepts **either** the API key **or** the sign-in of a wallet bound to the approved client. Programmatic calls to `/api/v1/**` use the key.

## Endpoints not in this reference

Four `POST` routes under `/api/v1/my/campaigns` exist for the Partner Portal's own use:

| Route                        | Purpose                                      | Scope             |
| ---------------------------- | -------------------------------------------- | ----------------- |
| `POST /my/campaigns`         | Submit a new campaign for review             | `campaigns:write` |
| `POST /my/campaigns/analyze` | Analyst summary of the partner's own results | `campaigns:read`  |
| `POST /my/campaigns/chat`    | Analyst chat over the partner's own results  | `campaigns:read`  |
| `POST /my/campaigns/end`     | End a campaign early                         | `campaigns:write` |

They are not part of the public reference and their behaviour may change without notice.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://saviorofhealth.gitbook.io/saviorofhealth-docs/partners-and-data-api/data-api/authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
