Twilio SendGrid Marketing Campaigns Send Test Email API

The Twilio SendGrid Test Email API allows you to test a marketing email by first sending it to a list of up to 10 email addresses before pushing to a contact list or segment. With this feature, you can test the layout and content of your message in multiple email clients and with multiple recipients to see how it will function in a real-world scenario.

OpenAPI Specification

tsg_mc_test_v3.yaml Raw ↑
openapi: 3.1.0
security:
- BearerAuth: []
info:
  title: Twilio SendGrid Marketing Campaigns Send Test Email API
  summary: The Twilio SendGrid Test Email API allows you to test a marketing email
    by first sending it to a list of up to 10 email addresses before pushing to a
    contact list or segment.
  description: The Twilio SendGrid Test Email API allows you to test a marketing email
    by first sending it to a list of up to 10 email addresses before pushing to a
    contact list or segment. With this feature, you can test the layout and content
    of your message in multiple email clients and with multiple recipients to see
    how it will function in a real-world scenario.
  termsOfService: https://www.twilio.com/legal/tos
  contact:
    name: Twilio SendGrid Support
    url: https://support.sendgrid.com/hc/en-us
  license:
    name: MIT
    url: https://code.hq.twilio.com/twilio/sendgrid-oas/blob/main/LICENSE
  version: 1.0.0
  x-sendgrid:
    libraryPackage: mc_test
servers:
- url: https://api.sendgrid.com
  description: The Twilio SendGrid v3 API
paths:
  /v3/marketing/test/send_email:
    post:
      operationId: SendTestMarketingEmail
      summary: Send a Test Marketing Email
      tags:
      - Send Test Email
      description: '**This endpoint allows you to send a test marketing email to a
        list of email addresses**.


        Before sending a marketing message, you can test it using this endpoint. You
        may specify up to **10 contacts** in the `emails` request body field. You
        must also specify a `template_id` and include either a `from_address` or `sender_id`.
        You can manage your templates with the [Twilio SendGrid App](https://mc.sendgrid.com/dynamic-templates)
        or the [Transactional Templates API](https://docs.sendgrid.com/api-reference/transactional-templates).


        > Please note that this endpoint works with Dynamic Transactional Templates
        only. Legacy Transactional Templates will not be delivered.


        For more information about managing Dynamic Transactional Templates, see [How
        to Send Email with Dynamic Transactional Templates](https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/).


        You can also test your Single Sends in the [Twilio SendGrid Marketing Campaigns
        UI](https://mc.sendgrid.com/single-sends).'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                template_id:
                  type: string
                  format: uuid
                  description: The ID of the template that you would like to use.
                    If you use a template that contains a subject and content (either
                    text or HTML), then those values specified at the personalizations
                    or message level will not be used.
                version_id_override:
                  type: string
                  format: uuid
                  description: ' You can override the active template with an alternative
                    template version by passing the version ID in this field. If this
                    field is blank, the active template version will be used.'
                sender_id:
                  type: integer
                  description: This ID must belong to a verified sender. Alternatively,
                    you may supply a `from_address` email.
                custom_unsubscribe_url:
                  type: string
                  description: A custom unsubscribe URL.
                suppression_group_id:
                  type: integer
                emails:
                  type: array
                  uniqueItems: true
                  minItems: 1
                  maxItems: 10
                  items:
                    type: string
                    format: email
                  description: An array of email addresses you want to send the test
                    message to.
                from_address:
                  type: string
                  description: You can either specify this address or specify a verified
                    sender ID.
                  format: email
              required:
              - template_id
              - emails
              example:
                template_id: f8f77db8-b9fa-4b3c-9ee8-de3d582016b8
                version_id_override: 7734f757-8eb8-4d22-b7f0-779a72f32986
                sender_id: 6060664
                custom_unsubscribe_url: https://example.com/unsubscribe
                suppression_group_id: 21865513
                emails:
                - [email protected]
                - [email protected]
                - [email protected]
      responses:
        '202':
          description: ''
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/TestSend400'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
                description: An error message.
              field:
                description: When applicable, this property value will be the field
                  that generated the error.
                nullable: true
                type: string
              help:
                type: object
                description: When applicable, this property value will be helper text
                  or a link to documentation to help you troubleshoot the error.
        id:
          type: string
          description: When applicable, this property value will be an error ID.
      example:
        errors:
        - field: field_name
          message: error message
  responses:
    TestSend400:
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  parameters: {}
  examples: {}
  requestBodies: {}
  headers: {}
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Twilio SendGrid requires you to authenticate with its APIs using
        an API key. The API key must be sent as a bearer token in the Authorization
        header.
tags:
- name: Send Test Email
  description: Twilio SendGrid Marketing Campaigns Send Test Email API
externalDocs:
  description: Twilio SendGrid's official developer documentation.
  url: https://www.twilio.com/docs/sendgrid