Twilio SendGrid Tracking Settings API

The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information.

OpenAPI Specification

tsg_tracking_settings_v3.yaml Raw ↑
openapi: 3.1.0
security:
- BearerAuth: []
info:
  title: Twilio SendGrid Tracking Settings API
  summary: The Twilio SendGrid Tracking Settings API allows you to configure which
    tracking settings are enabled for your messages.
  description: The Twilio SendGrid Tracking Settings API allows you to configure which
    tracking settings are enabled for your messages. You can track many of your recipients'
    interactions with your emails, including which emails they open, which links they
    click, and when they subscribe to or unsubscribe from your emails. See [**Tracking
    Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more
    information.
  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: tracking_settings
servers:
- url: https://api.sendgrid.com
  description: for global users and subusers
- url: https://api.eu.sendgrid.com
  description: for EU regional subusers
paths:
  /v3/tracking_settings:
    get:
      operationId: ListTrackingSetting
      summary: Retrieve Tracking Settings
      tags:
      - Tracking
      description: '**This endpoint allows you to retrieve a list of all tracking
        settings on your account.**'
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    description: The list of all tracking settings.
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          description: The name of the event being tracked.
                        title:
                          type: string
                          description: The title of the tracking setting.
                        description:
                          type: string
                          description: A description about the event that is being
                            tracked.
                        enabled:
                          type: boolean
                          description: Indicates if this tracking setting is currently
                            enabled.
              examples:
                response:
                  value:
                    result:
                    - name: open
                      title: Open Tracking
                      description: lorem ipsum... .
                      enabled: true
  /v3/tracking_settings/click:
    get:
      operationId: ListClickTrackingSetting
      summary: Retrieve Click Track Settings
      tags:
      - Tracking
      description: "**This endpoint allows you to retrieve your current click tracking\
        \ setting.**\n\nClick Tracking overrides all the links and URLs in your emails\
        \ and points them to either SendGrid\u2019s servers or the domain with which\
        \ you branded your link. When a customer clicks a link, SendGrid tracks those\
        \ [clicks](https://sendgrid.com/docs/glossary/clicks/).\n\nClick tracking\
        \ helps you understand how users are engaging with your communications. SendGrid\
        \ can track up to 1000 links per email"
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClickTracking'
              examples:
                response:
                  value:
                    enable_text: false
                    enabled: true
    patch:
      operationId: UpdateClickTrackingSetting
      summary: Update Click Tracking Settings
      tags:
      - Tracking
      description: "**This endpoint allows you to enable or disable your current click\
        \ tracking setting.**\n\nClick Tracking overrides all the links and URLs in\
        \ your emails and points them to either SendGrid\u2019s servers or the domain\
        \ with which you branded your link. When a customer clicks a link, SendGrid\
        \ tracks those [clicks](https://sendgrid.com/docs/glossary/clicks/).\n\nClick\
        \ tracking helps you understand how users are engaging with your communications.\
        \ SendGrid can track up to 1000 links per email"
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                enabled:
                  type: boolean
                  description: The setting you want to use for click tracking.
              example:
                enabled: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClickTracking'
              examples:
                response:
                  value:
                    enable_text: false
                    enabled: true
  /v3/tracking_settings/google_analytics:
    get:
      operationId: ListGoogleAnalyticsTrackingSetting
      summary: Retrieve Google Analytics Settings
      tags:
      - Tracking
      description: "**This endpoint allows you to retrieve your current setting for\
        \ Google Analytics.**\n\n\nGoogle Analytics helps you understand how users\
        \ got to your site and what they're doing there. For more information about\
        \ using Google Analytics, please refer to [Google\u2019s URL Builder](https://support.google.com/analytics/answer/1033867?hl=en)\
        \ and their article on [\"Best Practices for Campaign Building\"](https://support.google.com/analytics/answer/1037445).\n\
        \nWe default the settings to Google\u2019s recommendations. For more information,\
        \ see [Google Analytics Demystified](https://sendgrid.com/docs/ui/analytics-and-reporting/google-analytics/)."
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleAnalyticsSettings'
              examples:
                response:
                  value:
                    enabled: true
                    utm_campaign: ''
                    utm_content: lotsandlotsofcontent
                    utm_medium: ''
                    utm_source: ''
                    utm_term: ''
    patch:
      operationId: UpdateGoogleAnalyticsTrackingSetting
      summary: Update Google Analytics Settings
      tags:
      - Tracking
      description: "**This endpoint allows you to update your current setting for\
        \ Google Analytics.**\n\nGoogle Analytics helps you understand how users got\
        \ to your site and what they're doing there. For more information about using\
        \ Google Analytics, please refer to [Google\u2019s URL Builder](https://support.google.com/analytics/answer/1033867?hl=en)\
        \ and their article on [\"Best Practices for Campaign Building\"](https://support.google.com/analytics/answer/1037445).\n\
        \nWe default the settings to Google\u2019s recommendations. For more information,\
        \ see [Google Analytics Demystified](https://sendgrid.com/docs/ui/analytics-and-reporting/google-analytics/)."
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GoogleAnalyticsSettings'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleAnalyticsSettings'
              examples:
                response:
                  value:
                    enabled: true
                    utm_campaign: ''
                    utm_content: lotsandlotsofcontent
                    utm_medium: ''
                    utm_source: ''
                    utm_term: ''
  /v3/tracking_settings/open:
    get:
      operationId: ListOpenTrackingSetting
      summary: Get Open Tracking Settings
      tags:
      - Tracking
      description: "**This endpoint allows you to retrieve your current settings for\
        \ open tracking.**\n\nOpen Tracking adds an invisible image at the end of\
        \ the email which can track email opens.\n\nIf the email recipient has images\
        \ enabled on their email client, a request to SendGrid\u2019s server for the\
        \ invisible image is executed and an open event is logged.\n\nThese events\
        \ are logged in the Statistics portal, Email Activity interface, and are reported\
        \ by the Event Webhook."
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  enabled:
                    type: boolean
                    description: Indicates if open tracking is enabled.
                required:
                - enabled
              examples:
                response:
                  value:
                    enabled: true
    patch:
      operationId: UpdateOpenTrackingSetting
      summary: Update Open Tracking Settings
      tags:
      - Tracking
      description: "**This endpoint allows you to update your current settings for\
        \ open tracking.**\n\nOpen Tracking adds an invisible image at the end of\
        \ the email which can track email opens.\n\nIf the email recipient has images\
        \ enabled on their email client, a request to SendGrid\u2019s server for the\
        \ invisible image is executed and an open event is logged.\n\nThese events\
        \ are logged in the Statistics portal, Email Activity interface, and are reported\
        \ by the Event Webhook."
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                enabled:
                  type: boolean
                  description: The new status that you want to set for open tracking.
              example:
                enabled: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  enabled:
                    type: boolean
                    description: Indicates if open tracking is enabled.
                required:
                - enabled
              examples:
                response:
                  value:
                    enabled: true
  /v3/tracking_settings/subscription:
    get:
      operationId: ListSubscriptionTrackingSetting
      summary: Retrieve Subscription Tracking Settings
      tags:
      - Tracking
      description: '**This endpoint allows you to retrieve your current settings for
        subscription tracking.**


        Subscription tracking adds links to the bottom of your emails that allows
        your recipients to subscribe to, or unsubscribe from, your emails.'
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionTrackingSettings'
              examples:
                response:
                  value:
                    enabled: true
                    html_content: '<p>Something something unsubscribe <% %> something
                      something</p>

                      '
                    landing: '<p>subscribehere</p>

                      '
                    plain_content: Something something unsubscribe <% %> something
                      something
                    replace: thetag
                    url: http://mydomain.com/parse
    patch:
      operationId: UpdateSubscriptionTrackingSetting
      summary: Update Subscription Tracking Settings
      tags:
      - Tracking
      description: '**This endpoint allows you to update your current settings for
        subscription tracking.**


        Subscription tracking adds links to the bottom of your emails that allows
        your recipients to subscribe to, or unsubscribe from, your emails.'
      parameters:
      - $ref: '#/components/parameters/OnBehalfOf'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionTrackingSettings'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionTrackingSettings'
              examples:
                response:
                  value:
                    enabled: true
                    landing: landing page html
                    url: http://mydomain.com/parse
                    replace: replacement tag
                    html_content: html content
                    plain_content: text content
components:
  schemas:
    ClickTracking:
      title: 'Settings: Click Tracking'
      type: object
      properties:
        enable_text:
          type: boolean
          description: Indicates if click tracking is enabled for plain text emails.
        enabled:
          type: boolean
          description: Indicates if click tracking is enabled or disabled.
      required:
      - enable_text
      - enabled
      example:
        enable_text: false
        enabled: false
    GoogleAnalyticsSettings:
      title: 'Settings: Google Analytics'
      type: object
      properties:
        enabled:
          type: boolean
          description: Indicates if Google Analytics is enabled.
        utm_campaign:
          type: string
          description: The name of the campaign.
        utm_content:
          type: string
          description: Used to differentiate ads
        utm_medium:
          type: string
          description: Name of the marketing medium (e.g. "Email").
        utm_source:
          type: string
          description: 'Name of the referrer source. '
        utm_term:
          type: string
          description: Any paid keywords.
      example:
        enabled: true
        utm_source: sendgrid.com
        utm_medium: email
        utm_term: ''
        utm_content: ''
        utm_campaign: website
    SubscriptionTrackingSettings:
      title: 'Settings: Subscription Tracking'
      type: object
      properties:
        enabled:
          type: boolean
          description: Indicates if subscription tracking is enabled.
        html_content:
          type: string
          description: 'The information and HTML for your unsubscribe link. '
        landing:
          type: string
          description: "The HTML that will be displayed on the page that your customers\
            \ will see after clicking unsubscribe, hosted on SendGrid\u2019s server."
        plain_content:
          type: string
          description: "The information in plain text for your unsubscribe link. You\
            \ should have the \u201C<% %>\u201D tag in your content, otherwise the\
            \ user will have no URL for unsubscribing."
        replace:
          type: string
          description: Your custom defined replacement tag for your templates. Use
            this tag to place your unsubscribe content anywhere in your emailtemplate.
        url:
          type: string
          description: The URL where you would like your users sent to unsubscribe.
          format: uri
  responses: {}
  parameters:
    OnBehalfOf:
      name: on-behalf-of
      in: header
      description: 'The `on-behalf-of` header allows you to make API calls from a
        parent account on behalf of the parent''s Subusers or customer accounts. You
        will use the parent account''s API key when using this header. When making
        a call on behalf of a customer account, the property value should be "account-id"
        followed by the customer account''s ID (e.g., `on-behalf-of: account-id <account-id>`).
        When making a call on behalf of a Subuser, the property value should be the
        Subuser''s username (e.g., `on-behalf-of: <subuser-username>`). See [**On
        Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of)
        for more information.'
      required: false
      schema:
        type: string
  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: Tracking
  description: Twilio SendGrid Tracking Settings API
externalDocs:
  description: Twilio SendGrid's official developer documentation.
  url: https://www.twilio.com/docs/sendgrid