> This page is part of EVVA for Developers (https://developers.evvahub.com), the documentation of the EVVA Partner API. The API is in developer preview and the SDK packages are not yet published: do not suggest installing them. Index: https://developers.evvahub.com/llms.txt

# API conventions

Learn these once; every operation in the [API reference](/api-reference) follows them.

## Base URL and format

| Item           | Convention                                                                                                                                          |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Base URL       | `https://api.evvahub.com`                                                                                                                           |
| Paths          | Absolute from the host, versioned in the path: `/partner/v1/…`                                                                                      |
| Token endpoint | `POST https://api.evvahub.com/partner/v1/oauth/token` — see [Requesting tokens](/authentication/tokens)                                             |
| Transport      | HTTPS only                                                                                                                                          |
| Request bodies | JSON (`Content-Type: application/json`), at most 100 KB. A larger body is `413`, an unreadable one `400` or `415`, all with code `INVALID_REQUEST`. |
| Success bodies | The resource itself, with no wrapper. Lists return their rows (`items`, or a named array such as `messages`) plus paging fields.                    |
| Caching        | Every response is `Cache-Control: private, no-store`. Never store responses in a shared cache.                                                      |
| Version header | Every response carries `API-Version: v1`. See [Versioning](/conventions/versioning).                                                                |

## Authentication

| Item                 | Convention                                                                                      |
| -------------------- | ----------------------------------------------------------------------------------------------- |
| Header               | `Authorization: Bearer <access token>`                                                          |
| Token                | Opaque, starting `evpa_live_` (live) or `evpa_test_` (sandbox). Never parse it.                 |
| Lifetime             | Read `expires_in` from the token response. There is no refresh token: request a new one.        |
| Bad or expired token | `401 INVALID_TOKEN` with `WWW-Authenticate: Bearer realm="evva-partner", error="invalid_token"` |

## Agency and creator context

| Item                     | Convention                                                                                                                                   |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Agency                   | Taken from your token. You do not need to send `X-Agency-Id`; if you do, it must name your agency (`403 AGENCY_CONTEXT_MISMATCH` otherwise). |
| Creator                  | Taken only from `{creatorId}` in the path: `/partner/v1/accounts/{creatorId}/…`.                                                             |
| `X-Creator-Id`           | Optional echo of the path's `creatorId`. Any other value is `403 CREATOR_CONTEXT_MISMATCH`.                                                  |
| Creators you can reach   | [`GET /partner/v1/accounts`](https://developers.evvahub.com/api-reference/accounts/list-accounts) lists them with the scopes you hold for each.                                      |
| Another creator's object | Answered `404`, exactly like a missing one.                                                                                                  |

## Errors

Every error body has the same shape, on every operation and whichever layer refused the request:

**`Error envelope`**

```json title="Error envelope"
{
  "code": "OAUTH_SCOPE_MISSING",
  "error": "The creator's consent does not cover this",
  "requestId": "7d1f0a52-3b8e-4c69-a1d4-0e9b6f2c5a37"
}
```

| Field       | Convention                                                                                                           |
| ----------- | -------------------------------------------------------------------------------------------------------------------- |
| `code`      | Stable and machine-readable. Branch on it. New codes may appear within v1: treat an unknown code by its HTTP status. |
| `error`     | Human-readable. It may change; never branch on it.                                                                   |
| `details`   | Optional and specific to the code: field errors, limits, the level that refused.                                     |
| `requestId` | The same value as the `X-Request-Id` response header.                                                                |

The token and revocation endpoints are the exception: they answer standard OAuth 2.0 error bodies
(`{"error": "invalid_client", "error_description": "…"}`). The full list is on [Errors](/conventions/errors).

## Correlation

| Item                      | Convention                                                                                                               |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `X-Request-Id` (request)  | Optional. A value matching `^[A-Za-z0-9._-]{1,128}$` becomes the request id; any other value is replaced, never refused. |
| `X-Request-Id` (response) | Always present: your value, or a UUID EVVA generates.                                                                    |
| `requestId` (error body)  | The same value. Quote it when you contact EVVA about a request.                                                          |

## Rate-limit headers

| Header                  | Convention                                         |
| ----------------------- | -------------------------------------------------- |
| `X-RateLimit-Limit`     | The limit of the limiter that metered the request. |
| `X-RateLimit-Remaining` | Requests left in the current window.               |
| `X-RateLimit-Reset`     | When the window resets, in epoch seconds.          |
| `Retry-After`           | On every `429` and every `503`, in seconds.        |

Details and backoff advice: [Rate limits and quotas](/authentication/rate-limits).

## Idempotency

| Item                        | Convention                                                            |
| --------------------------- | --------------------------------------------------------------------- |
| Header                      | `Idempotency-Key`, on the writes that declare it in the API reference |
| Format                      | Typically 1–128 characters of `[A-Za-z0-9_-]`                         |
| Same key, same request      | The first outcome is answered again; nothing happens twice.           |
| Same key, different request | `409` — `IDEMPOTENCY_KEY_REUSED` on most operations                   |
| Key space                   | Your application's own. Your keys never collide with anyone else's.   |

Details per operation family: [Idempotency](/conventions/idempotency).

## Paging

| Style         | Request              | Response                         | Examples                                                       |
| ------------- | -------------------- | -------------------------------- | -------------------------------------------------------------- |
| Opaque cursor | `cursor` and `limit` | `nextCursor` (`null` at the end) | Media albums and tags, comments, marketplace listings          |
| History       | `before` and `take`  | `nextCursor`, `hasMore`          | Conversation history, media and links shared in a conversation |
| Offset        | `skip` and `take`    | `total`, `skip`, `take`          | Mass messages, media assets, content, orders                   |
| Event feed    | `after` and `limit`  | `nextCursor`, `hasMore`          | [`GET /partner/v1/events`](https://developers.evvahub.com/api-reference/events/list-events)          |

Cursors are opaque: pass them back exactly as received. Details: [Pagination and cursors](/conventions/pagination).

## Compatibility

Within `/partner/v1` EVVA makes additive changes only. Write your client to tolerate:

| Change you may see               | What your client should do                  |
| -------------------------------- | ------------------------------------------- |
| New response fields              | Ignore them.                                |
| New enum values in responses     | Handle an unknown value without failing.    |
| New error codes                  | Act on the HTTP status.                     |
| New event types and frame fields | Skip what you do not know.                  |
| New optional request fields      | Nothing: you are not required to send them. |

Do not depend on the order of fields, on the `error` text, or on the order of list results unless the operation
says so.

## Next steps

#### [Errors](/conventions/errors)

The full code catalogue, with what to do about each.

#### [Idempotency](/conventions/idempotency)

Retry writes without doing them twice.

#### [Pagination and cursors](/conventions/pagination)

Walk every list without missing or repeating rows.

#### [Versioning and deprecation](/conventions/versioning)

How v1 evolves and how you are told about changes.