productivity
SendGrid CLI for AI Agents
Use the SendGrid CLI from KosmoKrator to call SendGrid tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.SendGrid CLI Setup
SendGrid can be configured headlessly with `kosmokrator integrations:configure sendgrid`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure sendgrid --set api_key="$SENDGRID_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor sendgrid --json
kosmokrator integrations:status --json Credentials
Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
api_key | SENDGRID_API_KEY | Secret secret | yes | API Key |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call sendgrid.sendgrid_list_contacts '{"page_size":1,"page_token":"example_page_token"}' --json kosmo integrations:sendgrid sendgrid_list_contacts '{"page_size":1,"page_token":"example_page_token"}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs sendgrid --json
kosmo integrations:docs sendgrid.sendgrid_list_contacts --json
kosmo integrations:schema sendgrid.sendgrid_list_contacts --json
kosmo integrations:search "SendGrid" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
sendgrid.sendgrid_list_contacts
List contacts in your SendGrid marketing contacts database. Supports pagination.
read - Parameters
- page_size, page_token
kosmo integrations:call sendgrid.sendgrid_list_contacts '{"page_size":1,"page_token":"example_page_token"}' --json kosmo integrations:sendgrid sendgrid_list_contacts '{"page_size":1,"page_token":"example_page_token"}' --json sendgrid.sendgrid_send_email
Send an email via SendGrid. Specify sender, recipients, subject, and HTML or text content.
write - Parameters
- from, to, subject, htmlContent, textContent
kosmo integrations:call sendgrid.sendgrid_send_email '{"from":"example_from","to":"example_to","subject":"example_subject","htmlContent":"example_htmlContent","textContent":"example_textContent"}' --json kosmo integrations:sendgrid sendgrid_send_email '{"from":"example_from","to":"example_to","subject":"example_subject","htmlContent":"example_htmlContent","textContent":"example_textContent"}' --json sendgrid.sendgrid_get_contact
Get details of a specific contact in SendGrid by their contact ID. Returns email, custom fields, and list memberships.
read - Parameters
- id
kosmo integrations:call sendgrid.sendgrid_get_contact '{"id":"example_id"}' --json kosmo integrations:sendgrid sendgrid_get_contact '{"id":"example_id"}' --json sendgrid.sendgrid_get_current_user
Get the profile of the currently authenticated SendGrid user, including email, first name, and last name.
read - Parameters
- none
kosmo integrations:call sendgrid.sendgrid_get_current_user '{}' --json kosmo integrations:sendgrid sendgrid_get_current_user '{}' --json sendgrid.sendgrid_get_template
Get details of a specific email template in SendGrid by its ID. Returns template name, versions, and active version content.
read - Parameters
- id
kosmo integrations:call sendgrid.sendgrid_get_template '{"id":"example_id"}' --json kosmo integrations:sendgrid sendgrid_get_template '{"id":"example_id"}' --json sendgrid.sendgrid_list_emails
List emails in your SendGrid account. Supports filtering by query and pagination.
read - Parameters
- limit, query
kosmo integrations:call sendgrid.sendgrid_list_emails '{"limit":1,"query":"example_query"}' --json kosmo integrations:sendgrid sendgrid_list_emails '{"limit":1,"query":"example_query"}' --json sendgrid.sendgrid_list_templates
List email templates in your SendGrid account. Supports pagination.
read - Parameters
- page_size, page_token
kosmo integrations:call sendgrid.sendgrid_list_templates '{"page_size":1,"page_token":"example_page_token"}' --json kosmo integrations:sendgrid sendgrid_list_templates '{"page_size":1,"page_token":"example_page_token"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
sendgrid.sendgrid_list_contacts 2 parameters
kosmo integrations:schema sendgrid.sendgrid_list_contacts --json | Parameter | Type | Required | Description |
|---|---|---|---|
page_size | integer | no | Number of contacts to return per page (default: 50, max: 100). |
page_token | string | no | Token for the next page of results. |
sendgrid.sendgrid_send_email 5 parameters
kosmo integrations:schema sendgrid.sendgrid_send_email --json | Parameter | Type | Required | Description |
|---|---|---|---|
from | object | yes | Sender details as an object with "email" and optionally "name" keys, e.g. {"email": "noreply@example.com", "name": "My App"}. |
to | array | yes | Array of recipient objects, each with "email" and optionally "name", e.g. [{"email": "user@example.com", "name": "John"}]. |
subject | string | yes | The email subject line. |
htmlContent | string | no | HTML body of the email. |
textContent | string | no | Plain text body of the email. |
sendgrid.sendgrid_get_contact 1 parameters
kosmo integrations:schema sendgrid.sendgrid_get_contact --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The ID of the contact to retrieve. |
sendgrid.sendgrid_get_current_user 0 parameters
kosmo integrations:schema sendgrid.sendgrid_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
sendgrid.sendgrid_get_template 1 parameters
kosmo integrations:schema sendgrid.sendgrid_get_template --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The ID of the template to retrieve. |
sendgrid.sendgrid_list_emails 2 parameters
kosmo integrations:schema sendgrid.sendgrid_list_emails --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of emails to return (default: 20, max: 100). |
query | string | no | Search query to filter emails (e.g., "subject=\"Welcome\""). |
sendgrid.sendgrid_list_templates 2 parameters
kosmo integrations:schema sendgrid.sendgrid_list_templates --json | Parameter | Type | Required | Description |
|---|---|---|---|
page_size | integer | no | Number of templates to return per page (default: 20, max: 100). |
page_token | string | no | Token for the next page of results. |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.