Skip to content
Talk to an Engineer Dashboard

Gmail

Gmail is Google's cloud based email service that allows you to access your messages from any computer or device with just a web browser.

Gmail is Google’s cloud based email service that allows you to access your messages from any computer or device with just a web browser.

Gmail logo

Supports authentication: OAuth 2.0

  1. In Scalekit dashboard, go to Agent Auth → Create Connection.

  2. Find Gmail from the list of providers and click Create.

  3. Click Use your own credentials and copy the redirect URI — it will look like https://{your-env-url}/sso/v1/oauth/{connection_id}/callback.

    Configure Gmail Connection with redirect URI
  4. Navigate to Google Cloud Console’s APIs & Services > Credentials

  5. Select + Create Credentials, then OAuth client ID

  6. Choose Web application from the Application type menu

    Selecting Web Application in Google OAuth
  7. Under Authorized redirect URIs, click + Add URI, paste the redirect URI, and select Create.

    Adding Google redirect URI for OAuth

Google provides your Client ID and Client Secret credentials.

  1. In Google Cloud Console, go to APIs & Services > Library

  2. Search for “Gmail” in the API Library

  3. Select Gmail API

    Choosing the Gmail API in the Google Cloud Console Dashboard
  4. Press the blue Enable button

  1. In Scalekit dashboard, go to Agent Auth → Connections and open the connection you created.

  2. Enter your credentials:

    Add credentials
  3. Click Save

Connect a user’s Gmail account and make API calls on their behalf — Scalekit handles OAuth and token management automatically.

import scalekit.client, os
from dotenv import load_dotenv
load_dotenv()
connection_name = "gmail" # get your connection name from connection configurations
identifier = "user_123" # your unique user identifier
# Get your credentials from app.scalekit.com → Developers → Settings → API Credentials
scalekit_client = scalekit.client.ScalekitClient(
client_id=os.getenv("SCALEKIT_CLIENT_ID"),
client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
env_url=os.getenv("SCALEKIT_ENV_URL"),
)
actions = scalekit_client.actions
# Authenticate the user
link_response = actions.get_authorization_link(
connection_name=connection_name,
identifier=identifier
)
# present this link to your user for authorization, or click it yourself for testing
print("🔗 Authorize Gmail:", link_response.link)
input("Press Enter after authorizing...")
# Make a request via Scalekit proxy
result = actions.request(
connection_name=connection_name,
identifier=identifier,
path="/v1/users/me/profile",
method="GET"
)
print(result)

Fetch emails from a connected Gmail account using search filters. Requires a valid Gmail OAuth2 connection.

NameTypeRequiredDescription
formatstringNoFormat of the returned message.
include_spam_trashbooleanNoWhether to fetch emails from spam and trash folders
label_idsarray<string>NoGmail label IDs to filter messages
max_resultsintegerNoMaximum number of emails to fetch
page_tokenstringNoPage token for pagination
querystringNoSearch query string using Gmail’s search syntax (e.g., ‘is:unread from:user@example.com’)
schema_versionstringNoOptional schema version to use for tool execution
tool_versionstringNoOptional tool version to use for execution

Retrieve a specific attachment from a Gmail message using the message ID and attachment ID.

NameTypeRequiredDescription
attachment_idstringYesUnique Gmail attachment ID
file_namestringNoPreferred filename to use when saving/returning the attachment
message_idstringYesUnique Gmail message ID that contains the attachment
schema_versionstringNoOptional schema version to use for tool execution
tool_versionstringNoOptional tool version to use for execution

Fetch a list of contacts from the connected Gmail account. Supports pagination and field filtering.

NameTypeRequiredDescription
max_resultsintegerNoMaximum number of contacts to fetch
page_tokenstringNoToken to retrieve the next page of results
person_fieldsarray<string>NoFields to include for each person
schema_versionstringNoOptional schema version to use for tool execution
tool_versionstringNoOptional tool version to use for execution

Retrieve a specific Gmail message using its message ID. Optionally control the format of the returned data.

NameTypeRequiredDescription
formatstringNoFormat of the returned message.
message_idstringYesUnique Gmail message ID
schema_versionstringNoOptional schema version to use for tool execution
tool_versionstringNoOptional tool version to use for execution

List draft emails from a connected Gmail account. Requires a valid Gmail OAuth2 connection.

NameTypeRequiredDescription
max_resultsintegerNoMaximum number of drafts to fetch
page_tokenstringNoPage token for pagination
schema_versionstringNoOptional schema version to use for tool execution
tool_versionstringNoOptional tool version to use for execution

Search people or contacts in the connected Google account using a query. Requires a valid Google OAuth2 connection with People API scopes.

NameTypeRequiredDescription
other_contactsbooleanNoWhether to include people not in the user’s contacts (from ‘Other Contacts’).
page_sizeintegerNoMaximum number of people to return.
person_fieldsarray<string>NoFields to retrieve for each person.
querystringYesText query to search people (e.g., name, email address).
schema_versionstringNoOptional schema version to use for tool execution
tool_versionstringNoOptional tool version to use for execution