> 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

# Authentication overview

The Partner API is server-to-server. Your integration does not sign in as a person: it acts as an **application** that your agency registers in the Partner Hub. The application authenticates with its own credentials, receives short-lived access tokens, and can act only for the creators your agency has granted to it.

## The model

| Piece            | What it is                                                                                                                                                                                            | Where it comes from                                                                                   |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **Agency**       | Your organisation on EVVA. Every application belongs to exactly one agency, and acts only for that agency's creators.                                                                                 | The Partner Hub.                                                                                      |
| **Application**  | Your integration — a CRM bridge, a bot, an AI assistant. It is not a staff member and not a creator: it has no Hub role, only scopes. Each application lives in one **environment**: live or sandbox. | Created by the agency owner in **Integrations → Applications**.                                       |
| **Credentials**  | A client ID plus a client secret, or a public key you registered for `private_key_jwt`.                                                                                                               | The application's **Credentials** tab.                                                                |
| **Access token** | An opaque bearer token, valid for 15 minutes, that your server sends with every call.                                                                                                                 | The token endpoint, in exchange for the credentials. See [Requesting tokens](/authentication/tokens). |
| **Grant**        | The agency's decision that this application may act for a creator, or for a group of creators, with a set of scopes.                                                                                  | The application's **Permissions & creators** tab.                                                     |
| **Consent**      | The creator's link to your agency, which carries the scopes the creator agreed to.                                                                                                                    | Made when the creator connects to your agency; the creator can end it at any time.                    |

The environment is visible in every identifier, so a sandbox credential can never be mistaken for a live one:

|               | Live          | Sandbox       |
| ------------- | ------------- | ------------- |
| Client ID     | `evpc_live_…` | `evpc_test_…` |
| Client secret | `evps_live_…` | `evps_test_…` |
| Access token  | `evpa_live_…` | `evpa_test_…` |

A live application acts for your real creators and waits for EVVA's review before it can obtain tokens. A sandbox application is active at once and acts only in the [sandbox](/sandbox).

## Getting and using a token

The application uses the OAuth 2.0 `client_credentials` grant. There is no browser redirect, no user and no refresh token.

```mermaid
sequenceDiagram
    autonumber
    participant Hub as Partner Hub
    participant App as Your server
    participant Token as Token endpoint
    participant API as Partner API
    Hub->>App: Client ID and secret, shown once (or you register a public key)
    App->>Token: POST /partner/v1/oauth/token, grant_type=client_credentials
    Token->>Token: Authenticate the client. Application and agency active?
    Token-->>App: access_token evpa_live_..., expires_in 900, scope
    App->>API: GET /partner/v1/accounts with Authorization: Bearer evpa_live_...
    API->>API: Token live? Application and agency active? Effective access for each creator
    API-->>App: 200, the creators the application may act for
    Note over App,Token: Before the token expires, request a new one with the same credentials
```

Send the token in the `Authorization` header of every call:

```http
GET /partner/v1/app/me HTTP/1.1
Host: api.evvahub.com
Authorization: Bearer evpa_live_…
```

You never send an agency ID: the token already names the agency. If you do send an `X-Agency-Id` header, it must be your application's own agency, or the request is refused with `403 AGENCY_CONTEXT_MISMATCH`.

[`GET /partner/v1/app/me`](https://developers.evvahub.com/api-reference/application/get-application-me) tells you which application, agency and environment a token belongs to and the scopes it carries; [`GET /partner/v1/app/capabilities`](https://developers.evvahub.com/api-reference/application/get-application-capabilities) lists everything the application can call, creator by creator.

## Effective access

A token is not a blanket permission. For every request that concerns a creator, EVVA works out what the application may do for **that** creator **at that moment**:

```text
effective scopes = scopes the application is allowed
                 ∩ scopes of the agency's grants that reach the creator
                 ∩ scopes the creator's consent covers
                 ∩ scopes on the token
```

An operation is allowed only when **every** scope it requires is in that set, and only while:

* your agency is active, and the application is active;
* EVVA has not paused integrations for that creator;
* the creator's account status permits the action.

Nothing can widen this set. A group grant cannot give a creator's application more than that creator consented to; a token cannot carry a scope the application is not allowed; and an agency cannot grant a scope it has not allowed the application.

EVVA evaluates the whole chain on every request, reading the current state each time, with no caching. So a change takes effect on the **next request** — you never have to restart your integration or fetch a new token for a narrower grant to apply.

See [Scopes and grants](/authentication/scopes) for the scope vocabulary, how grants work, and the `403` code each broken link of the chain returns.

## When access changes

| What changed                                                        | REST                                                          | Realtime                                                                                                           | Token endpoint                                                 |
| ------------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- |
| A grant is revoked or narrowed, or a creator leaves a granted group | Next request for that creator: `403 NOT_ASSIGNED`             | The connection stays open; that creator's events stop. The event feed records `grant.changed` or `access.revoked`. | Unaffected                                                     |
| The creator ends their link to your agency                          | `403 GRANT_REVOKED`                                           | That creator's events stop                                                                                         | Unaffected                                                     |
| EVVA pauses integrations for a creator                              | `403 CREATOR_INTEGRATIONS_HELD`                               | That creator's events stop                                                                                         | Unaffected                                                     |
| The application's allowed scopes are narrowed                       | Existing tokens lose the removed scopes from the next request | Events needing them stop                                                                                           | Requests for a removed scope: `invalid_scope`                  |
| The application is disabled or revoked                              | Every token is revoked at once: `401 INVALID_TOKEN`           | Closed with `SESSION_REVOKED`, close code `4401`                                                                   | `unauthorized_client` (disabled) or `invalid_client` (revoked) |
| Your agency is suspended                                            | `403 AGENCY_SUSPENDED`                                        | Closed with `SESSION_REVOKED`, close code `4401`                                                                   | `unauthorized_client`                                          |
| You revoke a token                                                  | That token: `401 INVALID_TOKEN`                               | Connections opened with it are closed                                                                              | Unaffected                                                     |
| A token expires                                                     | `401 INVALID_TOKEN`                                           | Closed at the moment of expiry; reconnect with a new token                                                         | Request a new token                                            |

Realtime closes for application-wide changes reach every connection within about a second.

> **Note**
>
> Rotating a client secret or revoking a public key changes how the application **gets** tokens, not the tokens it already holds: those keep working until they expire. See [Rotating credentials](/authentication/tokens#rotating-credentials).

## Keeping credentials safe

* Keep client secrets and private keys on your servers only, in a secret manager or injected environment. Never ship them, or a token, to a browser or a mobile app.
* Prefer `private_key_jwt` in production: the private key never leaves your infrastructure, and rotation is a new key ID.
* Never log a secret, an assertion or an access token. The official SDKs redact them.
* Revoke a token you no longer need, and rotate a credential the moment you suspect it leaked.

## Next steps

#### [Requesting tokens](/authentication/tokens)

Client secret or private key JWT, the response, errors, rotation and revocation.

#### [Scopes and grants](/authentication/scopes)

The scope vocabulary, grants to creators and groups, and capability discovery.

#### [Rate limits and quotas](/authentication/rate-limits)

The budget each application is metered against.

#### [Quickstart](/quickstart)

From a new application to your first API call.