Skip to main content
Every gmail.api.* operation is listed below with parameter shapes and return types from the plugin Zod schemas.
New to Corsair? See API access, authentication, and error handling.

Drafts

create

drafts.create Create a new draft Risk: write
await corsair.gmail.api.drafts.create({});
Input
NameTypeRequiredDescription
userIdstringNo
draftobjectYes
{
  message?: {
    raw?: string,
    threadId?: string
  }
}
Output
NameTypeRequiredDescription
idstringNo
messageobjectNo
{
  id?: string,
  threadId?: string,
  labelIds?: string[],
  snippet?: string,
  historyId?: string,
  internalDate?: string | number | date | null,
  sizeEstimate?: number,
  payload?: {
    partId?: string,
    mimeType?: string,
    filename?: string,
    headers?: {
      name?: string,
      value?: string
    }[],
    body?: {
      attachmentId?: string,
      size?: number,
      data?: string
    },
    parts: lazy
  },
  raw?: string
}

delete

drafts.delete Delete a draft [DESTRUCTIVE] Risk: destructive
await corsair.gmail.api.drafts.delete({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output: void

get

drafts.get Get a specific draft Risk: read
await corsair.gmail.api.drafts.get({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
formatminimal | full | raw | metadataNo
Output
NameTypeRequiredDescription
idstringNo
messageobjectNo
{
  id?: string,
  threadId?: string,
  labelIds?: string[],
  snippet?: string,
  historyId?: string,
  internalDate?: string | number | date | null,
  sizeEstimate?: number,
  payload?: {
    partId?: string,
    mimeType?: string,
    filename?: string,
    headers?: {
      name?: string,
      value?: string
    }[],
    body?: {
      attachmentId?: string,
      size?: number,
      data?: string
    },
    parts: lazy
  },
  raw?: string
}

list

drafts.list List drafts in the mailbox Risk: read
await corsair.gmail.api.drafts.list({});
Input
NameTypeRequiredDescription
userIdstringNo
maxResultsnumberNo
pageTokenstringNo
qstringNo
Output
NameTypeRequiredDescription
draftsobject[]No
nextPageTokenstringNo
resultSizeEstimatenumberNo
{
  id?: string,
  message?: {
    id?: string,
    threadId?: string,
    labelIds?: string[],
    snippet?: string,
    historyId?: string,
    internalDate?: string | number | date | null,
    sizeEstimate?: number,
    payload?: {
      partId?: string,
      mimeType?: string,
      filename?: string,
      headers?: {
        name?: string,
        value?: string
      }[],
      body?: {
        attachmentId?: string,
        size?: number,
        data?: string
      },
      parts: lazy
    },
    raw?: string
  }
}[]

send

drafts.send Send a draft as an email Risk: write
await corsair.gmail.api.drafts.send({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringNo
messageobjectNo
{
  raw?: string,
  threadId?: string
}
Output
NameTypeRequiredDescription
idstringNo
threadIdstringNo
labelIdsstring[]No
snippetstringNo
historyIdstringNo
internalDatestring | number | dateNo
sizeEstimatenumberNo
payloadobjectNo
rawstringNo
{
  partId?: string,
  mimeType?: string,
  filename?: string,
  headers?: {
    name?: string,
    value?: string
  }[],
  body?: {
    attachmentId?: string,
    size?: number,
    data?: string
  },
  parts: lazy
}

update

drafts.update Update an existing draft Risk: write
await corsair.gmail.api.drafts.update({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
draftobjectYes
{
  message?: {
    raw?: string,
    threadId?: string
  }
}
Output
NameTypeRequiredDescription
idstringNo
messageobjectNo
{
  id?: string,
  threadId?: string,
  labelIds?: string[],
  snippet?: string,
  historyId?: string,
  internalDate?: string | number | date | null,
  sizeEstimate?: number,
  payload?: {
    partId?: string,
    mimeType?: string,
    filename?: string,
    headers?: {
      name?: string,
      value?: string
    }[],
    body?: {
      attachmentId?: string,
      size?: number,
      data?: string
    },
    parts: lazy
  },
  raw?: string
}

Labels

create

labels.create Create a new label Risk: write
await corsair.gmail.api.labels.create({});
Input
NameTypeRequiredDescription
userIdstringNo
labelobjectYes
{
  name?: string,
  messageListVisibility?: show | hide,
  labelListVisibility?: labelShow | labelShowIfUnread | labelHide,
  color?: {
    textColor?: string,
    backgroundColor?: string
  }
}
Output
NameTypeRequiredDescription
idstringNo
namestringNo
messageListVisibilityshow | hideNo
labelListVisibilitylabelShow | labelShowIfUnread | labelHideNo
typesystem | userNo
messagesTotalnumberNo
messagesUnreadnumberNo
threadsTotalnumberNo
threadsUnreadnumberNo
colorobjectNo
{
  textColor?: string,
  backgroundColor?: string
}

delete

labels.delete Delete a label [DESTRUCTIVE] Risk: destructive
await corsair.gmail.api.labels.delete({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output: void

get

labels.get Get a specific label Risk: read
await corsair.gmail.api.labels.get({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output
NameTypeRequiredDescription
idstringNo
namestringNo
messageListVisibilityshow | hideNo
labelListVisibilitylabelShow | labelShowIfUnread | labelHideNo
typesystem | userNo
messagesTotalnumberNo
messagesUnreadnumberNo
threadsTotalnumberNo
threadsUnreadnumberNo
colorobjectNo
{
  textColor?: string,
  backgroundColor?: string
}

list

labels.list List all labels in the mailbox Risk: read
await corsair.gmail.api.labels.list({});
Input
NameTypeRequiredDescription
userIdstringNo
Output
NameTypeRequiredDescription
labelsobject[]No
{
  id?: string,
  name?: string,
  messageListVisibility?: show | hide,
  labelListVisibility?: labelShow | labelShowIfUnread | labelHide,
  type?: system | user,
  messagesTotal?: number,
  messagesUnread?: number,
  threadsTotal?: number,
  threadsUnread?: number,
  color?: {
    textColor?: string,
    backgroundColor?: string
  }
}[]

update

labels.update Update an existing label Risk: write
await corsair.gmail.api.labels.update({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
labelobjectYes
{
  name?: string,
  messageListVisibility?: show | hide,
  labelListVisibility?: labelShow | labelShowIfUnread | labelHide,
  color?: {
    textColor?: string,
    backgroundColor?: string
  }
}
Output
NameTypeRequiredDescription
idstringNo
namestringNo
messageListVisibilityshow | hideNo
labelListVisibilitylabelShow | labelShowIfUnread | labelHideNo
typesystem | userNo
messagesTotalnumberNo
messagesUnreadnumberNo
threadsTotalnumberNo
threadsUnreadnumberNo
colorobjectNo
{
  textColor?: string,
  backgroundColor?: string
}

Messages

batchModify

messages.batchModify Add or remove labels from multiple messages in bulk Risk: write
await corsair.gmail.api.messages.batchModify({});
Input
NameTypeRequiredDescription
userIdstringNo
idsstring[]No
addLabelIdsstring[]No
removeLabelIdsstring[]No
Output: void

delete

messages.delete Permanently delete a message [DESTRUCTIVE · IRREVERSIBLE] Risk: destructive · Irreversible
await corsair.gmail.api.messages.delete({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output: void

get

messages.get Get a specific message Risk: read
await corsair.gmail.api.messages.get({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
formatminimal | full | raw | metadataNo
metadataHeadersstring[]No
Output
NameTypeRequiredDescription
idstringNo
threadIdstringNo
labelIdsstring[]No
snippetstringNo
historyIdstringNo
internalDatestring | number | dateNo
sizeEstimatenumberNo
payloadobjectNo
rawstringNo
{
  partId?: string,
  mimeType?: string,
  filename?: string,
  headers?: {
    name?: string,
    value?: string
  }[],
  body?: {
    attachmentId?: string,
    size?: number,
    data?: string
  },
  parts: lazy
}

list

messages.list List messages in a mailbox Risk: read
await corsair.gmail.api.messages.list({});
Input
NameTypeRequiredDescription
userIdstringNo
qstringNo
maxResultsnumberNo
pageTokenstringNo
labelIdsstring[]No
includeSpamTrashbooleanNo
Output
NameTypeRequiredDescription
messagesobject[]No
nextPageTokenstringNo
resultSizeEstimatenumberNo
{
  id?: string,
  threadId?: string,
  labelIds?: string[],
  snippet?: string,
  historyId?: string,
  internalDate?: string | number | date | null,
  sizeEstimate?: number,
  payload?: {
    partId?: string,
    mimeType?: string,
    filename?: string,
    headers?: {
      name?: string,
      value?: string
    }[],
    body?: {
      attachmentId?: string,
      size?: number,
      data?: string
    },
    parts: lazy
  },
  raw?: string
}[]

modify

messages.modify Add or remove labels from a message Risk: write
await corsair.gmail.api.messages.modify({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
addLabelIdsstring[]No
removeLabelIdsstring[]No
Output
NameTypeRequiredDescription
idstringNo
threadIdstringNo
labelIdsstring[]No
snippetstringNo
historyIdstringNo
internalDatestring | number | dateNo
sizeEstimatenumberNo
payloadobjectNo
rawstringNo
{
  partId?: string,
  mimeType?: string,
  filename?: string,
  headers?: {
    name?: string,
    value?: string
  }[],
  body?: {
    attachmentId?: string,
    size?: number,
    data?: string
  },
  parts: lazy
}

send

messages.send Send an email to one or more recipients Risk: write
await corsair.gmail.api.messages.send({});
Input
NameTypeRequiredDescription
userIdstringNo
rawstringYes
threadIdstringNo
Output
NameTypeRequiredDescription
idstringNo
threadIdstringNo
labelIdsstring[]No
snippetstringNo
historyIdstringNo
internalDatestring | number | dateNo
sizeEstimatenumberNo
payloadobjectNo
rawstringNo
{
  partId?: string,
  mimeType?: string,
  filename?: string,
  headers?: {
    name?: string,
    value?: string
  }[],
  body?: {
    attachmentId?: string,
    size?: number,
    data?: string
  },
  parts: lazy
}

trash

messages.trash Move a message to the trash Risk: write
await corsair.gmail.api.messages.trash({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output
NameTypeRequiredDescription
idstringNo
threadIdstringNo
labelIdsstring[]No
snippetstringNo
historyIdstringNo
internalDatestring | number | dateNo
sizeEstimatenumberNo
payloadobjectNo
rawstringNo
{
  partId?: string,
  mimeType?: string,
  filename?: string,
  headers?: {
    name?: string,
    value?: string
  }[],
  body?: {
    attachmentId?: string,
    size?: number,
    data?: string
  },
  parts: lazy
}

untrash

messages.untrash Restore a message from the trash Risk: write
await corsair.gmail.api.messages.untrash({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output
NameTypeRequiredDescription
idstringNo
threadIdstringNo
labelIdsstring[]No
snippetstringNo
historyIdstringNo
internalDatestring | number | dateNo
sizeEstimatenumberNo
payloadobjectNo
rawstringNo
{
  partId?: string,
  mimeType?: string,
  filename?: string,
  headers?: {
    name?: string,
    value?: string
  }[],
  body?: {
    attachmentId?: string,
    size?: number,
    data?: string
  },
  parts: lazy
}

Threads

delete

threads.delete Permanently delete a thread [DESTRUCTIVE · IRREVERSIBLE] Risk: destructive · Irreversible
await corsair.gmail.api.threads.delete({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output: void

get

threads.get Get a specific thread Risk: read
await corsair.gmail.api.threads.get({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
formatminimal | full | metadataNo
metadataHeadersstring[]No
Output
NameTypeRequiredDescription
idstringNo
snippetstringNo
historyIdstringNo
messagesobject[]No
{
  id?: string,
  threadId?: string,
  labelIds?: string[],
  snippet?: string,
  historyId?: string,
  internalDate?: string | number | date | null,
  sizeEstimate?: number,
  payload?: {
    partId?: string,
    mimeType?: string,
    filename?: string,
    headers?: {
      name?: string,
      value?: string
    }[],
    body?: {
      attachmentId?: string,
      size?: number,
      data?: string
    },
    parts: lazy
  },
  raw?: string
}[]

list

threads.list List threads in the mailbox Risk: read
await corsair.gmail.api.threads.list({});
Input
NameTypeRequiredDescription
userIdstringNo
qstringNo
maxResultsnumberNo
pageTokenstringNo
labelIdsstring[]No
includeSpamTrashbooleanNo
Output
NameTypeRequiredDescription
threadsobject[]No
nextPageTokenstringNo
resultSizeEstimatenumberNo
{
  id?: string,
  snippet?: string,
  historyId?: string,
  messages?: {
    id?: string,
    threadId?: string,
    labelIds?: string[],
    snippet?: string,
    historyId?: string,
    internalDate?: string | number | date | null,
    sizeEstimate?: number,
    payload?: {
      partId?: string,
      mimeType?: string,
      filename?: string,
      headers?: {
        name?: string,
        value?: string
      }[],
      body?: {
        attachmentId?: string,
        size?: number,
        data?: string
      },
      parts: lazy
    },
    raw?: string
  }[]
}[]

modify

threads.modify Add or remove labels from a thread Risk: write
await corsair.gmail.api.threads.modify({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
addLabelIdsstring[]No
removeLabelIdsstring[]No
Output
NameTypeRequiredDescription
idstringNo
snippetstringNo
historyIdstringNo
messagesobject[]No
{
  id?: string,
  threadId?: string,
  labelIds?: string[],
  snippet?: string,
  historyId?: string,
  internalDate?: string | number | date | null,
  sizeEstimate?: number,
  payload?: {
    partId?: string,
    mimeType?: string,
    filename?: string,
    headers?: {
      name?: string,
      value?: string
    }[],
    body?: {
      attachmentId?: string,
      size?: number,
      data?: string
    },
    parts: lazy
  },
  raw?: string
}[]

trash

threads.trash Move a thread to the trash Risk: write
await corsair.gmail.api.threads.trash({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output
NameTypeRequiredDescription
idstringNo
snippetstringNo
historyIdstringNo
messagesobject[]No
{
  id?: string,
  threadId?: string,
  labelIds?: string[],
  snippet?: string,
  historyId?: string,
  internalDate?: string | number | date | null,
  sizeEstimate?: number,
  payload?: {
    partId?: string,
    mimeType?: string,
    filename?: string,
    headers?: {
      name?: string,
      value?: string
    }[],
    body?: {
      attachmentId?: string,
      size?: number,
      data?: string
    },
    parts: lazy
  },
  raw?: string
}[]

untrash

threads.untrash Restore a thread from the trash Risk: write
await corsair.gmail.api.threads.untrash({});
Input
NameTypeRequiredDescription
userIdstringNo
idstringYes
Output
NameTypeRequiredDescription
idstringNo
snippetstringNo
historyIdstringNo
messagesobject[]No
{
  id?: string,
  threadId?: string,
  labelIds?: string[],
  snippet?: string,
  historyId?: string,
  internalDate?: string | number | date | null,
  sizeEstimate?: number,
  payload?: {
    partId?: string,
    mimeType?: string,
    filename?: string,
    headers?: {
      name?: string,
      value?: string
    }[],
    body?: {
      attachmentId?: string,
      size?: number,
      data?: string
    },
    parts: lazy
  },
  raw?: string
}[]