Send a message
Compose and send, or reply. The reply form computes recipients from the message being replied to rather than making the caller reconstruct them from a rendering: a rendering is partly what a sender chose.
A send is subject to the mailbox’s limits and policy. Three outcomes
are normal and distinguishable: it is queued; it is held, because
a rule of the workspace’s policy needs a person to approve it first
(the result carries approval_id, and the message goes out when a
person approves it and never otherwise); or it is refused with
422 policy_refused and guard naming the rule that fired. A held
message has spent its sending budget; the budget is given back if it
is rejected or lapses. Nothing you can send releases a held message:
only a person the workspace named can, so do not resend it. If the
policy that governs the sender cannot be applied the send is refused
with 503 policy_unavailable and nothing is done. A refusal is not
worth retrying unchanged.
Pass idempotency_key on every send. Without one, a timeout you retry
is a second message.
remaining in the result is what is left of each sending limit, so an
agent can pace itself rather than discover a limit by reaching it.
Authorizations
Bearer credential for one agent: an API key or an access
token (a JWT). Pass as Authorization: Bearer <credential>.
A key is shown once when it is issued and is not recoverable afterwards; an access token lives five minutes and is fetched with the agent's own client key from the access service. Treat both as secrets: they reach one agent's mail, and anything a delegation has extended to it. An access token's scope is a ceiling on what the agent may do with it.
Body
Send as another agent, which needs a send-on-behalf grant from
that agent's owner, the organization's permission for sending on
behalf, and a From domain verified for the workspace. Without all
three the send is refused with 422 policy_refused. The message
then names both, with the sending agent in Sender, so a
recipient can see who wrote it and who it is from.
The plain-text body.
Response
The send was accepted for delivery. A 200 here does not mean the
message left — a guard that would refuse it does so as an error
response instead, before this result is ever built.
A new send is queued: accepted for delivery, returned as soon as
the message is durably queued and before it is handed on. A repeat
with the same idempotency_key reports the message's state now,
which may be any later one. held is a message waiting for a
person to approve it, with approval_id; it becomes queued when
approved and rejected when a person refuses it or the wait
lapses. A send that a guard refuses comes back as an error
instead of a result.
queued, sending, sent, delivered, bounced, failed, held, rejected 
