openapi: 3.1.0 info: title: Twilio SendGrid Provisioning Account Categories API summary: The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. description: 'The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/).' 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: account_provisioning servers: - url: https://api.sendgrid.com description: for global users and subusers - url: https://api.eu.sendgrid.com description: for EU regional subusers security: - BearerAuth: [] tags: - name: Categories description: Twilio SendGrid Category Stats API paths: /v3/categories: get: operationId: ListCategory summary: Retrieve all categories tags: - Categories description: '**This endpoint allows you to retrieve a paginated list of all of your categories.** You can use the `limit` query parameter to set the page size. If your list contains more items than the page size permits, you can make multiple requests. Use the `offset` query parameter to control the position in the list from which to start retrieving additional items.' parameters: - name: limit in: query description: '`limit` sets the page size, i.e. maximum number of items from the list to be returned for a single API request. If omitted, the default page size is used.' schema: type: integer minimum: 1 default: 50 - name: category in: query description: Allows you to perform a prefix search on this particular category. schema: type: string - $ref: '#/components/parameters/PaginationCommonOffset' - $ref: '#/components/parameters/OnBehalfOf' responses: '200': description: '' content: application/json: schema: type: array items: type: object properties: category: type: string description: A category used to group emails by broad topic. required: - category examples: response: value: - category: category 1 - category: category 2 '400': description: '' content: application/json: schema: type: object properties: errors: type: array description: The error returned. items: type: object properties: field: type: string message: type: string description: A message explaining why your categories could not be retrieved. required: - field - message examples: response: value: errors: - field: sort_by message: invalid sort value /v3/categories/stats: get: operationId: ListCategoryStat summary: Retrieve Email Statistics for Categories tags: - Categories description: '**This endpoint allows you to retrieve all of your email statistics for each of your categories.** If you do not define any query parameters, this endpoint will return a sum for each category in groups of 10.' parameters: - name: start_date in: query description: The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD required: true schema: type: string - name: end_date in: query description: The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD. required: false schema: type: string - name: categories in: query description: The individual categories that you want to retrieve statistics for. You may include up to 10 different categories. required: true schema: type: string - name: aggregated_by in: query description: How to group the statistics. Must be either "day", "week", or "month". required: false schema: type: string $ref: '#/components/schemas/AggregatedBy' - $ref: '#/components/parameters/OnBehalfOf' responses: '200': description: '' content: application/json: schema: type: array items: $ref: '#/components/schemas/CategoryStats' examples: response: value: - date: '2015-10-01' stats: - type: category name: docs metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 0 deferred: 0 delivered: 0 invalid_emails: 0 opens: 0 processed: 0 requests: 0 spam_report_drops: 0 spam_reports: 0 unique_clicks: 0 unique_opens: 0 unsubscribe_drops: 0 unsubscribes: 0 - type: category name: mattscategory metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 0 deferred: 0 delivered: 0 invalid_emails: 0 opens: 0 processed: 0 requests: 0 spam_report_drops: 0 spam_reports: 0 unique_clicks: 0 unique_opens: 0 unsubscribe_drops: 0 unsubscribes: 0 - date: '2015-11-01' stats: - type: category name: docs metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 0 deferred: 0 delivered: 0 invalid_emails: 0 opens: 0 processed: 0 requests: 0 spam_report_drops: 0 spam_reports: 0 unique_clicks: 0 unique_opens: 0 unsubscribe_drops: 0 unsubscribes: 0 - type: category name: mattscategory metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 0 deferred: 0 delivered: 0 invalid_emails: 0 opens: 0 processed: 0 requests: 0 spam_report_drops: 0 spam_reports: 0 unique_clicks: 0 unique_opens: 0 unsubscribe_drops: 0 unsubscribes: 0 /v3/categories/stats/sums: get: operationId: ListCategoryStatSum summary: Retrieve sums of email stats for each category. tags: - Categories description: '**This endpoint allows you to retrieve the total sum of each email statistic for every category over the given date range.** If you do not define any query parameters, this endpoint will return a sum for each category in groups of 10.' parameters: - name: sort_by_metric in: query description: The metric that you want to sort by. Must be a single metric. required: false schema: type: string default: delivered - name: sort_by_direction in: query description: The direction you want to sort. required: false schema: type: string default: desc $ref: '#/components/schemas/SortByDirection' - name: start_date in: query description: The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD. required: true schema: type: string - name: end_date in: query description: The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD. required: false schema: type: string - name: limit in: query description: Limits the number of results returned. required: false schema: type: integer default: 5 - name: offset in: query description: The point in the list to begin retrieving results. required: false schema: type: integer default: 0 - name: aggregated_by in: query description: How to group the statistics. Must be either "day", "week", or "month". required: false schema: type: string $ref: '#/components/schemas/AggregatedBy1' - $ref: '#/components/parameters/OnBehalfOf' responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/CategoryStats' examples: response: value: date: '2015-01-01' stats: - metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 20 deferred: 0 delivered: 20 invalid_emails: 0 opens: 20 processed: 0 requests: 20 spam_report_drops: 0 spam_reports: 0 unique_clicks: 20 unique_opens: 20 unsubscribe_drops: 0 unsubscribes: 20 name: cat1 type: category - metrics: blocks: 1 bounce_drops: 0 bounces: 0 clicks: 19 deferred: 0 delivered: 19 invalid_emails: 0 opens: 19 processed: 0 requests: 20 spam_report_drops: 0 spam_reports: 0 unique_clicks: 19 unique_opens: 19 unsubscribe_drops: 0 unsubscribes: 19 name: cat2 type: category - metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 5 deferred: 0 delivered: 5 invalid_emails: 0 opens: 5 processed: 0 requests: 5 spam_report_drops: 0 spam_reports: 0 unique_clicks: 5 unique_opens: 5 unsubscribe_drops: 0 unsubscribes: 5 name: cat3 type: category - metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 6 deferred: 0 delivered: 5 invalid_emails: 0 opens: 6 processed: 0 requests: 5 spam_report_drops: 0 spam_reports: 0 unique_clicks: 5 unique_opens: 5 unsubscribe_drops: 0 unsubscribes: 6 name: cat4 type: category - metrics: blocks: 10 bounce_drops: 0 bounces: 0 clicks: 0 deferred: 0 delivered: 0 invalid_emails: 0 opens: 0 processed: 0 requests: 10 spam_report_drops: 0 spam_reports: 0 unique_clicks: 0 unique_opens: 0 unsubscribe_drops: 0 unsubscribes: 0 name: cat5 type: category components: schemas: AggregatedBy1: type: string enum: - day - week - month AggregatedBy: type: string enum: - day - week - month SortByDirection: type: string enum: - desc - asc CategoryStats: title: 'Stats: Category Stats' type: object properties: date: type: string description: The date the statistics were gathered. stats: type: array items: type: object properties: metrics: type: object properties: blocks: type: integer description: The number of emails that were not allowed to be delivered by ISPs. bounce_drops: type: integer description: The number of emails that were dropped because of a bounce. bounces: type: integer description: The number of emails that bounced instead of being delivered. clicks: type: integer description: The number of links that were clicked. deferred: type: integer description: The number of emails that temporarily could not be delivered. delivered: type: integer description: The number of emails SendGrid was able to confirm were actually delivered to a recipient. invalid_emails: type: integer description: The number of recipients who had malformed email addresses or whose mail provider reported the address as invalid. opens: type: integer description: The total number of times your emails were opened by recipients. processed: type: integer description: Requests from your website, application, or mail client via SMTP Relay or the API that SendGrid processed. requests: type: integer description: The number of emails that were requested to be delivered. spam_report_drops: type: integer description: The number of emails that were dropped due to a recipient previously marking your emails as spam. spam_reports: type: integer description: The number of recipients who marked your email as spam. unique_clicks: type: integer description: The number of unique recipients who clicked links in your emails. unique_opens: type: integer description: The number of unique recipients who opened your emails. unsubscribe_drops: type: integer description: The number of emails dropped due to a recipient unsubscribing from your emails. unsubscribes: type: integer description: The number of recipients who unsubscribed from your emails. required: - blocks - bounce_drops - bounces - clicks - deferred - delivered - invalid_emails - opens - processed - requests - spam_report_drops - spam_reports - unique_clicks - unique_opens - unsubscribe_drops - unsubscribes name: type: string description: The name of the category. type: type: string description: How you are segmenting your statistics. required: - type required: - date example: date: '2015-01-01' stats: - metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 0 deferred: 0 delivered: 0 invalid_emails: 0 opens: 0 processed: 0 requests: 0 spam_report_drops: 0 spam_reports: 0 unique_clicks: 0 unique_opens: 0 unsubscribe_drops: 0 unsubscribes: 0 name: cat1 type: category - metrics: blocks: 0 bounce_drops: 0 bounces: 0 clicks: 0 deferred: 0 delivered: 0 invalid_emails: 0 opens: 0 processed: 0 requests: 0 spam_report_drops: 0 spam_reports: 0 unique_clicks: 0 unique_opens: 0 unsubscribe_drops: 0 unsubscribes: 0 name: cat2 type: category parameters: PaginationCommonOffset: name: offset in: query required: false description: The number of items in the list to skip over before starting to retrieve the items for the requested page. The default `offset` of `0` represents the beginning of the list, i.e. the start of the first page. To request the second page of the list, set the `offset` to the page size as determined by `limit`. Use multiples of the page size as your `offset` to request further consecutive pages. E.g. assume your page size is set to `10`. An `offset` of `10` requests the second page, an `offset` of `20` requests the third page and so on, provided there are sufficiently many items in your list. schema: type: integer minimum: 0 default: 0 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 `). When making a call on behalf of a Subuser, the property value should be the Subuser''s username (e.g., `on-behalf-of: `). 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 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. externalDocs: description: Twilio SendGrid's official developer documentation. url: https://www.twilio.com/docs/sendgrid