> 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

# Approvals and automatic limits

Most operations run as soon as your application calls them. A small set of **sensitive** operations (anything that
sets a price or commits money, deletes something, blocks or reports a fan, sends a view-once message, confirms an
order, or spends the creator's paid AI allowance) are closed to applications by default. For each of them, the agency
decides whether your application may:

| The agency's rule           | What happens when your application calls the operation                                            |
| --------------------------- | ------------------------------------------------------------------------------------------------- |
| **Automatic within limits** | It runs, as long as it stays within the agency's daily limits. Beyond them it waits for a person. |
| **Always ask for approval** | Nothing is done. The request waits for a person in the agency (`202 APPROVAL_REQUIRED`).          |
| **Never allow**             | It is refused with `403 ACTION_DENIED_BY_POLICY` and cannot be approved.                          |
| *No rule*                   | Same as **Always ask for approval**.                                                              |

People on the agency's team are not affected: these rules apply to applications only.

## The flow

```mermaid
sequenceDiagram
    autonumber
    participant App as Your application
    participant API as EVVA Partner API
    participant Hub as Agency owner or team lead (Partner Hub)
    App->>API: POST sensitive operation + Idempotency-Key
    API-->>App: 202 APPROVAL_REQUIRED {approvalId}
    API-->>App: event approval.requested
    Hub->>API: Approve
    API-->>App: event approval.decided {decision: APPROVED}
    App->>API: same request + Partner-Approval-Id + Idempotency-Key
    API-->>App: 201 / 200, the action runs once
```

## 1. Know which operations are sensitive

Two kinds of operations go through approval.

**Whole operations.** Every call is sensitive:

| Area          | Operations                                                                                                                |
| ------------- | ------------------------------------------------------------------------------------------------------------------------- |
| Paid messages | Send a pay-per-view message                                                                                               |
| Vault         | Delete an asset; set or clear an asset's asking price                                                                     |
| Content       | Delete a post; remove a comment on the creator's post; re-issue the storefront link; add a new subscription price version |
| Marketplace   | Create a listing; accept an invitation; open, counter, accept or withdraw a negotiation; record a deal                    |
| Chat          | Block or unblock a fan; report a message                                                                                  |
| Orders        | Confirm (acknowledge) an order                                                                                            |
| AI            | Studio images, workflows, Copilot, voice, AI fan replies and AI automations                                               |

**Sensitive fields.** The operation is ordinary, but setting or changing these fields makes the call sensitive:

| Operation                                      | Fields                                                                                          |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| Send a message                                 | `viewOnce`, `expiresAt` (also needs the `write:messages:view_once` scope)                       |
| Queue a mass message                           | a draft with `unlockPrice` (a paid broadcast)                                                   |
| Create a content item                          | `priceCents`, `isGated`, `currency`                                                             |
| Update a content item                          | a change to `priceCents` or `currency`                                                          |
| Update the storefront                          | `defaultAmountCents`, `suggestedAmountsCents`, `minAmountCents`, `maxAmountCents`, `currency`   |
| Replace a marketplace listing's terms or offer | a price that is set or changed                                                                  |
| Save or replace a saved reply                  | `unlockPrice`                                                                                   |
| Set the welcome message                        | `unlockPrice` (alias `price`), when set or changed (also needs the `write:paid_messages` scope) |
| Set a message automation                       | `unlockPrice` (alias `price`), when set or changed (also needs the `write:paid_messages` scope) |

> **Tip**
>
> You do not have to hard-code these lists. [Get capabilities](https://developers.evvahub.com/api-reference/application/get-application-capabilities) returns, for every
> operation your application may call, `conditional: true` when the whole operation is sensitive and `conditionalFields`
> when only some fields are.

## 2. Send the request with an `Idempotency-Key`

A sensitive request from an application **must** carry an `Idempotency-Key`. Without one it is refused with
`400 IDEMPOTENCY_KEY_REQUIRED` before anything is opened or spent.

If the agency's rule lets it through, the operation runs and answers as usual. Otherwise you receive `202` and
**nothing has been done**:

**`cURL`**

```bash title="cURL"
curl -X POST "https://api.evvahub.com/partner/v1/accounts/$CREATOR_ID/conversations/$CONVERSATION_ID/paid-messages" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ppv-offer-0042" \
  -d '{
    "price": {"minor": "1500", "currency": "USD"},
    "attachments": [{"mediaAssetId": "asset_123"}],
    "body": "Unlock to see it",
    "authorship": "AI_AUTOMATED"
  }'
```

**`TypeScript`**

```typescript title="TypeScript"
import { ApprovalRequiredError } from '@evvahub/partner-sdk';

const input = {
  price: { minor: '1500', currency: 'USD' as const },
  attachments: [{ mediaAssetId: 'asset_123' }],
  text: 'Unlock to see it',
};
try {
  await evva.paidMessages.send(creatorId, conversationId, input);
} catch (error) {
  if (!(error instanceof ApprovalRequiredError)) throw error;
  // Nothing was sent. Keep the approval id and wait for approval.decided.
  savePending(error.approvalId, error.expiresAt);
}
```

**`Python`**

```python title="Python"
from evva_partner import ApprovalRequiredError

try:
    client.paid_messages.send(
        creator_id, conversation_id,
        price_minor=1500, media=["asset_123"], text="Unlock to see it",
    )
except ApprovalRequiredError as pending:
    # Nothing was sent. Keep the approval id and wait for approval.decided.
    save_pending(pending.approval_id, pending.expires_at)
```

**`Go`**

```go title="Go"
in := evvapartner.PaidMessageInput{
    Body:        "Unlock to see it",
    Price:       evvapartner.MinorUnits("1500", "USD"),
    Attachments: []evvapartner.PaidAttachment{{MediaAssetID: "asset_123"}},
}
_, err := client.PaidMessages.Send(ctx, creatorID, conversationID, in)
var pending *evvapartner.ApprovalRequiredError
if errors.As(err, &pending) {
    // Nothing was sent. Keep the approval id and wait for approval.decided.
    savePending(pending.ApprovalID, pending.ExpiresAt)
}
```

**`PHP`**

```php title="PHP"
try {
    $evva->paidMessages->send($creatorId, $conversationId, Money::usd(1500), [new Attachment('asset_123')], 'Unlock to see it');
} catch (ApprovalRequiredException $pending) {
    // Nothing was sent. Keep the approval id (and the key) and wait for approval.decided.
    savePending($pending->approvalId, $pending->idempotencyKey);
}
```

**`202 Accepted`**

```json title="202 Accepted"
{
  "code": "APPROVAL_REQUIRED",
  "error": "This action needs the approval of an authorised person",
  "approvalId": "apr_EXAMPLE0123456789abcdefg",
  "status": "PENDING",
  "reason": "NO_POLICY",
  "expiresAt": "2027-01-16T08:00:00.000Z",
  "requestId": "req_123"
}
```

| Field        | Meaning                                                                                                                                                      |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `approvalId` | The id to send back as `Partner-Approval-Id` once the request is approved (`apr_` followed by 24 characters).                                                |
| `reason`     | `NO_POLICY` (the agency has set no rule), `POLICY_REQUIRES_APPROVAL` (the rule asks for approval), or `LIMIT_EXCEEDED` (over the agency's automatic limits). |
| `expiresAt`  | The request, and an approval given for it, lapse at this time: 24 hours after the request by default.                                                        |

> **Warning**
>
> A `202 APPROVAL_REQUIRED` is never a success. The SDKs raise it as an error (`ApprovalRequiredError`, or
> `ApprovalRequiredException` in PHP) and never retry it on their own.

Sending the same request again with the same `Idempotency-Key` returns the same pending request rather than opening a
second one. The same key used for a different action is refused with `409 IDEMPOTENCY_KEY_REUSED`.

## 3. A person in the agency decides

The request appears in the Partner Hub under **Integrations → Approvals**. The agency owner and team leads can approve
or decline it for the creators they have access to. They see the operation, the creator, the amount, why it needs a
person and a fingerprint (SHA-256) of the exact request, never the request's content.

Your application learns the decision from its events ([webhooks](/webhooks/overview), [realtime](/realtime) or the
[event feed](/event-feed)):

| Event                | `data`                                                                                                                                            |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `approval.requested` | `approvalId`, `creatorId`, `operation`, `status: PENDING`, `reason`, `requestedAt`, `expiresAt`                                                   |
| `approval.decided`   | `approvalId`, `creatorId`, `operation`, `decision` (`APPROVED`, `DECLINED` or `REVOKED`), `reason` (only for `REVOKED`), `decidedAt`, `expiresAt` |

No event is sent when a request simply expires.

## 4. Re-send the approved request

Once `approval.decided` says `APPROVED`, send **the same request** again (same creator, same operation, same body)
with the `Partner-Approval-Id` header and an `Idempotency-Key`:

**`cURL`**

```bash title="cURL"
curl -X POST "https://api.evvahub.com/partner/v1/accounts/$CREATOR_ID/conversations/$CONVERSATION_ID/paid-messages" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ppv-offer-0042" \
  -H "Partner-Approval-Id: apr_EXAMPLE0123456789abcdefg" \
  -d '{
    "price": {"minor": "1500", "currency": "USD"},
    "attachments": [{"mediaAssetId": "asset_123"}],
    "body": "Unlock to see it",
    "authorship": "AI_AUTOMATED"
  }'
```

**`TypeScript`**

```typescript title="TypeScript"
await evva.paidMessages.send(creatorId, conversationId, { ...input, approvalId });
```

**`Python`**

```python title="Python"
client.paid_messages.send(
    creator_id, conversation_id,
    price_minor=1500, media=["asset_123"], text="Unlock to see it",
    approval_id=approval_id,
)
```

**`Go`**

```go title="Go"
_, err := client.PaidMessages.Send(ctx, creatorID, conversationID, in, evvapartner.WithApprovalID(approvalID))
```

**`PHP`**

```php title="PHP"
$evva->paidMessages->send(
    $creatorId, $conversationId, Money::usd(1500), [new Attachment('asset_123')], 'Unlock to see it',
    options: RequestOptions::approved($approvalId, $idempotencyKey),
);
```

What EVVA guarantees about an approval:

* **It is bound to the action.** It works only for your application, that creator, that operation and exactly that
  request body, and never for a higher amount, another currency or more units (for example more recipients of a mass
  message) than it was given for. Anything else is `403 APPROVAL_MISMATCH`.
* **It is spent once.** The first successful run uses it up. If the answer to that run is lost, repeating it with the
  **same** `Idempotency-Key` and approval returns the original result without a second effect. Any other key gets
  `409 APPROVAL_CONSUMED`.
* **A refusal does not burn it.** If the operation is refused before it takes effect (a `4xx`, `429` or `503`), the
  approval stays usable and you can send the request again.
* **Everything is checked again.** Your scopes, the agency's grant, the creator's consent and account status, price
  bounds and the object's current state are all re-checked when the approved request runs.

> **Note**
>
> **Bulk sends.** When an item of a [bulk send](https://developers.evvahub.com/api-reference/bulk/send-messages) is sensitive (for example a view-once
> message), that item answers `202 APPROVAL_REQUIRED` with the approval in its `details` (`approvalId`, `status`,
> `reason`, `expiresAt`), and nothing is sent for it.
> Re-send that item on its own through [Send a message](https://developers.evvahub.com/api-reference/messaging/send-message)
> with `Partner-Approval-Id`. A bulk request never spends an approval.

## Automatic limits

The agency owner sets automatic limits in the Partner Hub, either for every application (**Integrations → Automatic
limits**) or for one application (its **Automatic limits** tab). Each rule names an operation, optionally one
creator, a mode, and for **Automatic within limits**:

| Limit                 | Meaning                                                                                                          |
| --------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Actions per day       | Required. How many times the operation may run automatically per day. A paid mass message counts each recipient. |
| Currency              | Required when an amount limit is set.                                                                            |
| Max amount per action | Optional. The largest single amount that may run automatically.                                                  |
| Max amount per day    | Optional. The total amount that may run automatically per day.                                                   |

How the rules apply:

* **The most specific rule wins:** application and creator, then application, then creator, then agency-wide.
* **A limit is one budget at the level of its rule.** A rule for your application covers all its creators together;
  an agency-wide rule is shared by every application and every creator; a creator rule is shared by the agency's
  applications for that creator; a rule for one application and one creator is that pair's own budget.
* **Days are UTC calendar days.**
* **The amount** is the price you set (for a price change, the new price), or price × recipients for a paid mass
  message. Actions without an amount, such as deletes and blocks, count only towards actions per day.
* **Over the limit, nothing is refused:** the request waits for a person (`reason: LIMIT_EXCEEDED`). An approved request
  never uses the automatic budget.
* EVVA's own business rules still apply on every path: price bounds, the creator's account status and payment
  checks.

For a paid mass message, the recipients are counted when you queue it. The broadcast never reaches more recipients
than were counted or approved, and the part of the budget it did not use is given back once it stops.

## When an approval is revoked

A pending or approved request is revoked, and you receive `approval.decided` with `decision: REVOKED` and a `reason`,
as soon as what it relied on changes:

| `reason`                    | What changed                                                                                           |
| --------------------------- | ------------------------------------------------------------------------------------------------------ |
| `ACCESS_WITHDRAWN`          | The agency's grant, the creator group membership or the creator's consent no longer covers the action. |
| `POLICY_REPLACED`           | The rule that applied when the request was opened was replaced or removed.                             |
| `APPLICATION_NOT_ACTIVE`    | Your application was disabled or revoked.                                                              |
| `AGENCY_SUSPENDED`          | The agency was suspended.                                                                              |
| `CREATOR_INTEGRATIONS_HELD` | EVVA paused integrations for this creator.                                                             |
| `CREATOR_RESTRICTED`        | The creator's account no longer permits the operation.                                                 |
| `OPERATION_NOT_EXPOSED`     | The operation is no longer available to applications.                                                  |

## Errors

| HTTP | `code`                     | Meaning                                                                                       | What to do                                          |
| ---- | -------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| 202  | `APPROVAL_REQUIRED`        | Not an error: the action waits for a person. Nothing was done.                                | Keep `approvalId`; wait for `approval.decided`.     |
| 400  | `IDEMPOTENCY_KEY_REQUIRED` | A sensitive request without `Idempotency-Key`.                                                | Add a key.                                          |
| 403  | `ACTION_DENIED_BY_POLICY`  | The agency's rule is **Never allow**.                                                         | Do not retry.                                       |
| 403  | `APPROVAL_INVALID`         | `Partner-Approval-Id` is unknown, malformed or not your application's.                        | Check the id.                                       |
| 403  | `APPROVAL_MISMATCH`        | The approval was given for another creator, operation, body, amount, currency or fewer units. | Re-send exactly the approved request, or ask again. |
| 403  | `APPROVAL_DECLINED`        | A person declined it.                                                                         | Do not retry.                                       |
| 403  | `APPROVAL_REVOKED`         | The approval was voided because access or the rule changed.                                   | Ask again if the action is still needed.            |
| 409  | `APPROVAL_PENDING`         | Not decided yet.                                                                              | Wait for `approval.decided`.                        |
| 409  | `APPROVAL_EXPIRED`         | The request or the approval lapsed (24 hours by default).                                     | Ask again with a new `Idempotency-Key`.             |
| 409  | `APPROVAL_CONSUMED`        | The approval was already used.                                                                | Read the resource to see the result.                |
| 409  | `IDEMPOTENCY_KEY_REUSED`   | The key was used for a different action.                                                      | Use a new key for a new action.                     |

## Next steps

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

Financial and destructive scopes, and why they are off by default.

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

How `Idempotency-Key` works across the API.

#### [Event feed](/event-feed)

Receive `approval.decided` reliably, even after downtime.

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

The full error code catalogue.