{
  "service": "sendgrid",
  "displayName": "SendGrid",
  "categories": [
    "Communication",
    "Marketing"
  ],
  "authTypes": [
    "api_key"
  ],
  "auth": [
    {
      "type": "api_key",
      "label": "API Key",
      "placeholder": "SG....",
      "description": "SendGrid API key used with the Authorization Bearer header. Create it in Settings > API Keys: https://www.twilio.com/docs/sendgrid/ui/account-and-settings/api-keys/.",
      "extraFields": [
        {
          "key": "baseUrl",
          "label": "API Base URL",
          "inputType": "text",
          "required": false,
          "secret": false,
          "placeholder": "https://api.sendgrid.com",
          "description": "Optional override for EU regional subusers, for example https://api.eu.sendgrid.com."
        }
      ]
    }
  ],
  "homepageUrl": "https://sendgrid.com",
  "actions": [
    {
      "id": "sendgrid.get_account_info",
      "service": "sendgrid",
      "name": "get_account_info",
      "description": "Get the current SendGrid account type and sender reputation.",
      "requiredScopes": [],
      "providerPermissions": [
        "user.account.read"
      ],
      "inputSchema": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "The empty input payload for this action."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "accountType": {
            "type": "string",
            "description": "The SendGrid account type."
          },
          "reputation": {
            "type": "number",
            "description": "The sender reputation score returned by SendGrid."
          }
        },
        "additionalProperties": false,
        "description": "The SendGrid account information returned by this action."
      }
    },
    {
      "id": "sendgrid.get_user_scopes",
      "service": "sendgrid",
      "name": "get_user_scopes",
      "description": "Get the SendGrid API key scopes available to the current credential.",
      "requiredScopes": [],
      "providerPermissions": [],
      "inputSchema": {
        "type": "object",
        "properties": {},
        "additionalProperties": false,
        "description": "The empty input payload for this action."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "One SendGrid scope granted to this API key."
            },
            "description": "The SendGrid scopes available to this API key."
          }
        },
        "additionalProperties": false,
        "description": "The SendGrid scope list returned by this action."
      }
    },
    {
      "id": "sendgrid.list_transactional_templates",
      "service": "sendgrid",
      "name": "list_transactional_templates",
      "description": "List SendGrid transactional templates with pagination metadata.",
      "requiredScopes": [],
      "providerPermissions": [
        "templates.read"
      ],
      "inputSchema": {
        "type": "object",
        "properties": {
          "pageSize": {
            "type": "integer",
            "minimum": 1,
            "description": "The number of templates to return per page."
          },
          "pageToken": {
            "type": "string",
            "minLength": 1,
            "description": "The opaque page token returned by a previous SendGrid templates response."
          },
          "generations": {
            "type": "string",
            "enum": [
              "legacy",
              "dynamic",
              "legacy,dynamic"
            ],
            "description": "The template generations accepted by the SendGrid templates API."
          }
        },
        "additionalProperties": false,
        "description": "The query parameters for listing SendGrid transactional templates."
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The transactional template ID."
                },
                "name": {
                  "type": "string",
                  "description": "The transactional template name."
                },
                "generation": {
                  "type": "string",
                  "enum": [
                    "legacy",
                    "dynamic"
                  ],
                  "description": "The transactional template generation returned by SendGrid."
                },
                "updatedAt": {
                  "type": "string",
                  "description": "The last update timestamp for this transactional template."
                },
                "versions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "The transactional template version ID."
                      },
                      "name": {
                        "type": "string",
                        "description": "The transactional template version name."
                      },
                      "active": {
                        "type": "integer",
                        "description": "Whether this template version is active as 1 or 0."
                      },
                      "editor": {
                        "type": "string",
                        "enum": [
                          "code",
                          "design"
                        ],
                        "description": "The editor mode used for this template version."
                      },
                      "subject": {
                        "type": "string",
                        "description": "The template version subject."
                      },
                      "testData": {
                        "type": "string",
                        "description": "The dynamic template test data returned by SendGrid."
                      },
                      "updatedAt": {
                        "type": "string",
                        "description": "The last update timestamp for this version."
                      },
                      "templateId": {
                        "type": "string",
                        "description": "The parent transactional template ID."
                      },
                      "htmlContent": {
                        "type": "string",
                        "description": "The HTML content stored on this version."
                      },
                      "plainContent": {
                        "type": "string",
                        "description": "The plain-text content stored on this version."
                      },
                      "thumbnailUrl": {
                        "type": "string",
                        "description": "The optional thumbnail preview URL returned by SendGrid."
                      },
                      "generatePlainContent": {
                        "type": "boolean",
                        "description": "Whether SendGrid generates plain text from the HTML content."
                      }
                    },
                    "additionalProperties": false,
                    "required": [
                      "id",
                      "name",
                      "active"
                    ],
                    "description": "One SendGrid transactional template version."
                  },
                  "description": "The transactional template versions returned by SendGrid."
                }
              },
              "additionalProperties": false,
              "description": "One SendGrid transactional template."
            },
            "description": "The transactional templates returned by SendGrid."
          },
          "count": {
            "anyOf": [
              {
                "type": "integer",
                "description": "The total template count returned by SendGrid, or null when absent."
              },
              {
                "type": "null"
              }
            ]
          },
          "nextPageToken": {
            "anyOf": [
              {
                "type": "string",
                "description": "The next page token extracted from SendGrid pagination metadata."
              },
              {
                "type": "null"
              }
            ]
          },
          "previousPageToken": {
            "anyOf": [
              {
                "type": "string",
                "description": "The previous page token extracted from SendGrid pagination metadata."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "The normalized SendGrid transactional template list."
      }
    },
    {
      "id": "sendgrid.send_email",
      "service": "sendgrid",
      "name": "send_email",
      "description": "Send a transactional email with SendGrid Mail Send.",
      "requiredScopes": [],
      "providerPermissions": [
        "mail.send"
      ],
      "inputSchema": {
        "type": "object",
        "properties": {
          "from": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "description": "The sender email address.",
                "format": "email"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "description": "The optional sender display name."
              }
            },
            "additionalProperties": false,
            "required": [
              "email"
            ],
            "description": "One SendGrid sender object."
          },
          "to": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "description": "The recipient email address.",
                  "format": "email"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The optional recipient display name."
                }
              },
              "additionalProperties": false,
              "required": [
                "email"
              ],
              "description": "One SendGrid email recipient."
            },
            "description": "The primary recipients for this email.",
            "minItems": 1
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "description": "The recipient email address.",
                  "format": "email"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The optional recipient display name."
                }
              },
              "additionalProperties": false,
              "required": [
                "email"
              ],
              "description": "One SendGrid email recipient."
            },
            "description": "The optional Cc recipients.",
            "minItems": 1
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "description": "The recipient email address.",
                  "format": "email"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The optional recipient display name."
                }
              },
              "additionalProperties": false,
              "required": [
                "email"
              ],
              "description": "One SendGrid email recipient."
            },
            "description": "The optional Bcc recipients.",
            "minItems": 1
          },
          "replyTo": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "description": "The sender email address.",
                "format": "email"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "description": "The optional sender display name."
              }
            },
            "additionalProperties": false,
            "required": [
              "email"
            ],
            "description": "One SendGrid sender object."
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "description": "The email subject line."
          },
          "htmlContent": {
            "type": "string",
            "description": "The optional HTML body content."
          },
          "textContent": {
            "type": "string",
            "description": "The optional plain-text body content."
          },
          "templateId": {
            "type": "string",
            "minLength": 1,
            "description": "The optional SendGrid template ID."
          },
          "dynamicTemplateData": {
            "type": "object",
            "properties": {},
            "additionalProperties": true,
            "description": "The optional dynamic template data sent with the email."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "description": "One SendGrid category name."
            },
            "description": "The optional SendGrid categories attached to this email.",
            "maxItems": 10
          },
          "customArgs": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "description": "One custom argument value."
            },
            "description": "The optional custom arguments attached to this email."
          },
          "sendAt": {
            "type": "integer",
            "minimum": 1,
            "description": "The optional Unix timestamp that schedules this email."
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contentBase64": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The Base64-encoded attachment content."
                },
                "filename": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The attachment file name."
                },
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The optional attachment MIME type."
                },
                "disposition": {
                  "type": "string",
                  "enum": [
                    "attachment",
                    "inline"
                  ],
                  "description": "The optional attachment disposition."
                },
                "contentId": {
                  "type": "string",
                  "minLength": 1,
                  "description": "The optional content ID used for inline attachments."
                }
              },
              "additionalProperties": false,
              "required": [
                "contentBase64",
                "filename"
              ],
              "description": "One attachment accepted by the SendGrid Mail Send API."
            },
            "description": "The optional attachments included with this email."
          }
        },
        "additionalProperties": false,
        "required": [
          "from",
          "to"
        ],
        "description": "The request payload for sending a transactional email with SendGrid.",
        "allOf": [
          {
            "anyOf": [
              {
                "required": [
                  "templateId"
                ]
              },
              {
                "required": [
                  "subject"
                ]
              }
            ]
          },
          {
            "anyOf": [
              {
                "required": [
                  "templateId"
                ]
              },
              {
                "required": [
                  "htmlContent"
                ]
              },
              {
                "required": [
                  "textContent"
                ]
              }
            ]
          }
        ]
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "accepted": {
            "type": "boolean",
            "description": "Whether SendGrid accepted the email for delivery."
          },
          "messageId": {
            "anyOf": [
              {
                "type": "string",
                "description": "The optional SendGrid message ID response header."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "The normalized SendGrid mail submission result."
      }
    }
  ]
}
