A letter posting API. Built for your software.

The Send Letters Online REST API lets approved accounts create and pay for physical letter orders, upload documents and check order status. Authenticate with a bearer API key, fund your prepaid balance and submit an order. We handle the printing, folding and posting through the selected Royal Mail service.

Illustration of digital documents becoming an enveloped physical letter

Manage API access Read the endpoint guide

How do I get started with the letter API?

Sign in and open balance and API-access settings. API access must be enabled for the account; adding money to a website wallet alone does not enable the API. Keep your key on a trusted server, never in public frontend code, a mobile bundle or a source repository.

  • Confirm that API access is enabled and create or manage your key.
  • Add enough prepaid balance for the orders you intend to submit.
  • Start with the read-only balance request below to verify your integration.
  • Review the order fields and current price before submitting a paid order.

Which REST API endpoints are available?

All paths below are relative to the Send Letters Online website and require Authorization: Bearer YOUR_API_KEY. The public integration API is /api/v1, not the session-authenticated endpoints used internally by the website.

  • GET /api/v1/balance: read balanceCents and currency.
  • GET /api/v1/orders: list your orders; use limit and offset for pagination.
  • GET /api/v1/orders/:id: read one of your orders, its status and available tracking information.
  • POST /api/v1/uploads/request-url: obtain uploadURL and objectPath for a document upload.
  • POST /api/v1/orders: create and immediately pay for one letter order from your balance.

Agent2Agent (A2A): connect an agent to physical letter posting

Agent2Agent (A2A) protocol v0.3 connects compatible agents to the same account, prepaid Account Credit and letter-order functions used by REST and MCP. Executing skills requires approved API access and a Bearer API key. Adding Account Credit alone does not enable API access. Paid orders require confirmed: true and expectedTotalPence matching the current quote.

Send JSON-RPC 2.0 requests to POST https://sendlettersonline.co.uk/api/a2a using Authorization: Bearer YOUR_API_KEY. The public agent card describes the service and its skills; reading it does not grant account access. The canonical discovery URL is /.well-known/agent-card.json, with /.well-known/agent.json as an identical compatibility alias.

Use method message/send and a message with kind: "message", role: "user", a unique messageId and a parts array. Supply one data part in the format {"kind":"data","data":{"skill":"get_balance","input":{}}}. The response is a Message with role: "agent" and a data part containing the result. The example below checks your balance without creating an order or spending credit.

Skill inputs match the MCP tools. Order inputs include serviceClass, pages, colour, doubleSided, recipientName, recipientLine1, recipientCity, recipientPostcode and recipientCountry, plus content for a text letter or contentUploadPath for your verified upload. Use content here, not the REST guide's contentText field. Never include your API key in message parts or letter content.

Calling create_letter_order without confirmed: true only returns a quote. A missing or mismatched expectedTotalPence on a confirmed call is rejected without creating an order. Show the exact quote to the customer and obtain permission before sending a paid request. After a timeout, check order history before retrying: a JSON-RPC id or messageId is not an idempotency key.

Text-only messages return instructions rather than interpreting an order. There are no persistent tasks, streaming or push notifications; tasks/get returns task-not-found (-32001). Invalid skill inputs return -32602 and unknown methods return -32601. Authentication, insufficient credit, access restrictions and rate limits return clear JSON-RPC errors with the relevant HTTP status. A2A shares the same per-account API rate-limit budget as REST and MCP.

  • get_balance: read balanceCents and currency; input is {}.
  • list_orders: list your orders with optional limit (1–100, default 20) and offset (default 0).
  • get_order: read your order's status and available tracking using input {"id":"YOUR_ORDER_ID"}.
  • preview_letter_price: quote the letter using the MCP order fields, without creating an order or spending credit.
  • create_letter_order: quote first, then create a paid order only with confirmed: true and the matching expectedTotalPence.

Read-only A2A balance example

curl "https://sendlettersonline.co.uk/api/a2a" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "jsonrpc": "2.0",
    "id": "balance-1",
    "method": "message/send",
    "params": {
      "message": {
        "kind": "message",
        "role": "user",
        "messageId": "balance-check-1",
        "parts": [
          {
            "kind": "data",
            "data": { "skill": "get_balance", "input": {} }
          }
        ]
      }
    }
  }'

What does a letter order need?

Supply the recipientName, recipientLine1, recipientCity, recipientPostcode and recipientCountry fields, the serviceClass, and the printing options. Text orders use contentType: TEXT with contentText. For uploaded documents, first request an upload URL, upload the bytes with PUT, then use the returned objectPath as contentUploadPath.

An uploaded document must belong to the same authenticated customer. Wait for the upload to complete before creating the order, and provide an accurate pages count. Validate your document, address and selected service before any paid submission.

  • Recipient: full name and deliverable postal address.
  • Print settings: pages, colour and doubleSided.
  • Text content: contentType and contentText.
  • Uploaded content: contentUploadPath from your own upload request.

When does an API call charge my balance?

POST /api/v1/orders is a real paid operation, not a draft or sandbox request. A successful order debits the prepaid account immediately. There is no Stripe checkout step in this API path and no public free-send sandbox advertised here.

Do not blindly retry an order-creation POST after a network timeout: the first request may already have succeeded. Check recent orders and investigate the result before resubmitting. No idempotency-key contract is documented for this endpoint.

  • 400: review invalid content, address or upload details.
  • 401: check the bearer key is present and valid.
  • 402: insufficient prepaid balance; top up before trying again.
  • 403: check account access is enabled.
  • 404: the requested order was not found for your account.
  • 429: slow down and handle the rate-limit response before retrying a read.

How can my application follow a letter after posting?

Poll GET /api/v1/orders/:id for the current status. Treat creation, printing, posting and delivery as different events. Tracking numbers are returned when available for the chosen service; a tracking number alone does not prove delivery.

Use polling with a reasonable delay and handle transient errors. This guide does not offer customer webhooks or official JavaScript and Python SDKs: integrate with standard HTTP clients. If you prefer an assistant instead of writing an integration, use the MCP server.

Read-only authentication example

curl "https://sendlettersonline.co.uk/api/v1/balance" \
  -H "Authorization: Bearer YOUR_API_KEY"

Frequently asked questions

Is the letter API the same as the website checkout API?

No. The public integration uses /api/v1 with a bearer API key for an enabled account. Website checkout uses session-authenticated routes and is not the public API contract.

Is there a free sandbox for sending test letters?

No public free-send sandbox is documented here. Use GET /api/v1/balance to verify authentication without ordering. POST /api/v1/orders creates a real paid letter, so do not use it as a harmless connectivity test.

Can I upload a PDF through the API?

Yes. Request an upload URL, PUT the document to uploadURL, then reference objectPath as contentUploadPath in an order. The upload must be associated with the same customer account.

Do you provide webhooks or official SDKs?

This integration guide documents HTTP endpoints and order-status polling. It does not advertise customer webhooks or official language SDKs; use your standard HTTP client.

Can I retry a paid order automatically?

Do not blindly retry POST /api/v1/orders after an uncertain response. Check whether the order was created before resubmitting, because creation is a paid operation and no idempotency-key contract is documented here.

Can I use the same account with an AI assistant?

Yes. MCP, A2A and REST access use the same enabled customer account, prepaid Account Credit and order history. MCP and A2A add named skills and an explicit price-confirmation contract.

Where is the A2A agent card?

The canonical public discovery URL is https://sendlettersonline.co.uk/.well-known/agent-card.json. The identical compatibility alias is https://sendlettersonline.co.uk/.well-known/agent.json. Both are publicly readable JSON; executing skills at /api/a2a still requires authenticated, approved API access.