<!-- Generated from the operation definitions by `pnpm docs:reference`. Do not edit by hand. -->

# Make an approval link: `create_approval_link`

Makes a one-time link for your customer's own user to read a letter waiting for approval and approve or decline it, confirmed by a six-digit code we email to them. Only for a letter sent for a customer, and only when approval links are on in Brand and approvals. With "Atomside sends it" we email the link in your brand; otherwise show the url yourself. The link works for one decision, until expires_at. Takes an Idempotency-Key: a retry with the same key gives the same link and sends no second email. Asking again for the same approval and approver with a new key gives the same link too, while it works.

| | |
|---|---|
| MCP tool | None: it manages your customers, so it is kept out of the tools an agent reads. Use REST, the CLI or the SDK. |
| REST | `POST /v1/approvals/{approval}/links` |
| CLI | `atomside create-approval-link` |
| Key needs | Manage customers (`customers:manage`) |
| Changes anything | Yes. |
| Idempotency key | Required: the `Idempotency-Key` header over REST, `--idempotency-key` in the CLI. |

## Example

A real call and its real answer, made against the API in test mode. A test runs it again and fails if the answer changes. Ids, keys and links are replaced with stand-ins.

### A call that works

REST:

```sh
curl -X POST https://api.atomside.com/v1/approvals/apr_example000000002/links \
  -H "Authorization: Bearer $ATOMSIDE_API_KEY" \
  -H "Idempotency-Key: link-acme-rent-review-sample" \
  -H "Content-Type: application/json" \
  -d '{
  "approver_email": "j.sample@acmelettings.example",
  "approver_name": "J. Sample",
  "approver_ref": "user_4471"
}'
```

CLI:

```sh
atomside create-approval-link \
  --approver-email j.sample@acmelettings.example \
  --approver-name 'J. Sample' \
  --approver-ref user_4471 \
  --approval apr_example000000002 \
  --idempotency-key link-acme-rent-review-sample
```

The answer (HTTP 200):

```json
{
  "id": "apl_example000000001",
  "url": "https://app.atomside.com/l/…",
  "expires_at": "2026-11-17T09:30:00.000Z",
  "emailed": true
}
```

## Input

Over REST, fields in the path go in the path, GET fields in the query string, and POST fields in the JSON body.

```json
{
  "type": "object",
  "properties": {
    "approval": {
      "type": "string",
      "description": "The approval, apr_…: details.approval.by_link.approval in the send_letter answer, approval.id (or approval.by_link.approval) on get_letter, or approval.id in the letter.waiting_for_approval event."
    },
    "approver_email": {
      "type": "string",
      "maxLength": 254,
      "format": "email",
      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
      "description": "Where we send the code (and the link, when Atomside sends it)."
    },
    "approver_name": {
      "description": "Their name, as the email greets them.",
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "approver_ref": {
      "description": "Your own id for this user, kept with the decision.",
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    }
  },
  "required": [
    "approval",
    "approver_email"
  ],
  "additionalProperties": false
}
```

## Output

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The link, apl_…."
    },
    "url": {
      "type": "string",
      "description": "The page that opens it. Shown once."
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "emailed": {
      "type": "boolean",
      "description": "True when Atomside emailed the link to the approver."
    }
  },
  "required": [
    "id",
    "url",
    "expires_at",
    "emailed"
  ],
  "additionalProperties": false
}
```

## Refusals

Every refusal has the same shape. Branch on `code`, `answer` and `retry`; repeat `say` to your person.

| Code | Answer | Retry | HTTP | What to do next |
|---|---|---|---|---|
| [`key_missing`](../refusals.md#key_missing) | no | after_fix | 401 | Send the key as "Authorization: Bearer as_test_…". Ask your person if you have none. |
| [`key_not_valid`](../refusals.md#key_not_valid) | no | never | 401 | Ask your person for a new key. There is no link: we cannot say whose it was. |
| [`scope_missing`](../refusals.md#scope_missing) | no | after_person | 403 | Ask your person to give the key that permission. |
| [`invalid_request`](../refusals.md#invalid_request) | no | after_fix | 400 | Fix the field named in details.field. The same idempotency key is fine. |
| [`rate_limited`](../refusals.md#rate_limited) | no | at_time | 429 | Wait. The same idempotency key never sends twice. |
| [`try_again_shortly`](../refusals.md#try_again_shortly) | no | at_time | 503 | Try again after retry_after with the same idempotency key. |
| [`account_expired`](../refusals.md#account_expired) | no | never | 401 | Start again with start_account if your person still wants this. |
| [`connection_ended`](../refusals.md#connection_ended) | no | after_person | 401 | Tell your person. To carry on, they connect Atomside again in your assistant. |
| [`idempotency_key_reused`](../refusals.md#idempotency_key_reused) | no | after_fix | 409 | Check first: the earlier call may be the one you meant. Otherwise use a new key. |
| [`request_in_progress`](../refusals.md#request_in_progress) | no | at_time | 409 | Wait, then repeat the same call with the same key. You will get its answer. |
| [`approval_links_off`](../refusals.md#approval_links_off) | no | after_person | 403 | Do not retry. Pass on the approval link from send_letter to your team instead. |
| [`approval_not_waiting`](../refusals.md#approval_not_waiting) | no | never | 409 | Read the letter with get_letter to see what happened. |
| [`approval_not_for_customer`](../refusals.md#approval_not_for_customer) | no | never | 422 | Pass on the approval link from send_letter instead. |
| [`customer_suspended`](../refusals.md#customer_suspended) | no | after_person | 403 | Do not retry. Tell the person you are working for. |
| [`customer_closed`](../refusals.md#customer_closed) | no | never | 409 | Do not retry. Make a new customer with a new ref if your person wants to write again. |
| [`approval_link_gone`](../refusals.md#approval_link_gone) | no | after_fix | 410 | Read the letter with get_letter. If it still waits, make a new link with a new Idempotency-Key. |
| [`not_found`](../refusals.md#not_found) | no | after_fix | 404 | Check the name against the tool list or /v1/openapi.json. |
