---
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

# Quotes compared. You approve.

The agent emails each approved supplier, compares the quotes as they come back, and drafts the purchase order for a person to send.

The third quote reaches halden-purchasing@blueping.dev, the agent reads the attached file as text, and the purchase order waits as a draft until a person sends it.

## How can an AI agent request quotes and handle purchase orders by email?

Lock the agent's inbox to your approved suppliers with send allow rules, email each one the request for quote in its own thread, and read the quotes that come back with GET `/v1/messages/{id}/attachments/{attachment_id}/text`. The agent then writes the purchase order as a draft with POST `/v1/inboxes/{id}/drafts`, and a person sends it with one call once they approve.

## Why buying by email is slow and risky

Halden Robotics builds warehouse robots and buys a few hundred components a month: standoffs, connectors, motor drivers. For each request, someone emails three approved suppliers, waits for the quotes, copies unit prices and lead times into a spreadsheet, gets a manager's yes, and sends the purchase order. Each cycle takes a week, mostly waiting and copying.

An agent can do this work on two conditions. It writes only to suppliers on the approved list, because a purchase order sent to the wrong address is a real liability. And the purchase order waits for a person's approval, because the agent is spending money.

halden-purchasing@blueping.dev meets both in the API itself. Send allow rules make every other recipient impossible, one thread per supplier keeps each quote apart, attachments read as text whatever their format, and the purchase order waits as a draft until a person sends it.

## From a request for quote to an approved purchase order

The agent compares and drafts; the person approves; Blueping enforces who can be written to.

### 1. Approve the suppliers once

One send allow rule per supplier domain. With allow rules in the send direction, a message to any other address stops before it leaves, whatever the agent was told.

**Call:** POST `/v1/inboxes/{id}/rules` with `direction: send`, `action: allow` and `value`

**Answer:** `201` with the rule

**Checked:** One refused recipient stops the whole message with `403 recipient_blocked`

### 2. Send the request for quote

One email per supplier, with the parts as a CSV attachment and an `Idempotency-Key` per supplier, so a retried run never sends a second request. Each email starts its own thread.

**Call:** POST `/v1/inboxes/{id}/messages` with `attachments` and `Idempotency-Key`

**Answer:** `202` with each message's `id` and `thread_id`

**Checked:** Each supplier who never wrote counts as a new recipient: 3 in the first hour, 10 in the first day and 25 in the first week after the claim

### 3. Label the round

The agent labels each thread with the request's id, such as `rfq-118`, so the quotes that come back are found in one call however many suppliers answer.

**Call:** PATCH `/v1/threads/{id}` with `add_labels`

**Answer:** The thread's `labels`

**Checked:** A thread's labels are its messages' labels together

### 4. Read the quotes

The agent lists the round's threads, reads each supplier's reply, and opens the attached quote as text, whether it came as Excel, PDF or CSV.

**Call:** GET `/v1/inboxes/{id}/threads?labels=rfq-118`, GET `/v1/threads/{id}`, then the attachment's `/text`

**Answer:** The round's threads, each thread's `messages`, then each file's `text`

**Checked:** A held reply is counted in its thread's `held_count` and left out of `messages`, so it never enters the comparison

### 5. Draft the purchase order for approval

The agent writes the purchase order as a reply to the winning quote, without `send_at`, so it waits. A person reads it with GET `/v1/drafts/{id}`, or asks for it over MCP, and sends it.

**Call:** POST `/v1/inboxes/{id}/drafts` with `reply_to_message_id`, then POST `/v1/drafts/{id}/send`

**Answer:** `201` with `status: draft`, then `202` with the sent message

**Checked:** Sending a draft runs every check a send runs, the allow rules included

What a send to a supplier off the list answers, whole. Nothing leaves:

```json
{
  "error": {
    "code": "recipient_blocked",
    "message": "This inbox sends only to the addresses its allow rules name, and quotes@unlisted-parts.example isn't one. Nothing was sent.",
    "next_action": "Remove that address from the message, or add a send rule that allows it: POST /v1/inboxes/{id}/rules.",
    "docs_url": "https://blueping.dev/docs/errors#recipient_blocked"
  }
}
```

## Requests for quote and comparison in Python and Node.js

Two steps in one program: `send` sets the rules and mails the request for quote to each supplier, and `collect` compares the quotes and drafts the purchase order. The parts list, the suppliers and the price pattern are this example's; your model reads real quotes in any layout.

Python:

```python
# rfq.py: send a request for quote to approved suppliers, then compare the quotes that come back.
# Run: python rfq.py send, and once the quotes are in, python rfq.py collect
# pip install requests
import base64
import os
import re
import sys

import requests

API = "https://blueping.dev/v1"
RFQ = "rfq-118"
SUPPLIERS = ["quotes@corbel-components.example", "sales@kessler-fasteners.example", "rfq@nordmark-parts.example"]
ITEMS = "part,quantity\nM3x10 brass standoff,500\nM3 steel hex nut,1000\n"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['BLUEPING_API_KEY']}"

inbox = session.post(f"{API}/inboxes", json={"client_id": "procurement", "display_name": "Halden Robotics Purchasing"}).json()

if sys.argv[1] == "send":
    for supplier in SUPPLIERS:  # the inbox may write to these domains and nobody else
        rule = {"direction": "send", "action": "allow", "value": "@" + supplier.split("@")[1]}
        session.post(f"{API}/inboxes/{inbox['id']}/rules", json=rule)
    parts = {"filename": f"{RFQ}.csv", "content_type": "text/csv", "content_base64": base64.b64encode(ITEMS.encode()).decode()}
    for supplier in SUPPLIERS:  # one email each, so every quote stays in its own thread
        sent = session.post(
            f"{API}/inboxes/{inbox['id']}/messages",
            json={"to": supplier, "subject": f"Request for quote {RFQ.upper()}", "text": "Please quote unit price and lead time for the attached parts, in this thread.", "attachments": [parts]},
            headers={"Idempotency-Key": f"{RFQ}-{supplier}"},
        ).json()
        session.patch(f"{API}/threads/{sent['thread_id']}", json={"add_labels": [RFQ]})
        print("rfq sent to", supplier)

if sys.argv[1] == "collect":
    quotes = []
    threads = session.get(f"{API}/inboxes/{inbox['id']}/threads", params={"labels": RFQ}).json()
    for thread in threads["data"]:
        for message in session.get(f"{API}/threads/{thread['id']}").json()["messages"]:
            if message["direction"] != "in" or message["auth"]["verdict"] != "pass":
                continue  # quotes from proven suppliers only
            for file in message["attachments"]:
                read = session.get(f"{API}/messages/{message['id']}/attachments/{file['id']}/text").json()
                if "error" in read or read["safety"]["verdict"] != "clear":
                    continue  # no text to read, or text that speaks to a model: it stays out of the comparison
                price = re.search(r"standoff[^\n]*?[,|]\s*([0-9]+\.[0-9]+)", read["text"], re.IGNORECASE)
                if price:
                    quotes.append((float(price.group(1)), message["from"]["address"], message["id"]))
    for price, supplier, _ in sorted(quotes):
        print(f"{supplier}: {price:.2f} a standoff")
    if quotes:
        price, supplier, message_id = min(quotes)
        draft = session.post(
            f"{API}/inboxes/{inbox['id']}/drafts",
            json={"reply_to_message_id": message_id, "text": f"Purchase order PO-118: 500 standoffs at {price:.2f}. Please confirm the delivery date."},
            headers={"Idempotency-Key": f"po-{RFQ}"},
        ).json()
        print("purchase order draft", draft["id"], "for", supplier, "waits for a person to send it")
```

Node.js:

```javascript
// rfq.mjs: send a request for quote to approved suppliers, then compare the quotes that come back.
// Run: node rfq.mjs send, and once the quotes are in, node rfq.mjs collect (Node.js 18 or later)
const API = "https://blueping.dev/v1";
const RFQ = "rfq-118";
const SUPPLIERS = ["quotes@corbel-components.example", "sales@kessler-fasteners.example", "rfq@nordmark-parts.example"];
const ITEMS = "part,quantity\nM3x10 brass standoff,500\nM3 steel hex nut,1000\n";
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();

const inbox = await call("POST", "/inboxes", { client_id: "procurement", display_name: "Halden Robotics Purchasing" });

if (process.argv[2] === "send") {
  for (const supplier of SUPPLIERS) {
    // the inbox may write to these domains and nobody else
    await call("POST", `/inboxes/${inbox.id}/rules`, { direction: "send", action: "allow", value: `@${supplier.split("@")[1]}` });
  }
  const parts = { filename: `${RFQ}.csv`, content_type: "text/csv", content_base64: Buffer.from(ITEMS).toString("base64") };
  for (const supplier of SUPPLIERS) {
    // one email each, so every quote stays in its own thread
    const sent = await call("POST", `/inboxes/${inbox.id}/messages`, { to: supplier, subject: `Request for quote ${RFQ.toUpperCase()}`, text: "Please quote unit price and lead time for the attached parts, in this thread.", attachments: [parts] }, { "Idempotency-Key": `${RFQ}-${supplier}` });
    await call("PATCH", `/threads/${sent.thread_id}`, { add_labels: [RFQ] });
    console.log("rfq sent to", supplier);
  }
}

if (process.argv[2] === "collect") {
  const quotes = [];
  const threads = await call("GET", `/inboxes/${inbox.id}/threads?labels=${RFQ}`);
  for (const thread of threads.data) {
    const { messages } = await call("GET", `/threads/${thread.id}`);
    // quotes from proven suppliers only
    for (const message of messages.filter((item) => item.direction === "in" && item.auth.verdict === "pass")) {
      for (const file of message.attachments) {
        const read = await call("GET", `/messages/${message.id}/attachments/${file.id}/text`);
        if (read.error || read.safety.verdict !== "clear") continue; // no text to read, or text that speaks to a model
        const price = read.text.match(/standoff[^\n]*?[,|]\s*([0-9]+\.[0-9]+)/i)?.[1];
        if (price) quotes.push({ price: Number(price), supplier: message.from.address, messageId: message.id });
      }
    }
  }
  quotes.sort((a, b) => a.price - b.price);
  for (const quote of quotes) console.log(`${quote.supplier}: ${quote.price.toFixed(2)} a standoff`);
  if (quotes.length) {
    const best = quotes[0];
    const draft = await call("POST", `/inboxes/${inbox.id}/drafts`, { reply_to_message_id: best.messageId, text: `Purchase order PO-118: 500 standoffs at ${best.price.toFixed(2)}. Please confirm the delivery date.` }, { "Idempotency-Key": `po-${RFQ}` });
    console.log("purchase order draft", draft.id, "for", best.supplier, "waits for a person to send it");
  }
}
```

The purchase order is a draft with no `send_at`: it waits until someone sends it with POST `/v1/drafts/{id}/send`, or with `send_draft` over MCP. A draft whose request repeats with the same `Idempotency-Key` comes back as the same draft, so `collect` can run as often as quotes arrive.

In its first hour after the claim, an agent reaches 3 people who never wrote to it, and the ramp widens after that: [Limits](https://blueping.dev/docs/limits.md#ramp) has every step. Suppliers who answered an earlier round never count again.

## Buy from a conversation with an MCP client

A buyer can run the round from Claude or Cursor with the [MCP server](https://blueping.dev/agents.md) connected. The tools send text; the parts list goes in the body, and files go through the API as above.

```text
From halden-purchasing, send a request for quote to our three approved suppliers for 500 M3x10 brass standoffs and 1000 M3 steel hex nuts, one email each, and label the threads rfq-118. When the quotes are in, compare unit price, lead time and minimum order, and write the purchase order to the best one as a draft. Don't send it: I will approve it.
```

| Tool | What it does here |
| --- | --- |
| `add_address_rule` | Adds the send allow rules for the approved suppliers, with your go-ahead. |
| `send_email` | Sends each request for quote, in a thread of its own. |
| `label_thread` | Labels each round's threads with its id. |
| `list_threads` | Finds the round's threads by label. |
| `read_attachment` | Reads each quote's Excel, PDF or CSV file as text. |
| `create_draft` | Writes the purchase order without sending it. |
| `send_draft` | Sends it, once you say so. |

Rules change who the agent can reach, so `add_address_rule` asks the model to check with you first, and a send to an unapproved supplier fails with `recipient_blocked` whatever the conversation says.

## Log each quote the moment it lands

Buyers like to see quotes arrive. Subscribe to `email.received`, check the signature as [Webhooks](https://blueping.dev/docs/webhooks.md#verify) shows, and let the handler below log each quote in a thread of the round, so your purchasing tool shows the comparison filling in.

```javascript
// quote-hook.mjs: the part of your webhook server that logs each supplier quote as it arrives.
// Check the Blueping-Signature header before calling handle(): /docs/webhooks#verify has the code.
const API = "https://blueping.dev/v1";
const headers = { Authorization: `Bearer ${process.env.BLUEPING_API_KEY}`, "Content-Type": "application/json" };
const get = async (path) => (await fetch(API + path, { headers })).json();

export async function handle(event) {
  if (event.type !== "email.received") return;
  const { message } = event.data;
  const thread = await get(`/threads/${message.thread_id}`);
  const round = thread.labels.find((label) => label.startsWith("rfq-"));
  if (!round) return;
  for (const file of message.attachments) {
    const read = await get(`/messages/${message.id}/attachments/${file.id}/text`);
    const price = (read.text ?? "").match(/standoff[^\n]*?[,|]\s*([0-9]+\.[0-9]+)/i)?.[1];
    console.log(`${round}: ${message.from.address} quotes ${price ?? "an unread price"}`); // your purchasing tool here
  }
  await fetch(`${API}/messages/${message.id}`, { method: "PATCH", headers, body: JSON.stringify({ add_labels: ["quote"] }) });
}
```

The thread's labels carry the round, so the handler knows which request a quote answers without any state of its own.

## Spending money safely by email

In procurement an agent's mistake costs money, so the controls sit in the API, where a prompt can't reach them.

### Only approved suppliers can be written to

Send allow rules are checked before anything goes out. A purchase order addressed to any other domain stops with `403 recipient_blocked`, even if a supplier's email asks the agent to send it elsewhere.

### A person sends the purchase order

The agent drafts and a person sends. Until then the draft can be read, changed or deleted, and nothing has left the inbox.

### Quotes from impostors

A reply forged in a supplier's name fails the supplier's DMARC policy: it is turned away or held as `unauthenticated`, and never appears among the round's messages. The program also skips any quote whose `auth.verdict` isn't `pass`, so a fake low quote can't win.

### Payment instructions stay with people

A quote that asks for payment to a new account is a question for your finance team. The agent's prompt should stop on any change of bank details.

### Files that speak to a model

Each quote's text carries a `safety` result. A spreadsheet with hidden instructions comes back `suspicious` and stays out of the comparison.

## What a purchasing desk needs

Twenty rounds a month with three suppliers each send 60 requests for quote, plus 20 purchase orders and a few follow-ups, about 100 sends. Quotes are small files, so one inbox and a little storage cover it.

**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 Nylas](https://blueping.dev/compare/nylas.md) · [All use cases](https://blueping.dev/use-cases.md)

Last checked against the API on 27 November 2026.

## Questions about buying by email

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

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

### Can the agent attach files over MCP?

The MCP tools send text and HTML. Files go through the API: `attachments` on POST `/v1/inboxes/{id}/messages`, on replies and on drafts, 10 MB per message.

### How do quotes stay apart?

Each request goes as its own email, so each supplier's answer lands in its own thread. The round's label finds all of them in one call.

### Can a person approve before the purchase order goes?

Yes. A draft without `send_at` waits. POST `/v1/drafts/{id}/send` sends it with every check a send runs, and DELETE `/v1/drafts/{id}` throws it away.

### Which quote formats can it read?

PDF, Word, Excel and CSV come back as Markdown, and text or JSON as they are. Images come back as `415 text_unavailable` with the route that downloads them.

### What if a supplier answers from a new address?

The reply threads by its headers, so it lands in the round's thread. Allow rules work by domain, so a new address at an approved domain can still be answered.

### Why didn't a request to one more supplier go at once?

New recipients come a few at a time after the claim: 3 in the first hour, 10 in the first day and 25 in the first week. A request past the ramp is accepted with `status` `queued` and a `sends_at`, and goes by itself when it fits. Suppliers who wrote to the inbox before never count, so the second round goes out at once.

## More agents at work

- [Pays Norbeck's invoices, norbeck-ap@blueping.dev. The invoice that follows the purchase order, read and booked.](https://blueping.dev/use-cases/invoices-and-receipts.md)
- [Answers Larkspur's order emails, larkspur-orders@blueping.dev. Shipping notices and returns on the other side of the order.](https://blueping.dev/use-cases/orders-and-returns.md)
- [Answers the planner's tasks, research-worker@blueping.dev. A buying agent that hands tasks to other agents by email.](https://blueping.dev/use-cases/multi-agent-email.md)
