Reply to a Thread
POST /api/v1/threads/:id/reply
Sends a plain-text reply from the client's mailbox, through Gmail, so it lands in the client's
Sent folder and continues the conversation. It goes to the sender of the last message (or, if the
last message was ours, to its recipients again). Google mailboxes only for now; no Cc or
attachments yet.
Request Body
| Field | Type | Required | Description |
|---|
| body_text | string | Yes | The reply |
| idempotency_key | string | Yes | Your id for this reply (max 200 characters). Reuse it when you retry |
Never sent twice
- 201: sent by this call.
send_status is sent, or pending when Gmail's answer was lost
(it may have gone out).
- 200: this key was used before. You get the first result and nothing is sent.
- A
pending reply stays pending. Check the client's Sent folder before writing it again with a
new key.
Example Request
curl -X POST "https://mail.finopsbricks.com/api/v1/threads/th9a8b7c6d5e/reply" \
-H "api-key: fob_mail_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "body_text": "Received, thank you. We will process it this week.", "idempotency_key": "bills-line:th9a8b7c6d5e:ack" }'
Response
{
"data": {
"id": "ms7h8j9k0l1z",
"thread": "th9a8b7c6d5e",
"message_id": "<reply-3f9c…@mail.finopsbricks.com>",
"direction": "outbound",
"from_email": "[email protected]",
"to_addresses": [{ "email": "[email protected]", "name": "Vendor Billing" }],
"subject": "Re: Invoice INV-2291 for October",
"body_text": "Received, thank you. We will process it this week.",
"send_status": "sent",
"attachments": []
}
}
Errors
| Status | Code | When |
|---|
| 401 | UNAUTHORIZED | Missing or invalid credentials |
| 403 | FORBIDDEN | The key lacks messages:create |
| 404 | NOT_FOUND | No such thread, or it's in a mailbox this key can't use |
| 400 | VALIDATION_ERROR | Empty reply, missing key, or nobody to reply to |
| 409 | MAILBOX_NEEDS_RECONNECT | The mailbox is disconnected or its sign-in stopped working |
| 422 | SEND_NOT_SUPPORTED | Not a Google mailbox |
| 502 | SEND_REFUSED | Gmail refused it; nothing was sent; the same key may be retried |