# Estimate envelope cost

`POST /v1/accounts/{accountId}/envelopes/estimate-cost`

What creating the envelope would cost, creating and charging nothing. Takes the creation body and checks it as creation does (`max_total_credits` aside); answers as an assignment's estimate: the envelope counts as one document (`documents` is 1, an extra one when the plan's allowance doesn't cover it), each signer's notifications and identity check count once for the whole envelope, and each digital-certificate signature on every document it is made on, as creation charges them.

**Authentication:** Bearer access token (`Authorization: Bearer ...`) or API key (`X-Api-Key` header).

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `accountId` | path | string | yes | Workspace account ID. |

## Request Body (required)

Fields (`application/json`):

- `name` (string, required) — What the invitation calls what is being signed, in place of a document's name. `<` is refused (`400`).
- `message` (Array) — Optional message sent to every signer; their invitation adds the names of the documents they are on.
- `max_total_credits` (number) — Optional ceiling on what this request may spend, as on an assignment: refused with `409` and code `CreditCeilingExceeded`, nothing created or charged, when the envelope's total credits are above it. A value that is not a number of credits, zero or more, answers `400`; numeric text counts, as a form-encoded body sends it. The estimate ignores it.
- `signers` (array, required) — Every signer of the envelope, once, by id: up to 20. They all sign at once: an envelope takes no `step`.
- `documents` (array, required) — The documents, in the order the envelope lists them: up to 20.

Example:

```json
{
    "name": "Contrato de prestação de serviços",
    "message": "Segue o contrato e seus anexos.",
    "max_total_credits": 1.5,
    "signers": [
        {
            "id": "fa8c140cb49b79f940aab95fddd",
            "verification_method": "Email",
            "notification_methods": [
                "Email"
            ],
            "embedded": true
        }
    ],
    "documents": [
        {
            "id": "615601fab04c0a3147bb1246",
            "method": "virtual",
            "entries": [
                {
                    "page_id": "string",
                    "fields": [
                        {
                            "signer_id": "string",
                            "field_id": "string",
                            "display_settings": {
                                "left": 69,
                                "top": 282,
                                "width": 421,
                                "height": 45.86,
                                "fontFamily": "Arial",
                                "fontSize": 22,
                                "backgroundColor": "#D5EBFF"
                            }
                        }
                    ]
                }
            ],
            "signer_ids": [
                "fa8c140cb49b79f940aab95fddd"
            ],
            "expires_at": "2026-12-31T23:59:59Z",
            "copy_receiver_ids": [
                "cr8c140cb49b79f940aab95fddd"
            ]
        }
    ]
}
```

## Responses

### 200 — Cost estimate and balances

```json
{
    "data": {
        "documents": 1,
        "credits": 0.9,
        "needs_extra_document": true,
        "extra_document_cost": 1,
        "total_credits": 1.9,
        "breakdown": [
            {
                "code": "NotificationWhatsapp",
                "name": "Whatsapp Notification",
                "cost": 0.9,
                "quantity": 2,
                "unit_cost": 0.45
            }
        ],
        "document_balance": 0,
        "credit_balance": 10,
        "has_sufficient_resources": true,
        "blocking_reason": null,
        "message": null
    },
    "status": 200,
    "message": ""
}
```

### 400 — Refused on the same fields as creation, in `errors`, and with `message` alone for a method the platform does not know or a pairing it refuses. What creation checks while it creates each document (a signer's missing contact, a page or field not found, the balance) is not checked here: `has_sufficient_resources` says what the balance allows.

```json
{
    "status": 400,
    "message": "Add at least one item to documents.",
    "errors": [
        {
            "field": "documents",
            "code": "Required",
            "message": "Add at least one item to documents."
        }
    ]
}
```

### 403 — The workspace's plan lacks the Envelopes feature, or a signer's method or embedded signing the plan lacks (`PlanRestricted`); or an OAuth app's token lacks `documents:write` (`InsufficientScope`). Also a member deactivated in the workspace, a workspace scheduled for deletion, or an OAuth token of another workspace.

```json
{
    "status": 400,
    "code": "PlanRestricted",
    "message": "Bad request.",
    "data": null,
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 404 — The requested resource does not exist.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 401 — Missing or invalid credentials.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 500 — Unexpected server error.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```
