Blog/Category
Shipping Tips & Tricks

How to Let an AI Agent Buy Shipping Labels Safely

November 24, 2026
How to Let an AI Agent Buy Shipping Labels Safely

Updated November 2026. Facts verified against vendor and carrier documentation; see references at the end.

To let an AI agent buy shipping labels safely, split every purchase into a quote, a preview a human approves, and a capped buy. Show the exact price, service and address before anything is charged, set a hard spending limit the model cannot change, and make retries safe with an idempotency key. Then keep a void path and a log of every call. Below is the pattern, with Ship.com's real MCP parameters as the worked example.

Why is label buying the risky step?

Rating, tracking and address checks are read-only. If the agent gets one wrong, you ask again. Buying a label spends real postage, and a retry loop or a misread order can buy the same label twice or ship to the wrong address.

The OWASP MCP Security Cheat Sheet puts it directly: "Require explicit user confirmation for destructive, financial, or data-sharing operations." It also says to never auto-approve tool calls, and to enforce spending limits "in the component that makes payments, outside the model's context." A line in your prompt like "don't spend more than $20" only asks the model to behave. A cap on the server call holds no matter what the model decides.

What does a safe label purchase flow look like?

  1. Quote. Get rates without spending anything.
  2. Preview. Ask the server what it would buy, with the exact amount, service and ship-to address.
  3. Confirm. A human approves that specific preview.
  4. Buy with a cap. Send the purchase with a hard ceiling the server enforces.
  5. Make it idempotent. Tie the order to your own ID so retries do not create duplicates.
  6. Keep a void path. Know how to cancel a label and when the refund lands.
  7. Respect rate limits and log everything.

Step 1: How do you quote without spending money?

Use a read tool. On Ship.com, quote_shipping returns rates with no order needed, and get_rates returns rates for an existing order. Validate the address first with validate_address (US only). None of these spend money.

Step 2: How do you preview the exact purchase?

Ship.com's money tools, buy_label and trigger_batch_purchase, take a confirm parameter that defaults to false. Called without confirm: true, they return a preview and buy nothing.

Build the preview step into your agent's instructions or app code, so your agent shows the cost first and nothing is bought until a person approves.

Show the human the fields behind expensive mistakes: price, carrier and service level, ship-to address and order. OWASP also recommends binding an approval to the specific action and arguments, so a "yes" for one label cannot be reused for another.

Step 3: How do you cap what the agent can spend?

Put the cap on the server call, where the model can't talk its way past it. Ship.com's buy_label takes these parameters:

ParameterRequiredWhat it does
order_id, rate_id, package_id, method, service_levelYesIdentify the order and the exact rate being bought
confirmNo (default false)false returns a preview; true buys
max_costNoPostage ceiling in dollars; the buy is refused if the rate is higher
ship_date, insurance, insured_valueNoShip date and optional insurance

A confirmed call looks like this:

{
  "name": "buy_label",
  "arguments": {
    "order_id": "...",
    "rate_id": "...",
    "package_id": "...",
    "method": "...",
    "service_level": "...",
    "max_cost": 12.50,
    "confirm": true
  }
}

If the rate comes back higher than the cap, the server answers "Refusing to buy: rate is $<price> which exceeds max_cost $<max>. Nothing was purchased." Note that max_cost covers postage only, not fees or insurance. The price is sealed in the rate_id from get_rates, so the client can't change it.

For batches, trigger_batch_purchase takes max_total, a spending ceiling for the batch's postage (insurance premiums not counted). There is no ceiling by default, so always set one. Omit order_ids and the batch covers every Ready to ship order, which is another reason to preview first. A batch confirm re-rates every order, so confirm with the same order_ids and a max_total near the previewed total.

Step 4: How do you stop duplicate labels on retries?

  • When you create orders with create_order or bulk_create_orders, pass your own external_order_id. A retry or re-import then returns the existing order instead of creating a duplicate.
  • If an order already has a label, buy_label returns it without charging. In a batch, "An order that already has a label isn't bought twice."

There are 2 gaps. Simultaneous calls with the same external_order_id can still create duplicates, so don't fire parallel creates for one order. And the email tools have no duplicate protection: confirming twice sends two emails.

Step 5: What if the agent buys the wrong label?

On Ship.com, cancel_shipping_label voids a label within 29 days of the ship date. The refund goes to your postage balance, not your card, once the carrier accepts the void, typically within about 14 days. If the carrier already scanned the package, there is no refund. cancel_order also voids the label if the order has not shipped. Both cancel tools use the same confirm preview.

Step 6: How should you handle rate limits and logging?

Ship.com's MCP endpoint allows 60 requests per minute per token. Over the limit you get HTTP 429 with Retry-After: 60. Have your client wait the full 60 seconds instead of retrying in a tight loop.

OWASP also says to "Log all MCP tool invocations with full parameters, user context, and timestamps," with secrets and personal data redacted. For a shipping agent, log every quote, preview, confirm and void, with the price the human saw next to the price charged.

Which credential should your agent use?

Ship.com has two ways to connect, and both can buy:

  • OAuth sign-in gets all 40 tools, including label purchasing. It currently accepts Claude clients only.
  • A connection key (access token sent as a Bearer header) also gets all 40 tools, including buy_label and trigger_batch_purchase. It lasts 180 days.

Treat the connection key like a password. Anyone who has it can act on your account. Keep it in environment variables or your OS's credential store, never in a committed config file. Your kill switch is Generate API Key on the API Integration tab: it ends the old token right away, for the MCP and the REST API. The setup for each editor is in our guide to adding a shipping MCP server to Claude Code, Cursor and VS Code.

Any developer can get a key. Sign up at https://www.ship.com/sign-up, then in app.ship.com go to Settings > API Integration.

A good first run: preview the purchase, then buy one cheap label with a tight max_cost. If you don't need it, void it with cancel_shipping_label and the postage goes back to your balance.

Frequently asked questions

Can an AI agent buy shipping labels without my approval?

Only if you let it. Ship.com's buy_label buys whenever it is called with confirm: true, so build the approval into your client. Make your client call it without confirm, show the price, service and address to a person, and only then confirm with a max_cost cap. OWASP recommends never auto-approving financial tool calls.

How do I set a spending limit for an AI shipping agent?

Set the limit on the server call, not in the prompt. On Ship.com, pass max_cost to buy_label or max_total to trigger_batch_purchase. If the postage is higher, the server refuses and nothing is purchased. Both caps cover postage only, not fees or insurance. Batches have no ceiling by default, so always set max_total.

What happens if my agent retries a label purchase?

On Ship.com, if the order already has a label, buy_label returns the existing label without charging again, and batches never buy a labeled order twice. Create orders with your own external_order_id so retries return the existing order. Avoid parallel calls with the same ID, since simultaneous requests can still create a duplicate order.

Can I get a refund for a label my agent bought by mistake?

Yes, within limits. Ship.com's cancel_shipping_label voids a label within 29 days of its ship date. The money goes back to your postage balance, not your card, typically within about 14 days after the carrier accepts the void. If the carrier has already scanned the package, the label cannot be refunded.

Which Ship.com connection lets an agent buy labels?

Both. A connection key is an access token you send as a Bearer header, it lasts 180 days and it gets all 40 tools, including buy_label and trigger_batch_purchase. OAuth sign-in gets the same 40 tools and currently works with Claude clients only.

Comparing vendors first? Read our rundown of the best MCP servers for shipping in 2026, or see how Ship AI handles approvals with Suggest mode and daily spend caps.

Connect Ship.com to your agent

Our MCP server has previews, spending caps and voids built in, on USPS and UPS labels at up to 89% off USPS and up to 87% off UPS. Check pricing for plan details.

Read the Ship MCP setup guide

Create a Ship.com account

References

  • Ship.com MCP documentation: buy_label and trigger_batch_purchase parameters, confirm previews, max_cost and max_total, idempotency, void rules, rate limits (accessed November 2026)
  • Ship.com Claude connection guide: connection key versus OAuth sign-in (accessed November 2026)
  • Ship AI: Suggest mode, daily spend caps and pause switch (accessed November 2026)
  • OWASP MCP Security Cheat Sheet: human confirmation for financial operations, spending limits outside the model, logging and rate limits (accessed November 2026)

Shipping software built for online sellers

Ship.com saves you time and money, giving you more freedom to live your life.

  • No credit card required.
  • Up to 89% off USPS and up to 87% off UPS.
  • Connects with major e-commerce platforms.
  • Free home pickup. Skip the trip to the post office.
Try for free
UPS
UP TO 87% OFF
Daily Rates*
USPS
UP TO 89% OFF
Retail Prices*
Today's orders
Order #1042USPS Ground AdvantageReady
Order #1043UPS Ground SaverReady
Order #1044USPS Priority MailReady
★★★★★Trusted by 10,000+ business customers

Recent blogs

See all