Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to SendGrid

Scalekit connector
Open markdown

The SendGrid connector lets your AI agent act in each user's SendGrid account. Each user connects their own SendGrid access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 391 tools.

Tools
391
What they doRead · write · destructive
189 · 136 · 66189 read136 write66 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the SendGrid connection

    In AgentKit > Connections, create a SendGrid connection. The name you give it is the connection_name your code passes. See Configure connections.

    Console steps with screenshots

    Register your Scalekit environment with the SendGrid connector so Scalekit can authenticate requests on your behalf. The connection name you create will be used to identify and invoke the connection programmatically. Then complete the configuration in your application as follows:

    1. Create an API key

      • Go to SendGrid > Settings > API Keys and click Create key.

      • Choose Full Access (or Restricted Access with the permissions your agent needs) and give it a descriptive name, for example Agent Auth.

        Create API Key in SendGrid

    2. Copy the key

      • Click Create & View. SendGrid shows the key exactly once.

      • Copy it immediately and store it securely — you can’t view it again after leaving this screen.

        API key created in SendGrid

    3. Add the key in Scalekit

      • In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find SendGrid and click Create.
      • Paste the API key you copied in step 2.
      • Click Save.
  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'sendgrid'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize SendGrid:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'sendgrid_get_contactdb_upload_status',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their SendGrid credentials there. If your app already has a user's credentials, add the account from your backend instead, as the console steps above show. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • sendgrid_download_csvRetrieve a presigned download URL for a CSV export previously requested via the Request CSV tool.Read-only

    Download CSV (Email Activity)

    Retrieve a presigned download URL for a CSV export previously requested via the Request CSV tool. Pass the download_uuid included in the notification email SendGrid sends once the CSV is ready (the same UUID appears in that email's download link). The returned presigned_url is a time-limited, directly downloadable link to the CSV file.

    Inputs

    download_uuidstringrequired
    The UUID identifying the CSV download request, taken from the notification email SendGrid sends once the export (requested via the Request CSV tool) is ready.
  • sendgrid_export_automation_statExport stats for one or more Automations as CSV data.Read-only

    Export Automation Stats

    Export stats for one or more Automations as CSV data. Provide a comma-separated list of Automation IDs (up to 50) in ids. The response body is raw CSV text (not JSON) that your application can save directly as a .csv file or parse as needed. The timezone parameter only affects how dates are formatted in the CSV; it does not filter which stats are included.

    Inputs

    idsstringrequired
    Comma-separated list of Automation IDs (1-50) for which to export stats as CSV.
    timezonestring
    IANA Area/Region string representing the timezone in which the stats are presented in the exported CSV, e.g. "America/Chicago". Defaults to UTC. Changes formatting only, not which stats are returned.default UTC
  • sendgrid_export_single_send_statExport stats for one or more Single Sends as CSV data.Read-only

    Export Single Send Stats

    Export stats for one or more Single Sends as CSV data. Provide a comma-separated list of Single Send IDs (up to 50) in ids. The response body is raw CSV text (not JSON) that your application can save directly as a .csv file or parse as needed. The timezone parameter only affects how dates are formatted in the CSV; it does not filter which stats are included.

    Inputs

    idsstringrequired
    Comma-separated list of Single Send IDs (1-50) for which to export stats as CSV.
    timezonestring
    IANA Area/Region string representing the timezone in which the stats are presented in the exported CSV, e.g. "America/Chicago". Defaults to UTC. Changes formatting only, not which stats are returned.default UTC
  • sendgrid_find_integration_by_idRetrieve the details of a specific External Integration by its ID, including destination, label, the configured filters.email_events array, and the destination-specific properties object (e.g.Read-only

    Get Integration

    Retrieve the details of a specific External Integration by its ID, including destination, label, the configured filters.email_events array, and the destination-specific properties object (e.g. write_key and destination_region for Segment). Obtain the id from the List Integrations tool's response (the 'integration_id' field).

    Inputs

    idstringrequired
    The ID of the Integration to retrieve. Obtain this from the List Integrations tool's response (the 'integration_id' field).
  • sendgrid_get_account_stateRetrieve the current state of a specific sub-account under your Twilio SendGrid partner organization.Read-only

    Get Account State

    Retrieve the current state of a specific sub-account under your Twilio SendGrid partner organization. The returned state is one of: activated, deactivated, suspended, banned, or indeterminate. Suspended, banned, and indeterminate are system-assigned states and cannot be set directly (see Update Account State, which only accepts activated/deactivated).

    Inputs

    account_idstringrequired
    The Twilio SendGrid account ID whose state should be retrieved.
  • sendgrid_get_alertRetrieve a single SendGrid alert by its numeric alert_id.Read-only

    Get Alert

    Retrieve a single SendGrid alert by its numeric alert_id. Returns the alert's type (usage_limit or stats_notification), notification recipient (email_to), created_at/updated_at Unix timestamps, and — depending on type — its frequency (for stats_notification, e.g. daily/weekly/monthly) or percentage usage threshold (for usage_limit).

    Inputs

    alert_idintegerrequired
    The numeric ID of the alert to retrieve. Obtain this from the List Alerts tool's response (the "id" field).
  • sendgrid_get_allowed_ipRetrieve a single entry from this SendGrid account's access allow list by its numeric rule_id.Read-only

    Get Allowed IP

    Retrieve a single entry from this SendGrid account's access allow list by its numeric rule_id. Returns the allowed ip (or CIDR/wildcard range) along with created_at/updated_at Unix timestamps. Obtain rule_id from the List Allowed IPs tool's response (the "id" field).

    Inputs

    rule_idstringrequired
    The numeric id of the allowed IP address entry to retrieve. Obtain this from the List Allowed IPs tool's response (the "id" field).
    on_behalf_ofstring
    Optional 'on-behalf-of' header value to make this call from a parent account on behalf of one of its Subusers or customer accounts. Use 'account-id <account-id>' for a customer account, or the Subuser's username for a Subuser. Uses the parent account's API key.
  • sendgrid_get_api_keyRetrieve a single API key's name, ID, and scopes using its api_key_id.Read-only

    Get API Key

    Retrieve a single API key's name, ID, and scopes using its api_key_id. Returns HTTP 404 if the key does not exist. Use this to inspect a key's granted permission scopes after creation — the secret key value itself is never retrievable after it was first created.

    Inputs

    api_key_idstringrequired
    The ID of the API key to retrieve. Obtain this from the List API Keys or Create API Key tool's response (the "api_key_id" field).