Atomside docsThis page as Markdown

Wait for approval: wait_for_approval

Waits for a person to decide on a letter, for up to 50 seconds a call, and returns early when they do: approved, declined with the note, or lapsed. If it is still waiting, call again. Free. Never send the letter again while it waits. A group reference (grp_…) waits for the decision on the whole group: how many were approved, and each declined letter with its note.

MCP toolwait_for_approval
RESTGET /v1/letters/{letter}/approval
CLIatomside wait-for-approval
Key needsRead (letters:read)
Changes anythingNo. It only reads.
Idempotency keyNot used.

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:

curl https://api.atomside.com/v1/letters/ltr_example000000005/approval?timeout_seconds=0 \
  -H "Authorization: Bearer $ATOMSIDE_API_KEY"

MCP:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wait_for_approval",
    "arguments": {
      "timeout_seconds": "0",
      "letter": "ltr_example000000005"
    }
  }
}

CLI:

atomside wait-for-approval \
  --timeout-seconds 0 \
  --letter ltr_example000000005

The answer (HTTP 200; over MCP, the same JSON is the result's structuredContent):

{
  "letter": "ltr_example000000005",
  "status": "still_waiting",
  "letter_status": "waiting_for_approval",
  "via": null,
  "by": null,
  "at": null,
  "covers": "sha256 43341b592305c74063413681ae2bbd2106cd255d3829a72aada68d74272ca368",
  "note": null,
  "charged": {
    "credits": 0,
    "gbp": "0.00"
  },
  "approval": "apr_example000000001",
  "by_link": null,
  "money": {
    "held": {
      "credits": 15,
      "gbp": "1.50"
    },
    "charged": {
      "credits": 0,
      "gbp": "0.00"
    },
    "returned": {
      "credits": 0,
      "gbp": "0.00"
    },
    "say": "15 credits (£1.50) are held now and charged when it is posted."
  },
  "link": "https://app.atomside.com/a/…",
  "expires": "2026-11-18T09:30:00.000Z",
  "says": "Nobody has decided yet.",
  "next": "Call again. The link works until 09:30 on Wed 18 Nov."
}

Input

Over REST, fields in the path go in the path, GET fields in the query string, and POST fields in the JSON body. Over MCP, every field is an argument of the tool.

{
  "type": "object",
  "properties": {
    "letter": {
      "type": "string",
      "description": "The letter id, ltr_…, or a group, grp_…."
    },
    "timeout_seconds": {
      "default": 50,
      "type": "integer",
      "minimum": 0,
      "maximum": 50
    }
  },
  "required": [
    "letter"
  ],
  "additionalProperties": false
}

Output

{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "letter": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "still_waiting",
            "approved",
            "declined",
            "lapsed",
            "withdrawn",
            "not_waiting"
          ],
          "description": "not_waiting: the letter never needed a person, or no longer waits."
        },
        "letter_status": {
          "type": "string",
          "enum": [
            "quoted",
            "waiting_for_approval",
            "queued",
            "printing",
            "printed",
            "posted",
            "on_record",
            "declined",
            "lapsed",
            "cancelled",
            "held",
            "failed",
            "returned"
          ]
        },
        "via": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "email",
                "console",
                "chat_link",
                "test_trigger",
                "link"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "by": {
          "description": "Who decided.",
          "type": [
            "string",
            "null"
          ]
        },
        "at": {
          "anyOf": [
            {
              "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))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "covers": {
          "type": [
            "string",
            "null"
          ]
        },
        "note": {
          "description": "The decline note, word for word.",
          "type": [
            "string",
            "null"
          ]
        },
        "charged": {
          "type": "object",
          "properties": {
            "credits": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Whole credits. 1 credit is 10p."
            },
            "gbp": {
              "type": "string",
              "pattern": "^-?\\d+\\.\\d{2}$",
              "description": "The same amount in pounds, ex VAT, as a decimal string."
            }
          },
          "required": [
            "credits",
            "gbp"
          ],
          "additionalProperties": false,
          "description": "Charged for the letter so far: the same as money.charged."
        },
        "approval": {
          "description": "The approval, apr_…, as approval.id on get_letter. Null if it never asked anyone.",
          "type": [
            "string",
            "null"
          ]
        },
        "by_link": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "approval": {
                  "type": "string",
                  "description": "The approval, apr_…, to pass to create_approval_link."
                },
                "make_with": {
                  "type": "string",
                  "const": "create_approval_link"
                }
              },
              "required": [
                "approval",
                "make_with"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ],
          "description": "While it waits and a person at the letter's customer approves it, by a link you make: the approval to make it for. Null otherwise."
        },
        "money": {
          "type": "object",
          "properties": {
            "held": {
              "type": "object",
              "properties": {
                "credits": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Whole credits. 1 credit is 10p."
                },
                "gbp": {
                  "type": "string",
                  "pattern": "^-?\\d+\\.\\d{2}$",
                  "description": "The same amount in pounds, ex VAT, as a decimal string."
                }
              },
              "required": [
                "credits",
                "gbp"
              ],
              "additionalProperties": false,
              "description": "Held for it now: taken from the balance at send, charged at posting."
            },
            "charged": {
              "type": "object",
              "properties": {
                "credits": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Whole credits. 1 credit is 10p."
                },
                "gbp": {
                  "type": "string",
                  "pattern": "^-?\\d+\\.\\d{2}$",
                  "description": "The same amount in pounds, ex VAT, as a decimal string."
                }
              },
              "required": [
                "credits",
                "gbp"
              ],
              "additionalProperties": false,
              "description": "An amount in credits, with pounds beside it."
            },
            "returned": {
              "type": "object",
              "properties": {
                "credits": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Whole credits. 1 credit is 10p."
                },
                "gbp": {
                  "type": "string",
                  "pattern": "^-?\\d+\\.\\d{2}$",
                  "description": "The same amount in pounds, ex VAT, as a decimal string."
                }
              },
              "required": [
                "credits",
                "gbp"
              ],
              "additionalProperties": false,
              "description": "Given back to the balance."
            },
            "say": {
              "type": "string"
            }
          },
          "required": [
            "held",
            "charged",
            "returned",
            "say"
          ],
          "additionalProperties": false,
          "description": "The letter's money as get_letter shows it, with a sentence to repeat."
        },
        "link": {
          "description": "The approval link, while it still works.",
          "type": [
            "string",
            "null"
          ]
        },
        "expires": {
          "anyOf": [
            {
              "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))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "says": {
          "type": "string",
          "description": "A sentence to repeat to your person as it stands."
        },
        "next": {
          "type": "string"
        }
      },
      "required": [
        "letter",
        "status",
        "letter_status",
        "via",
        "by",
        "at",
        "covers",
        "note",
        "charged",
        "approval",
        "by_link",
        "money",
        "link",
        "expires",
        "says",
        "next"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "group": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "still_waiting",
            "decided",
            "lapsed",
            "withdrawn",
            "not_waiting"
          ],
          "description": "decided: a person approved some or all and declined the rest. not_waiting: the group never needed a person."
        },
        "approved": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Letters approved."
        },
        "declined": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "n": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "letter": {
                "type": "string"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "n",
              "letter",
              "note"
            ],
            "additionalProperties": false
          },
          "description": "Each declined letter with its note, word for word."
        },
        "waiting": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Letters still waiting for a person."
        },
        "via": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "email",
                "console",
                "chat_link",
                "test_trigger",
                "link"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "by": {
          "description": "Who decided.",
          "type": [
            "string",
            "null"
          ]
        },
        "at": {
          "anyOf": [
            {
              "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))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "link": {
          "description": "The approval link for the group, while it still works.",
          "type": [
            "string",
            "null"
          ]
        },
        "expires": {
          "anyOf": [
            {
              "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))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "says": {
          "type": "string",
          "description": "A sentence to repeat to your person as it stands."
        },
        "next": {
          "type": "string"
        }
      },
      "required": [
        "group",
        "status",
        "approved",
        "declined",
        "waiting",
        "via",
        "by",
        "at",
        "link",
        "expires",
        "says",
        "next"
      ],
      "additionalProperties": false
    }
  ]
}

Refusals

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

CodeAnswerRetryHTTPWhat to do next
key_missingnoafter_fix401Send the key as "Authorization: Bearer as_test_…". Ask your person if you have none.
key_not_validnonever401Ask your person for a new key. There is no link: we cannot say whose it was.
scope_missingnoafter_person403Ask your person to give the key that permission.
invalid_requestnoafter_fix400Fix the field named in details.field. The same idempotency key is fine.
rate_limitednoat_time429Wait. The same idempotency key never sends twice.
try_again_shortlynoat_time503Try again after retry_after with the same idempotency key.
account_expirednonever401Start again with start_account if your person still wants this.
connection_endednoafter_person401Tell your person. To carry on, they connect Atomside again in your assistant.
letter_not_foundnoafter_fix404Check the id with list_letters.
not_foundnoafter_fix404Check the name against the tool list or /v1/openapi.json.