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-08-08.

Authentication

Requests carry a short-lived access token, not your API key. POST your personal key to /api/v1/token once, then send the token it returns in the Authorization header for the next hour. Find your key under Dashboard → Settings → API keys. The token identifies you, so it only ever reaches accounts you connected yourself.

Exchange your key for a token
curl -X POST https://api.reinterface.com/api/v1/token \
  -H "x-api-key: <YOUR_API_KEY>"

# {"access_token":"eyJ...","token_type":"Bearer","expires_in":3600}
Auth header
-H "Authorization: Bearer <ACCESS_TOKEN>"
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 "Authorization: Bearer <ACCESS_TOKEN>"
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 "Authorization: Bearer <ACCESS_TOKEN>" \
  -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 "Authorization: Bearer <ACCESS_TOKEN>"
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 "Authorization: Bearer <ACCESS_TOKEN>"
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
401unauthorizedMissing, invalid or expired access token
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)