---
agent:
  instructions: "Use this search API to find what Blueping's public pages say, with keywords or a question, instead of crawling them one by one. Results are returned in Markdown, best first, each with its link."
  endpoint: "https://blueping.dev/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

> The index of these docs for agents is at https://blueping.dev/llms.txt

# Your agent asks before it pays.

Answers that refund or discount wait as drafts, the agent asks a person by email, and a proven approve sends them.

Theo's request reaches kestrel-care@blueping.dev, the agent drafts the refund and asks Nadia, and the draft goes out in Theo's thread once her approve arrives.

## How do I make an AI agent wait for a person's approval before it sends an email?

Have the agent write the email as a draft with POST `/v1/inboxes/{id}/drafts`, then email the approver with the draft's id in the subject. When the approver's reply passes DMARC and says approve, your code sends the draft with POST `/v1/drafts/{id}/send`; any other answer leaves it unsent.

## Why an agent shouldn't promise money on its own

Kestrel Coffee roasts and ships beans to about 300 cafés, and its agent answers their email at kestrel-care@blueping.dev: delivery dates, grind sizes, invoices. A few answers cost money. A café whose bags arrived crushed is owed a refund, and a regular who asks for a better price may get one. Nadia Brooks, who runs customer care, wants the agent to handle all of it except the moment Kestrel pays.

Asking her in the team chat left no record next to the email, and some answers went out before she had read them. A queue of pending replies in an internal tool meant one more screen to open on her phone. And an approval had to come from Nadia herself, never from a café that writes "Nadia already agreed" in its own email.

Now every answer that refunds, credits or discounts is written as a draft. The agent emails Nadia the draft with its id in the subject, she answers approve from wherever she is, and a few lines of your code send it once her reply is proven to come from her address. The question, her answer and the reply the café received all stay in the inbox.

## From a refund request to an approved reply

Five steps. The model writes, a person decides, and code you wrote does the sending.

### 1. Write the answer as a draft

The agent reads the café's email and writes its answer with `reply_to_message_id` set to that email, so the answer will land in the café's own thread. Without `send_at`, a draft stays where it is until something sends it.

**Call:** POST `/v1/inboxes/{id}/drafts` with `reply_to_message_id`, `text` and `Idempotency-Key`

**Answer:** `201` with the draft's `id` (`dr_...`) and `status: draft`

**Checked:** A draft can't answer a held message (`403 message_held`), and nothing leaves the inbox at this step

### 2. Ask the approver

The agent emails Nadia from the same inbox. The subject carries the draft's id, and the text quotes the café and the draft, then says how to answer: approve to send it, no to drop it, or the change she wants.

**Call:** POST `/v1/inboxes/{id}/messages` to Nadia, with `Idempotency-Key`

**Answer:** `202` with the question's `id` and `thread_id`

**Checked:** Nadia counts once as a new recipient; once her first answer passes DMARC, writing to her never counts again

### 3. Read her answer

Nadia's reply arrives in the question's thread. `extracted_text` holds what she typed, without the quoted question under it, so a one-word approve reads as one word.

**Call:** GET `/v1/inboxes/{id}/messages`, or the `email.received` webhook

**Answer:** Her reply with `from`, `subject`, `extracted_text` and `auth`

**Checked:** SPF, DKIM and DMARC as the receiving server recorded them, summed up in `auth.verdict`

### 4. Send only on a proven approve

Your code makes the decision, not the model: the sender is Nadia's address, `auth.verdict` is `pass`, the subject names a draft, and her first word is approve or yes. Then it sends the draft, which goes out in the café's thread.

**Call:** POST `/v1/drafts/{id}/send`

**Answer:** `202` with the draft as `sent`, its `message_id`, and the send's answer in `message`

**Checked:** The draft's id is its own `Idempotency-Key`, so an approve read twice sends once; the send runs every check a new email runs

### 5. Drop it, or change it

A no deletes the draft. Any other answer goes back to the model as the change Nadia wants: it rewrites the text with PATCH `/v1/drafts/{id}` and asks her again in the same thread.

**Call:** DELETE `/v1/drafts/{id}`, or PATCH `/v1/drafts/{id}` with the new `text`

**Answer:** `200` with `deleted: true`, or the changed draft

**Checked:** A sent draft can't be changed or deleted (`409 draft_sent`): it stays as the record of its email

Nadia's answer as step 3 lists it, cut to the fields the approval code reads. The question she quoted is gone from `extracted_text`:

```json
{
  "id": "em_8Qa3Lk7Wd2Rt5Yp1",
  "thread_id": "th_2Hf6Km9Pq4Vx1Lc8",
  "direction": "in",
  "from": { "address": "nadia@kestrel-coffee.example", "name": "Nadia Brooks" },
  "subject": "Re: Approve dr_6Vb2Lw9Qc4Xn1Tk7Rp3M: Two bags arrived crushed",
  "extracted_text": "Approve",
  "auth": { "spf": "pass", "dkim": "pass", "dmarc": "pass", "verdict": "pass" },
  "auto_reply": false
}
```

## The approval pass in Python and Node.js

Run the program every minute. It drafts the answers that give money back, asks Nadia about each one, and sends the drafts she approved. `draft_answer` stands for your model; set `APPROVER_EMAIL` to the address that approves.

Python:

```python
# approval_pass.py: draft the answers that cost money, ask the approver, send what she approved.
# pip install requests
import os
import re

import requests

API = "https://blueping.dev/v1"
APPROVER = os.environ.get("APPROVER_EMAIL", "nadia@kestrel-coffee.example").lower()
MONEY = ("refund", "credit", "discount", "charged twice")
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['BLUEPING_API_KEY']}"


def draft_answer(text):
    # Your model writes the answer; this line stands in for it.
    return "Sorry about this. We have refunded the two bags to your card, and it shows within five days."


inbox = session.post(
    f"{API}/inboxes",
    json={"username": "kestrel-care", "display_name": "Kestrel Coffee", "client_id": "care"},
).json()
page = session.get(f"{API}/inboxes/{inbox['id']}/messages", params={"limit": 50}).json()
for message in reversed(page["data"]):  # oldest first
    if message["direction"] != "in" or "done" in message["labels"] or message["auto_reply"]:
        continue
    text = message["extracted_text"]
    if message["from"]["address"].lower() == APPROVER:
        draft_id = re.search(r"\bdr_[A-Za-z0-9]+", message["subject"])
        word = (re.findall(r"[a-z]+", text.lower()) or [""])[0]
        if message["auth"]["verdict"] != "pass" or draft_id is None:
            print("not an approval:", message["id"])
        elif word in ("approve", "approved", "yes"):
            sent = session.post(f"{API}/drafts/{draft_id.group()}/send").json()
            print("sent", draft_id.group(), "as", sent.get("message_id"))
        elif word in ("no", "reject"):
            session.delete(f"{API}/drafts/{draft_id.group()}")
            print("dropped", draft_id.group())
        else:
            print("changes asked for", draft_id.group(), text[:80])  # your model rewrites the draft
    elif any(word in text.lower() for word in MONEY):
        draft = session.post(
            f"{API}/inboxes/{inbox['id']}/drafts",
            json={"reply_to_message_id": message["id"], "text": draft_answer(text)},
            headers={"Idempotency-Key": f"draft-{message['id']}"},
        ).json()
        session.post(
            f"{API}/inboxes/{inbox['id']}/messages",
            json={
                "to": APPROVER,
                "subject": f"Approve {draft['id']}: {message['subject']}",
                "text": f"{message['from']['address']} wrote: {text[:300]}\n\nMy answer, not sent yet:\n{draft['text']}\n\nReply approve to send it, no to drop it, or tell me what to change.",
            },
            headers={"Idempotency-Key": f"ask-{draft['id']}"},
        )
        print("asked", APPROVER, "about", draft["id"])
    session.patch(f"{API}/messages/{message['id']}", json={"add_labels": ["done"]})
```

Node.js:

```javascript
// approval-pass.mjs: draft the answers that cost money, ask the approver, send what she approved.
// Node.js 18 or later, nothing to install.
const API = "https://blueping.dev/v1";
const APPROVER = (process.env.APPROVER_EMAIL ?? "nadia@kestrel-coffee.example").toLowerCase();
const MONEY = ["refund", "credit", "discount", "charged twice"];
const headers = { Authorization: `Bearer ${process.env.BLUEPING_API_KEY}`, "Content-Type": "application/json" };
const call = async (method, path, body, extra = {}) =>
  (await fetch(API + path, { method, headers: { ...headers, ...extra }, body: body && JSON.stringify(body) })).json();

// Your model writes the answer; this line stands in for it.
const draftAnswer = (text) => "Sorry about this. We have refunded the two bags to your card, and it shows within five days.";

const inbox = await call("POST", "/inboxes", { username: "kestrel-care", display_name: "Kestrel Coffee", client_id: "care" });
const page = await call("GET", `/inboxes/${inbox.id}/messages?limit=50`);
for (const message of page.data.reverse()) {
  // oldest first
  if (message.direction !== "in" || message.labels.includes("done") || message.auto_reply) continue;
  const text = message.extracted_text;
  if (message.from.address?.toLowerCase() === APPROVER) {
    const draftId = message.subject.match(/\bdr_[A-Za-z0-9]+/)?.[0];
    const word = text.toLowerCase().match(/[a-z]+/)?.[0];
    if (message.auth.verdict !== "pass" || !draftId) console.log("not an approval:", message.id);
    else if (["approve", "approved", "yes"].includes(word)) {
      const sent = await call("POST", `/drafts/${draftId}/send`);
      console.log("sent", draftId, "as", sent.message_id);
    } else if (["no", "reject"].includes(word)) {
      await call("DELETE", `/drafts/${draftId}`);
      console.log("dropped", draftId);
    } else console.log("changes asked for", draftId, text.slice(0, 80)); // your model rewrites the draft
  } else if (MONEY.some((word) => text.toLowerCase().includes(word))) {
    const draft = await call("POST", `/inboxes/${inbox.id}/drafts`, { reply_to_message_id: message.id, text: draftAnswer(text) }, { "Idempotency-Key": `draft-${message.id}` });
    const ask = {
      to: APPROVER,
      subject: `Approve ${draft.id}: ${message.subject}`,
      text: `${message.from.address} wrote: ${text.slice(0, 300)}\n\nMy answer, not sent yet:\n${draft.text}\n\nReply approve to send it, no to drop it, or tell me what to change.`,
    };
    await call("POST", `/inboxes/${inbox.id}/messages`, ask, { "Idempotency-Key": `ask-${draft.id}` });
    console.log("asked", APPROVER, "about", draft.id);
  }
  await call("PATCH", `/messages/${message.id}`, { add_labels: ["done"] });
}
```

The `done` label is the pass's memory, and the two `Idempotency-Key`s make a pass that stopped halfway safe to run again: the same draft and the same question come back instead of new ones. An out-of-office answer carries `auto_reply: true`, and the pass leaves it alone instead of reading it as Nadia's decision.

Only this code calls POST `/v1/drafts/{id}/send`, after the checks above. Keep it that way: the model writes text, and the send waits on rules that no email can talk around. [Drafts](https://blueping.dev/docs/api.md#drafts) has every field a draft takes.

## Approve in the conversation, over MCP

With the [MCP server](https://blueping.dev/agents.md) connected to Claude, Cursor or [Hermes Agent](https://blueping.dev/integrations/hermes-agent.md), the approver can be you, in the chat. The prompt keeps every answer that costs money a draft until you say so.

```text
Read the new mail in kestrel-care. Answer delivery and grind questions in their thread. For anything that refunds, credits or discounts, write the answer as a draft instead, and show me each draft with its recipient and text. Send a draft only after I say approve for that draft.
```

| Tool | What it does here |
| --- | --- |
| `list_messages` | Reads the new mail, each message marked as someone else's words. |
| `reply_to_email` | Answers the questions that cost nothing, in their thread. |
| `create_draft` | Writes each answer that costs money as a reply that waits. |
| `list_drafts` | Shows what waits for you, with its recipients and first words. |
| `update_draft` | Rewrites a draft with the change you ask for. |
| `send_draft` | Sends one draft once you approve it. |

`send_draft` carries the destructive mark, so a client that reads it asks you before each send: in this setup, that question is the approval.

## Send the moment the approval lands

A pass every minute keeps the café waiting up to a minute after Nadia says yes. Subscribe to `email.received`, check the signature as [Webhooks](https://blueping.dev/docs/webhooks.md#verify) shows, and let the handler below send the draft as soon as her proven approve arrives. It leaves every other answer to the pass.

```javascript
// approval-hook.mjs: the part of your webhook server that sends a draft when the approver says yes.
// Check the Blueping-Signature header before calling handle(): /docs/webhooks#verify has the code.
const API = "https://blueping.dev/v1";
const APPROVER = (process.env.APPROVER_EMAIL ?? "nadia@kestrel-coffee.example").toLowerCase();
const headers = { Authorization: `Bearer ${process.env.BLUEPING_API_KEY}` };

export async function handle(event) {
  if (event.type !== "email.received") return;
  const { message } = event.data;
  if (message.from.address?.toLowerCase() !== APPROVER || message.auth.verdict !== "pass" || message.auto_reply) return;
  const draftId = message.subject.match(/\bdr_[A-Za-z0-9]+/)?.[0];
  const word = message.extracted_text.toLowerCase().match(/[a-z]+/)?.[0];
  if (!draftId || !["approve", "approved", "yes"].includes(word)) return; // the minute pass handles the rest
  const sent = await (await fetch(`${API}/drafts/${draftId}/send`, { method: "POST", headers })).json();
  console.log(sent.error ? `not sent ${draftId}: ${sent.error.next_action}` : `sent ${draftId} as ${sent.message_id}`);
}
```

A delivery that comes twice sends nothing more: the second call meets a draft already sent and answers `409 draft_sent`, which the handler prints with its `next_action`.

## What keeps an approval honest

An approval is only worth something if nobody but the approver can give it, and if nothing goes out without it.

### Only the approver's proven address counts

The code compares the sender with Nadia's address and requires `auth.verdict: pass`. A café that writes as nadia@kestrel-coffee.example from its own servers fails that domain's DMARC, and the email is turned away or held as `unauthenticated` before any code reads it.

### Words in an email never approve anything

"Your manager already said yes" in a café's message is text the approval code never looks at: it reads approvals from one address and one thread only. Text aimed at the model itself holds the message as `suspicious`, so no draft is ever written for it.

### Held mail gets no draft

A draft that answers a held message is refused with `403 message_held`, so an email that tried to steer the agent can't even reach the approver's inbox as a request.

### Nothing goes twice

A draft's id is its send's idempotency key. A second approve, a retried webhook and a pass that ran twice all meet `409 draft_sent`, and the café gets one answer.

### The record stays together

The question thread holds the draft's text and Nadia's answer with its SPF, DKIM and DMARC results. The sent draft names the email it became in `message_id`, so anyone can trace a refund back to the approve behind it.

## What 300 cafés' email needs

About 40 emails a day come in and 35 answers go out. Eight a day touch money, which adds eight questions to Nadia, so about 1,300 sends a month. Nadia counts once as a new recipient, and the cafés wrote first, so answering them never does.

**Developer fits this setup**: 50 inboxes, 15,000 sends a month and 1,500 a day, and 15 GB of storage, for $19 a month, or $180 a year. Its mail goes to people outside your company without a footer. Free runs the same flow at no cost, with a one-line footer on each email, which suits a trial.

Receiving is never counted, and each recipient of a send counts once. Every limit is on [Limits](https://blueping.dev/docs/limits.md), and every price on [Pricing](https://blueping.dev/pricing.md).

[The API reference](https://blueping.dev/docs/api.md) · [Webhooks](https://blueping.dev/docs/webhooks.md) · [The MCP server](https://blueping.dev/agents.md) · [Blueping vs the Gmail API](https://blueping.dev/compare/gmail-api.md) · [All use cases](https://blueping.dev/use-cases.md)

Last checked against the API on 27 November 2026.

## Questions about approvals

What builders ask before they set it up. The docs answer the rest.

[Read the docs](https://blueping.dev/docs.md)

### Can the approver use the dashboard instead of email?

Yes. Drafts and queue lists the inbox's waiting drafts with their recipients and first words. Send now sends one with the same checks as any send, and the delete button throws it away. Being signed in is the proof there.

### Does the approver need a Blueping account?

No. Nadia approves from any mail app. The check reads her domain's SPF, DKIM and DMARC results. If her domain publishes no DMARC policy, `auth.verdict` reads `none` and the code above refuses her approvals, so set one up first.

### Can two people approve?

Yes. Compare the sender with a list of approvers instead of one address. Each one is proven by their own domain, and the first answer decides, since a sent draft can't be sent again or deleted.

### What if nobody answers?

Nothing goes. A draft without `send_at` stays a draft. A pass can remind the approver in the same thread after a few hours, or ask a second approver.

### Can the agent still answer the rest on its own?

Yes. Questions that cost nothing get their answer at once with POST `/v1/messages/{id}/reply`. Only the answers your rules name wait as drafts.

### Can a draft carry a credit note or another file?

Yes. POST `/v1/inboxes/{id}/drafts` takes `attachments`, 20 files and 10 MB at most together, and the question to Nadia can say what is attached. Over MCP, files are added through the API.

### What does the café see?

Only the approved answer, from kestrel-care@blueping.dev, in its own thread. The question to Nadia goes in a thread of its own, so the café never sees it.

## More agents at work

- [Answers Orlenwood's customers, orlenwood-support@blueping.dev. Where refund requests arrive, and the rest is answered at once.](https://blueping.dev/use-cases/support-inbox.md)
- [Buys parts for Halden Robotics, halden-purchasing@blueping.dev. Purchase orders that wait as drafts until a person sends them.](https://blueping.dev/use-cases/procurement.md)
- [Assists Olderwick's partners, olderwick-assistant@blueping.dev. Replies an executive approves before the assistant sends them.](https://blueping.dev/use-cases/executive-assistant.md)
