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

FieldTypeRequiredDescription
body_textstringYesThe reply
idempotency_keystringYesYour 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

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid credentials
403FORBIDDENThe key lacks messages:create
404NOT_FOUNDNo such thread, or it's in a mailbox this key can't use
400VALIDATION_ERROREmpty reply, missing key, or nobody to reply to
409MAILBOX_NEEDS_RECONNECTThe mailbox is disconnected or its sign-in stopped working
422SEND_NOT_SUPPORTEDNot a Google mailbox
502SEND_REFUSEDGmail refused it; nothing was sent; the same key may be retried