DocsGmail Reference
Documentation

Gmail API

Send and read Gmail as a connected Google account, authenticated with your personal API key.

Overview

Connect a Google account once from the dashboard, then send and read its mail over plain REST. Base URL: https://api.reinterface.com/api/v1. All responses are JSON. Last updated: 2026-07-28.

Authentication

Every request carries your personal API key in the x-api-key header. Find it (and regenerate it) under Dashboard → Settings → API key. The key identifies you, so it only ever reaches accounts you connected yourself.

Auth header
-H "x-api-key: <YOUR_API_KEY>"
Treat the key like a password: server-side only, never in browser code or query strings. If it leaks, regenerate it in Settings and the old key stops working immediately.

Picking an account: if you have exactly one connected Google account you never need to pass anything, every endpoint defaults to it. With several accounts, pass connection_id (from GET /google/accounts) to choose one.

Connected accounts

Lists your connected Google accounts. Use the returned id as connection_id when you have more than one account.

GET/api/v1/google/accounts

List your connected Google accounts

Request
curl https://api.reinterface.com/api/v1/google/accounts \
  -H "x-api-key: <YOUR_API_KEY>"
Response
{
  "accounts": [
    {
      "id": "<CONNECTION_ID>",
      "email": "user@gmail.com",
      "name": "User Name",
      "status": "connected",
      "scopes": ["...gmail.send", "...gmail.readonly"],
      "last_connected_at": "2026-07-16T09:00:00Z"
    }
  ]
}

Send email

POST/api/v1/gmail/send

Send email as the connected account

Provide to, subject, and text and/or html. connection_id is optional.

Request
curl -X POST https://api.reinterface.com/api/v1/gmail/send \
  -H "x-api-key: <YOUR_API_KEY>" \
  -H "content-type: application/json" \
  -d '{
    "to": "recipient@example.com",
    "subject": "Hello",
    "html": "<p>Body</p>"
  }'
Response
{
  "id": "18c1a2b3d4e5f6a7",
  "threadId": "18c1a2b3d4e5f6a7",
  "status": "sent"
}

List messages

GET/api/v1/gmail/messages

List recent messages (metadata + snippet)

Query params: max_results (default 10, max 50) and optional connection_id.

Request
curl "https://api.reinterface.com/api/v1/gmail/messages?max_results=10" \
  -H "x-api-key: <YOUR_API_KEY>"
Response
{
  "messages": [
    {
      "id": "18c1a2b3d4e5f6a7",
      "threadId": "18c1a2b3d4e5f6a7",
      "snippet": "First lines of the email…",
      "subject": "Hello",
      "from": "Sender <sender@example.com>",
      "to": "user@gmail.com",
      "date": "Thu, 17 Jul 2026 09:00:00 +0000"
    }
  ]
}

Get one message

GET/api/v1/gmail/messages/{id}

Get one message with the full body

Request
curl "https://api.reinterface.com/api/v1/gmail/messages/18c1a2b3d4e5f6a7" \
  -H "x-api-key: <YOUR_API_KEY>"
Response
{
  "id": "18c1a2b3d4e5f6a7",
  "threadId": "18c1a2b3d4e5f6a7",
  "snippet": "First lines of the email…",
  "subject": "Hello",
  "from": "Sender <sender@example.com>",
  "to": "user@gmail.com",
  "date": "Thu, 17 Jul 2026 09:00:00 +0000",
  "text": "Plain-text body",
  "html": "<p>HTML body</p>"
}

Errors

Errors return { "success": false, "error": { "code", "message" } }.

StatusCodeMeaning
401invalid_api_keyMissing or invalid x-api-key
400invalid_requestMissing required fields
403missing_scopeAccount lacks a Gmail permission, reconnect it
404not_foundconnection_id does not exist or is not yours
404google_account_not_connectedNo connected Google account
502gmail_send_failedGmail rejected the send

Endpoint summary

MethodPathPurpose
GET/api/v1/google/accountsList your connected Google accounts
POST/api/v1/gmail/sendSend email via Gmail
GET/api/v1/gmail/messagesList recent messages
GET/api/v1/gmail/messages/{id}Get one message (full body)