SheetgoDevelopers

Developers › REST API › Forms & Integrations

REST API · 5 endpoints

Gmail

Complete for this group. Each operation below lists its parameters, request body, responses and errors. Every model they use is documented under Models used on this page, so you do not need another page to build a request. Base URL https://api.sheetgo.com; paths are complete, version included (/rest/beta/…): append them to the base URL exactly as shown; send Authorization: Bearer sg_…. Also in the API's own docs: https://api.sheetgo.com/rest/reference/gmail (Markdown).

Conventions for every endpoint. Lists take page (from 1) and per_page (1-100, default 50), and total counts pages, not items. Collection URLs end with /. POST …/run returns 200 when the run is queued; poll GET …/run. Google Sheets use provider: "drive"; column fields take letters ("E"). Error bodies and status codes: REST API › Errors.

Python recipes. API client helper.

Read and send email through a connected Google account.

List or search messages (Gmail search syntax), read one message in full and download its attachments, with the same envelopes and message fields as the Outlook endpoints. Reading needs Gmail read access on the user's Google connection; without it the endpoints return 412 gmail_not_connected. Gmail always stores sent mail in SENT, so send has no save_to_sent_items option.

Operations

GET/rest/beta/gmail/messagesList Messages

List or search messages, newest first, one page at a time.

Each message is a summary (no body): ids, subject, sender, recipients, dates, snippet, labels, read state and attachment metadata. Fetch the body with GET /messages/{message_id}.

Parameters
NameInTypeDescription
limitqueryintegeroptionalMessages per page, 1-100. Outside that range returns 400 before any call to Google is made.
Default: 25
labelquerystringoptionalGmail label to list: a system label (INBOX, SENT, STARRED, UNREAD, ...), a label id, or a user label's name (e.g. Invoices). Pass an empty value to list all mail. Ignored when q is given.
Default: "INBOX"
qquerystringoptionalGmail search query (the syntax of Gmail's search box), e.g. from:ana@acme.com has:attachment newer_than:7d. Searches all mail; narrow it inside the query (in:inbox, label:invoices).
page_tokenquerystringoptionalnext_page_token from a previous response. Omit for the first page.
Responses
StatusMeaningBody
200Successful Responseany
401Auth failed—
422Validation ErrorHTTPValidationError
Example request
curl -s -X GET "https://api.sheetgo.com/rest/beta/gmail/messages" \
  -H "Authorization: Bearer $SHEETGO_API_KEY"
POST/rest/beta/gmail/messages/batchBatch Messages

Fetch several messages in full in one call, in the order asked.

A missing or malformed id comes back as {id, error: "message_not_found"} inside values.messages instead of failing the call. At most 50 ids, or 10 with include_attachments (whose content may total at most 25 MB).

Request body (required)

application/json · GmailBatchBody

FieldTypeDescription
idsarray of stringrequiredMessage ids to fetch. At most 50, or 10 when include_attachments is true.
Min items: 1
include_attachmentsbooleanoptionalWhether to return each message's attachment content (base64) as well as its metadata. Lowers the batch cap to 10; attachments may total at most 25 MB across the batch.
Default: false
Responses
StatusMeaningBody
200Successful Responseany
401Auth failed—
422Validation ErrorHTTPValidationError
Example request
curl -s -X POST "https://api.sheetgo.com/rest/beta/gmail/messages/batch" \
  -H "Authorization: Bearer $SHEETGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d @body.json
GET/rest/beta/gmail/messages/{message_id}Get Message

Fetch one message in full: date, from, to, cc, bcc, subject, Message-ID, labels with their names, the body (HTML when the message has one, plus the plain-text version in body_text) and attachment metadata — plus attachment content with include_attachments=true.

Parameters
NameInTypeDescription
message_idpathstringrequiredId of the message (from a list or search).
include_attachmentsquerybooleanoptionalInclude each attachment's content (base64). Capped at 25 MB in total — a larger message returns 413, so fetch those attachments one at a time instead.
Default: false
Responses
StatusMeaningBody
200Successful Responseany
401Auth failed—
422Validation ErrorHTTPValidationError
Example request
curl -s -X GET "https://api.sheetgo.com/rest/beta/gmail/messages/MESSAGE_ID" \
  -H "Authorization: Bearer $SHEETGO_API_KEY"
GET/rest/beta/gmail/messages/{message_id}/attachments/{attachment_id}Get Attachment

Download one attachment as its native bytes (not base64), with Content-Disposition: attachment; filename="...".

Parameters
NameInTypeDescription
message_idpathstringrequiredId of the message the attachment belongs to.
attachment_idpathstringrequiredId of the attachment, from the message's attachments list.
Responses
StatusMeaningBody
200Successful Responseany
401Auth failed—
422Validation ErrorHTTPValidationError
Example request
curl -s -X GET "https://api.sheetgo.com/rest/beta/gmail/messages/MESSAGE_ID/attachments/ATTACHMENT_ID" \
  -H "Authorization: Bearer $SHEETGO_API_KEY"
POST/rest/beta/gmail/sendSend

Send a message through the connected Google account.

Gmail always stores the sent message in SENT — there is no save_to_sent_items equivalent. Total attachment bytes are capped at 3 MB and recipients at 50, matching the Outlook contract.

Request body (required)

application/json · GmailSendBody

FieldTypeDescription
attachmentsarray of AttachmentInoptionalFiles to attach: at most 10, totalling no more than 3 MB once decoded.
Default: []
bccarray of stringoptionalBlind-carbon-copy recipients, hidden from other recipients.
Default: []
bodyBodyContentrequiredThe message body and whether it is plain text or HTML.
ccarray of stringoptionalCarbon-copy recipients, visible to everyone.
Default: []
subjectstringoptionalSubject line. Optional; defaults to an empty subject.
Default: ""
toarray of stringrequiredPrimary recipients. At least one is required; to, cc and bcc together may not exceed 50 addresses.
Min items: 1
Responses
StatusMeaningBody
202Successful Responseany
401Auth failed—
422Validation ErrorHTTPValidationError
Example request
curl -s -X POST "https://api.sheetgo.com/rest/beta/gmail/send" \
  -H "Authorization: Bearer $SHEETGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d @body.json

Models used on this page

Every request and response model referenced above, including nested ones (6). The full catalogue is on the Models page.

AttachmentIn

FieldTypeDescription
content_base64stringrequiredThe file's bytes, base64-encoded. All attachments on one message must total no more than 3 MB decoded.
content_typestringrequiredMIME type of the attachment, e.g. application/pdf.
filenamestringrequiredFile name the recipient will see, including the extension.

BodyContent

FieldTypeDescription
contentstringrequiredThe message body itself, in the format named by content_type.
content_typeone of "text", "html"optionalHow content should be interpreted: text for plain text, html for an HTML body.
Default: "text"

GmailBatchBody

Fetch several messages in one request, by id (SG-14893; mirrors Outlook's).

FieldTypeDescription
idsarray of stringrequiredMessage ids to fetch. At most 50, or 10 when include_attachments is true.
Min items: 1
include_attachmentsbooleanoptionalWhether to return each message's attachment content (base64) as well as its metadata. Lowers the batch cap to 10; attachments may total at most 25 MB across the batch.
Default: false

Used by: POST /rest/beta/gmail/messages/batch

GmailSendBody

One message to send through the authorized Gmail account.

Gmail always stores a sent message in SENT, so there is no equivalent of Outlook's save_to_sent_items.

FieldTypeDescription
attachmentsarray of AttachmentInoptionalFiles to attach: at most 10, totalling no more than 3 MB once decoded.
Default: []
bccarray of stringoptionalBlind-carbon-copy recipients, hidden from other recipients.
Default: []
bodyBodyContentrequiredThe message body and whether it is plain text or HTML.
ccarray of stringoptionalCarbon-copy recipients, visible to everyone.
Default: []
subjectstringoptionalSubject line. Optional; defaults to an empty subject.
Default: ""
toarray of stringrequiredPrimary recipients. At least one is required; to, cc and bcc together may not exceed 50 addresses.
Min items: 1

Used by: POST /rest/beta/gmail/send

HTTPValidationError

FieldTypeDescription
detailarray of ValidationErroroptional

Used by: GET /rest/beta/workflows/, POST /rest/beta/workflows/, POST /rest/beta/workflows/run/{id}, GET /rest/beta/workflows/{id}, PATCH /rest/beta/workflows/{id}, DELETE /rest/beta/workflows/{id}, GET /rest/beta/workflows/{id}/collaborators, POST /rest/beta/workflows/{id}/collaborators, DELETE /rest/beta/workflows/{id}/collaborators, PATCH /rest/beta/workflows/{id}/collaborators/{email}, DELETE /rest/beta/workflows/{id}/collaborators/{email}, GET /rest/beta/workflows/{id}/destinations, GET /rest/beta/workflows/{id}/files, GET /rest/beta/workflows/{id}/general-access, PUT /rest/beta/workflows/{id}/general-access, DELETE /rest/beta/workflows/{id}/general-access, POST /rest/beta/workflows/{id}/leave, POST /rest/beta/workflows/{id}/request-access, GET /rest/beta/workflows/{id}/run, POST /rest/beta/workflows/{id}/run, GET /rest/beta/workflows/{id}/sources, GET /rest/beta/automations/, POST /rest/beta/automations/run/{id}, GET /rest/beta/automations/{id}, DELETE /rest/beta/automations/{id}, GET /rest/beta/automations/{id}/destinations, GET /rest/beta/automations/{id}/files, GET /rest/beta/automations/{id}/run, POST /rest/beta/automations/{id}/run, GET /rest/beta/automations/{id}/sources, GET /rest/beta/workflows/{id}/trigger, DELETE /rest/beta/workflows/{id}/trigger, GET /rest/beta/workflows/{id}/dashboard, DELETE /rest/beta/workflows/{id}/dashboard/elements/{element_id}, GET /rest/beta/workflows/{id}/dashboard/elements/{element_id}/data, PUT /rest/beta/workflows/{id}/dashboard/publish, GET /rest/beta/workflows/{workflow_id}/forms/, POST /rest/beta/workflows/{workflow_id}/forms/, GET /rest/beta/workflows/{workflow_id}/forms/{form_id}, PATCH /rest/beta/workflows/{workflow_id}/forms/{form_id}, DELETE /rest/beta/workflows/{workflow_id}/forms/{form_id}, GET /rest/beta/workflows/{workflow_id}/forms/{form_id}/responses, HEAD /rest/beta/workflows/{workflow_id}/forms/{form_id}/responses, GET /rest/beta/automations/{automation_id}/webhook, GET /rest/beta/workflows/{workflow_id}/webhooks, GET /rest/beta/api-destination/{public_id}, HEAD /rest/beta/api-destination/{public_id}, GET /rest/beta/integrations/{provider}/options, GET /rest/beta/outlook/messages, POST /rest/beta/outlook/messages/batch, GET /rest/beta/outlook/messages/{message_id}, GET /rest/beta/outlook/messages/{message_id}/attachments/{attachment_id}, POST /rest/beta/outlook/send, GET /rest/beta/gmail/messages, POST /rest/beta/gmail/messages/batch, GET /rest/beta/gmail/messages/{message_id}, GET /rest/beta/gmail/messages/{message_id}/attachments/{attachment_id}, POST /rest/beta/gmail/send, GET /rest/beta/files/{provider}, GET /rest/beta/files/{provider}/roots, GET /rest/beta/files/{provider}/search, GET /rest/beta/files/{provider}/{file_id}, GET /rest/beta/bigquery/projects, GET /rest/beta/bigquery/projects/{project}/datasets, GET /rest/beta/bigquery/projects/{project}/datasets/{dataset}/tables, GET /rest/beta/bigquery/projects/{project}/datasets/{dataset}/tables/{table}, POST /rest/beta/bigquery/projects/{project}/validate-query, POST /rest/auth/refresh, POST /rest/auth/token

ValidationError

FieldTypeDescription
locarray of string or integerrequired
msgstringrequired
typestringrequired