Skip to main content
The Gmail replica implements 26 endpoints of the Gmail API v1 for the mailboxes in the world. Sending a message delivers it to a seeded mailbox or records it in Sent; nothing leaves the world. Its key is gmail. It was tested with @googleapis/gmail.

Connect

Node
This is what ancha connect gmail --lang ts prints. Google’s client takes the replica as a per-request rootUrl ending in /; a global rootUrl keeps only the origin and drops the path. Use me as the user ID.

Endpoints

Anything else returns HTTP 501 with Google’s error shape and x-ancha-gap: 1.

Behavior

  • Mail stays in the world. A message sent to a seeded mailbox is delivered there. Mail to any other address is recorded in Sent and goes nowhere. An unauthorized From becomes the account’s own address.
  • Search. q supports words, phrases, from:, to:, cc:, bcc:, subject:, label:, in:, is:, has:, category:, filename:, dates, sizes, rfc822msgid:, OR, - and grouping. Other operators are coverage gaps. A thread matches when any of its messages matches.
  • Sending takes raw only; the /upload media form is a gap. Sending a draft gives the message a new ID and removes the draft. Replacing a draft creates a new draft message, as Gmail does.
  • Labels take colors as #rrggbb; the replica does not check them against Gmail’s palette.
  • History starts after seeding, with one record per message change.

Starter data

The gmail-starter dataset has two mailboxes at acme.example. The agent’s token belongs to Acme Support, support@acme.example, with the labels Customers, Billing, Follow up and Sales, nineteen messages and one draft. The second mailbox, laura@acme.example (Laura Kim), holds one sent message about the Helix Manufacturing quarterly review.

Checks

Gmail has no state checks. Use trace checks, for example { called: "POST /gmail/v1/users/me/messages/send" } or { not_called: "POST /gmail/v1/users/me/messages/*/trash" }.

Limits

  • Mail moves only inside the world: delivery to seeded mailboxes, Sent for everything else.
  • Uploads, batch requests, push notifications, filters, settings and delegation are not modeled.