## Base URL and authentication

All endpoints share one base URL. Authenticated endpoints expect an `Authorization` header carrying your scoped API key as a bearer token. Create the key in the API Dashboard of the environment you call (see [environments](#environments)); it is prefixed `vsk_` and grants only the [scopes](/developers/docs/api-keys) you select.

### Environments

The SaaS API runs in two independent environments. Accounts, organizations and API keys exist in only one of them, so you sign up separately on each dashboard, and a key from one will not authenticate against the other. The examples in these docs call production (`https://saas-api-lts.vocdoni.net`). The docs version selector switches them: the Production version shows production URLs and the Stage version shows staging ones.

| Environment | API base URL | Dashboard (sign up here) | Use it for |
| --- | --- | --- | --- |
| Staging | `https://saas-api-stg.vocdoni.net` | [Staging dashboard](https://platform-stg.vocdoni.io) | Wiring up and testing your integration against the latest build. Treat its data as disposable. |
| Production | `https://saas-api-lts.vocdoni.net` | [Production dashboard](https://platform.vocdoni.io) | Live elections. |

:::code-tabs

```bash
# Authenticated request (GET /integrator needs the quota:read scope)
curl https://saas-api-lts.vocdoni.net/integrator \
  -H "Authorization: Bearer vsk_your_api_key"
```
```ts
// Authenticated request with the TypeScript SDK
import { VocdoniApiClient } from '@vocdoni/api-client'

const client = new VocdoniApiClient({ apiUrl: 'https://saas-api-lts.vocdoni.net', authToken: 'vsk_your_api_key' })
const { limits, usage } = await client.organizations.getIntegratorInfo()
```
:::

> [!TIP] Start on staging
> While the API is in alpha, build against staging first and switch to production once your flow is stable.

### Optional authentication

Some public reads return **more** fields when the caller is a manager/admin of the owning organization
(or a `voting:write` API key acting as one). This is not a separate endpoint and not a `401`: everyone
gets the same `200`, the manager-only fields are simply **absent** for anyone else. An anonymous client
cannot tell from the response that it is missing anything.

The fields gated this way today:

- **`eligibleMemberIds`** on each question of a [process](/developers/docs/voting-processes#reading-a-process) - who may vote.
- **`memos`** on an [open-value](/developers/docs/voting-types#open-value-choices) question's [results](/developers/docs/results#voter-memos) - the free-text voter memos.

So treat an absent field as "not authorized, not applicable, or simply not present yet", never as proof
it does not exist. Send your key when you need the manager view.

## Identifiers

- **Addresses and ids are hex strings** - for example `0x1234...` for an organization address.
- **A process and its questions have different ids, do not mix them.** A `processId` identifies a process (a draft until published) and addresses it everywhere server-side. Each question's `upstreamId` is the 64-hex on-chain election id, assigned at publish; voters need it to sign a ballot, but you never address the process by it.

## Asynchronous operations

Some operations take longer than a single request should wait - process publishing and status changes, relaying a vote, and bulk member imports sent with `?async=true`. These return a `{ "jobId": "..." }` body (`202 Accepted`, or `200` for a member import). Poll the job until it finishes, then read the outcome from `result`. See [Jobs](/developers/docs/jobs) for the full model.

## Pagination

List endpoints accept `page` and `limit` query parameters and wrap results with a pagination object. Some lists also accept a search term or a type filter.

| Field | Type | Description |
| --- | --- | --- |
| `currentPage` | integer | The page you requested. |
| `previousPage` | integer | The previous page, when there is one. |
| `nextPage` | integer | The next page, when there is one. |
| `lastPage` | integer | The final page available. |
| `totalItems` | integer | Total items across all pages. |

## Errors

Errors return a consistent shape with an application code, the HTTP status and a message. Use `httpstatus` for control flow and `code` for precise handling.

```json
{
  "code": 40001,
  "httpstatus": 400,
  "error": "invalid census id",
  "logLevel": "debug"
}
```

## Multilanguage strings

Every human-readable metadata string - election titles and descriptions, question titles, choice titles, and other display text - is a **multilanguage string**, not a plain string. It is an object keyed by [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language code, plus a special `default` key used as the fallback when the reader's language is missing.

```jsonc
"title": {
  "default": "Board election 2026",
  "en": "Board election 2026",
  "es": "Elección de la junta 2026",
  "ca": "Elecció de la junta 2026"
}
```

Provide at least `default`; add per-language keys to localize. A client renders the key that matches the voter's language and falls back to `default` when it is absent, so a single election can present its ballot in many languages without duplicating the process.

> [!NOTE] Where this comes from
> Multilanguage strings are a protocol-level type: every metadata string in the Vocdoni [entity and process metadata](https://github.com/vocdoni/dvote-protobuf/blob/master/src/metadata/entity.proto) is a locale-aware `map<language, text>`. The SaaS API exposes the same shape, which is why the snippets in these docs wrap titles in `{ "default": ... }`.
