{ "swagger": "2.0", "info": { "version": "", "title": "Email Activity (beta)", "description": "The Beta endpoints for the new Email Activity APIs - functionality is subject to change without notice. You may not have access to this Beta endpoint.\n\nEmail Activity offers filtering and search by event type for two days worth of data. There is an optional add-on to store 60 days worth of data. This add-on also gives you access to the ability to download a CSV of the 60 days worth of email event data. The Beta endpoints for the new Email Activity APIs - functionality is subject to change without notice. You may not have access to this Beta endpoint.\n\nEmail Activity offers filtering and search by event type for two days worth of data. There is an optional add-on to store 60 days worth of data. This add-on also gives you access to the ability to download a CSV of the 60 days worth of email event data." }, "host": "api.sendgrid.com", "basePath": "/v3", "schemes": [ "http" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "securityDefinitions": { "Authorization": { "name": "Authorization", "type": "apiKey", "in": "header" } }, "paths": { "/mail/send": { "post": { "operationId": "POST_mail-send", "summary": "v3 Mail Send", "tags": [ "Mail Send" ], "description": "The Mail Send endpoint allows you to send email over SendGrid’s v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).\n\n## Helper Libraries\n\nTwilio SendGrid provides libraries to help you quickly and easily integrate with the v3 Web API in 7 different languages:\n\n* [C#](https://github.com/sendgrid/sendgrid-csharp) \n* [Go](https://github.com/sendgrid/sendgrid-go)\n* [Java](https://github.com/sendgrid/sendgrid-java)\n* [Node JS](https://github.com/sendgrid/sendgrid-nodejs)\n* [PHP](https://github.com/sendgrid/sendgrid-php)\n* [Python](https://github.com/sendgrid/sendgrid-python)\n* [Ruby](https://github.com/sendgrid/sendgrid-ruby)\n\n## Dynamic Transactional Templates and Handlebars\n\nIn order to send a dynamic template, specify the template ID with the `template_id` parameter. \n\nTo specify handlebar substitutions, define your substitutions in the request JSON with this syntax:\n\n```\n\"dynamic_template_data\": {\n      \"guest\": \"Jane Doe\",\n      \"partysize\": \"4\",\n      \"english\": true,\n      \"date\": \"April 1st, 2021\"\n    }\n```\n\nFor more information about Dynamic Transactional Templates and Handlebars, see our documentation and reference pages.\n\n* [How to send an email with Dynamic Transactional Templates\n](https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/)\n* [Using Handlebars](https://sendgrid.com/docs/for-developers/sending-email/using-handlebars/) \n\n## Mail Body Compression\n\nMail body compression is available to some high volume accounts. Talk to your CSM if you are interested in this functionality. Mail body compression works by setting up a JSON payload as defined on this page, then compressing it with gzip (the gzip file can be no more than 30mb).\n\nTo use mail body compression:\n\n1. Add a `Content-Encoding` header, with a value of `gzip`. \n a. `Content-Encoding: gzip` \n2. Send the gzip as a data-binary. \n a. `--data-binary '@data.json.gz'\n`\n\n## Multiple Reply-To Emails\n\nUsing `reply_to_list` allows senders to include more than one recipient email address to receive reply and/or bounce messages from the recipient of the email.\n\n### Usage Considerations\n\n* `reply_to` is mutually exclusive with `reply_to_list`. If both are used, then the API call will be rejected. \n* The `reply_to_list` object, when used, must at least have an email parameter and may also contain a name parameter.\n* Each email address in the `reply_to_list` should be unique.\n* There is a limit of 1000 `reply_to_list` emails per mail/send request.\n* In SMTP calls, we will omit any invalid emails.\n\n### Possible 400 Error Messages\n\n* `reply_to` is mutually exclusive with `reply_to_list`.\n* The `reply_to_list` object, when used, must at least have an email parameter and may also contain a name parameter.\n* Each email address in the `reply_to_list` should be unique.\n* There is a limit of X `reply_to` emails per mail/send request.\n* The `reply_to_list` email does not contain a valid address.\n* The `reply_to_list` email exceeds the maximum total length of X characters.\n* The `reply_to_list` email parameter is required.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "personalizations": { "type": "array", "description": "An array of messages and their metadata. Each object within personalizations can be thought of as an envelope - it defines who should receive an individual message and how that message should be handled. See our [Personalizations documentation](https://sendgrid.com/docs/for-developers/sending-email/personalizations/) for examples.", "uniqueItems": false, "maxItems": 1000, "items": { "type": "object", "properties": { "from": { "$ref": "#/definitions/from_email_object" }, "to": { "$ref": "#/definitions/to_email_array" }, "cc": { "type": "array", "description": "An array of recipients who will receive a copy of your email. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name.", "maxItems": 1000, "items": { "$ref": "#/definitions/cc_bcc_email_object" } }, "bcc": { "type": "array", "description": "An array of recipients who will receive a blind carbon copy of your email. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name.", "maxItems": 1000, "items": { "$ref": "#/definitions/cc_bcc_email_object" } }, "subject": { "type": "string", "description": "The subject of your email. See character length requirements according to [RFC 2822](http://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit#answer-1592310).", "minLength": 1 }, "headers": { "type": "object", "description": "A collection of JSON key/value pairs allowing you to specify handling instructions for your email. You may not overwrite the following headers: `x-sg-id`, `x-sg-eid`, `received`, `dkim-signature`, `Content-Type`, `Content-Transfer-Encoding`, `To`, `From`, `Subject`, `Reply-To`, `CC`, `BCC`" }, "substitutions": { "type": "object", "description": "Substitutions allow you to insert data without using Dynamic Transactional Templates. This field should **not** be used in combination with a Dynamic Transactional Template, which can be identified by a `template_id` starting with `d-`. This field is a collection of key/value pairs following the pattern \"substitution_tag\":\"value to substitute\". The key/value pairs must be strings. These substitutions will apply to the text and html content of the body of your email, in addition to the `subject` and `reply-to` parameters. The total collective size of your substitutions may not exceed 10,000 bytes per personalization object.", "maxProperties": 10000 }, "dynamic_template_data": { "type": "object", "description": "Dynamic template data is available using Handlebars syntax in Dynamic Transactional Templates. This field should be used in combination with a Dynamic Transactional Template, which can be identified by a `template_id` starting with `d-`. This field is a collection of key/value pairs following the pattern \"variable_name\":\"value to insert\"." }, "custom_args": { "type": "object", "description": "Values that are specific to this personalization that will be carried along with the email and its activity data. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. This field may not exceed 10,000 bytes.", "maxProperties": 10000 }, "send_at": { "type": "integer", "description": "A unix timestamp allowing you to specify when your email should be delivered. Scheduling delivery more than 72 hours in advance is forbidden." } }, "required": [ "to" ] } }, "from": { "$ref": "#/definitions/from_email_object" }, "reply_to": { "$ref": "#/definitions/reply_to_email_object" }, "reply_to_list": { "type": "array", "description": "An array of recipients who will receive replies and/or bounces. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name. You can either choose to use “reply_to” field or “reply_to_list” but not both.", "uniqueItems": true, "maxItems": 1000, "items": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address where any replies or bounces will be returned.", "format": "email" }, "name": { "type": "string", "description": "A name or title associated with the `reply_to_list` email address." } }, "required": [ "email" ] } }, "subject": { "type": "string", "description": "The global or 'message level' subject of your email. This may be overridden by subject lines set in personalizations.", "minLength": 1 }, "content": { "type": "array", "description": "An array where you can specify the content of your email. You can include multiple [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of content, but you must specify at least one MIME type. To include more than one MIME type, add another object to the array containing the `type` and `value` parameters.", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "The MIME type of the content you are including in your email (e.g., `“text/plain”` or `“text/html”`).", "minLength": 1 }, "value": { "type": "string", "description": "The actual content of the specified MIME type that you are including in your email.", "minLength": 1 } }, "required": [ "type", "value" ] } }, "attachments": { "type": "array", "description": "An array of objects where you can specify any attachments you want to include.", "items": { "type": "object", "properties": { "content": { "type": "string", "description": "The Base64 encoded content of the attachment.", "minLength": 1 }, "type": { "type": "string", "description": "The MIME type of the content you are attaching (e.g., `“text/plain”` or `“text/html”`).", "minLength": 1 }, "filename": { "type": "string", "description": "The attachment's filename." }, "disposition": { "type": "string", "default": "attachment", "description": "The attachment's content-disposition, specifying how you would like the attachment to be displayed. For example, `“inline”` results in the attached file are displayed automatically within the message while `“attachment”` results in the attached file require some action to be taken before it is displayed, such as opening or downloading the file.", "enum": [ "inline", "attachment" ] }, "content_id": { "type": "string", "description": "The attachment's content ID. This is used when the disposition is set to `“inline”` and the attachment is an image, allowing the file to be displayed within the body of your email." } }, "required": [ "content", "filename" ] } }, "template_id": { "type": "string", "description": "An email template ID. A template that contains a subject and content — either text or html — will override any subject and content values specified at the personalizations or message level." }, "headers": { "description": "An object containing key/value pairs of header names and the value to substitute for them. The key/value pairs must be strings. You must ensure these are properly encoded if they contain unicode characters. These headers cannot be one of the reserved headers.", "type": "object" }, "categories": { "type": "array", "description": "An array of category names for this message. Each category name may not exceed 255 characters. ", "uniqueItems": true, "maxItems": 10, "items": { "type": "string", "maxLength": 255 } }, "custom_args": { "description": "Values that are specific to the entire send that will be carried along with the email and its activity data. Key/value pairs must be strings. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. This parameter is overridden by `custom_args` set at the personalizations level. Total `custom_args` size may not exceed 10,000 bytes.", "type": "string" }, "send_at": { "type": "integer", "description": "A unix timestamp allowing you to specify when you want your email to be delivered. This may be overridden by the `send_at` parameter set at the personalizations level. Delivery cannot be scheduled more than 72 hours in advance. If you have the flexibility, it's better to schedule mail for off-peak times. Most emails are scheduled and sent at the top of the hour or half hour. Scheduling email to avoid peak times — for example, scheduling at 10:53 — can result in lower deferral rates due to the reduced traffic during off-peak times." }, "batch_id": { "type": "string", "description": "An ID representing a batch of emails to be sent at the same time. Including a `batch_id` in your request allows you include this email in that batch. It also enables you to cancel or pause the delivery of that batch. For more information, see the [Cancel Scheduled Sends API](https://sendgrid.com/docs/api-reference/)." }, "asm": { "type": "object", "description": "An object allowing you to specify how to handle unsubscribes.", "properties": { "group_id": { "type": "integer", "description": "The unsubscribe group to associate with this email." }, "groups_to_display": { "type": "array", "description": "An array containing the unsubscribe groups that you would like to be displayed on the unsubscribe preferences page.", "maxItems": 25, "items": { "type": "integer" } } }, "required": [ "group_id" ] }, "ip_pool_name": { "type": "string", "description": "The IP Pool that you would like to send this email from.", "minLength": 2, "maxLength": 64 }, "mail_settings": { "type": "object", "description": "A collection of different mail settings that you can use to specify how you would like this email to be handled.", "properties": { "bypass_list_management": { "type": "object", "description": "Allows you to bypass all unsubscribe groups and suppressions to ensure that the email is delivered to every single recipient. This should only be used in emergencies when it is absolutely necessary that every recipient receives your email. This filter cannot be combined with any other bypass filters. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." } } }, "bypass_spam_management": { "type": "object", "description": "Allows you to bypass the spam report list to ensure that the email is delivered to recipients. Bounce and unsubscribe lists will still be checked; addresses on these other lists will not receive the message. This filter cannot be combined with the `bypass_list_management` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." } } }, "bypass_bounce_management": { "type": "object", "description": "Allows you to bypass the bounce list to ensure that the email is delivered to recipients. Spam report and unsubscribe lists will still be checked; addresses on these other lists will not receive the message. This filter cannot be combined with the `bypass_list_management` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." } } }, "bypass_unsubscribe_management": { "type": "object", "description": "Allows you to bypass the global unsubscribe list to ensure that the email is delivered to recipients. Bounce and spam report lists will still be checked; addresses on these other lists will not receive the message. This filter applies only to global unsubscribes and will not bypass group unsubscribes. This filter cannot be combined with the `bypass_list_management` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." } } }, "footer": { "type": "object", "description": "The default footer that you would like included on every email.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." }, "text": { "type": "string", "description": "The plain text content of your footer." }, "html": { "type": "string", "description": "The HTML content of your footer." } } }, "sandbox_mode": { "type": "object", "description": "Sandbox Mode allows you to send a test email to ensure that your request body is valid and formatted correctly.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." } } } } }, "tracking_settings": { "type": "object", "description": "Settings to determine how you would like to track the metrics of how your recipients interact with your email.", "properties": { "click_tracking": { "type": "object", "description": "Allows you to track if a recipient clicked a link in your email.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." }, "enable_text": { "type": "boolean", "description": "Indicates if this setting should be included in the `text/plain` portion of your email." } } }, "open_tracking": { "type": "object", "description": "Allows you to track if the email was opened by including a single pixel image in the body of the content. When the pixel is loaded, Twilio SendGrid can log that the email was opened.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." }, "substitution_tag": { "type": "string", "description": "Allows you to specify a substitution tag that you can insert in the body of your email at a location that you desire. This tag will be replaced by the open tracking pixel." } } }, "subscription_tracking": { "type": "object", "description": "Allows you to insert a subscription management link at the bottom of the text and HTML bodies of your email. If you would like to specify the location of the link within your email, you may use the `substitution_tag`.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." }, "text": { "type": "string", "description": "Text to be appended to the email with the subscription tracking link. You may control where the link is by using the tag <% %>" }, "html": { "type": "string", "description": "HTML to be appended to the email with the subscription tracking link. You may control where the link is by using the tag <% %>" }, "substitution_tag": { "type": "string", "description": "A tag that will be replaced with the unsubscribe URL. for example: `[unsubscribe_url]`. If this parameter is used, it will override both the `text` and `html` parameters. The URL of the link will be placed at the substitution tag’s location with no additional formatting." } } }, "ganalytics": { "type": "object", "description": "Allows you to enable tracking provided by Google Analytics.", "properties": { "enable": { "type": "boolean", "description": "Indicates if this setting is enabled." }, "utm_source": { "type": "string", "description": "Name of the referrer source. (e.g. Google, SomeDomain.com, or Marketing Email)" }, "utm_medium": { "type": "string", "description": "Name of the marketing medium. (e.g. Email)" }, "utm_term": { "type": "string", "description": "Used to identify any paid keywords." }, "utm_content": { "type": "string", "description": "Used to differentiate your campaign from advertisements." }, "utm_campaign": { "type": "string", "description": "The name of the campaign." } } } } } }, "required": [ "personalizations", "from", "subject", "content" ], "example": { "personalizations": [ { "to": [ { "email": "john_doe@example.com", "name": "John Doe" }, { "email": "julia_doe@example.com", "name": "Julia Doe" } ], "cc": [ { "email": "jane_doe@example.com", "name": "Jane Doe" } ], "bcc": [ { "email": "james_doe@example.com", "name": "Jim Doe" } ] }, { "from": { "email": "sales@example.com", "name": "Example Sales Team" }, "to": [ { "email": "janice_doe@example.com", "name": "Janice Doe" } ], "bcc": [ { "email": "jordan_doe@example.com", "name": "Jordan Doe" } ] } ], "from": { "email": "orders@example.com", "name": "Example Order Confirmation" }, "reply_to": { "email": "customer_service@example.com", "name": "Example Customer Service Team" }, "subject": "Your Example Order Confirmation", "content": [ { "type": "text/html", "value": "

Hello from Twilio SendGrid!

Sending with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.

%open-track%

" } ], "attachments": [ { "content": "PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KCiAgICA8aGVhZD4KICAgICAgICA8bWV0YSBjaGFyc2V0PSJVVEYtOCI+CiAgICAgICAgPG1ldGEgaHR0cC1lcXVpdj0iWC1VQS1Db21wYXRpYmxlIiBjb250ZW50PSJJRT1lZGdlIj4KICAgICAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLCBpbml0aWFsLXNjYWxlPTEuMCI+CiAgICAgICAgPHRpdGxlPkRvY3VtZW50PC90aXRsZT4KICAgIDwvaGVhZD4KCiAgICA8Ym9keT4KCiAgICA8L2JvZHk+Cgo8L2h0bWw+Cg==", "filename": "index.html", "type": "text/html", "disposition": "attachment" } ], "categories": [ "cake", "pie", "baking" ], "send_at": 1617260400, "batch_id": "AsdFgHjklQweRTYuIopzXcVBNm0aSDfGHjklmZcVbNMqWert1znmOP2asDFjkl", "asm": { "group_id": 12345, "groups_to_display": [ 12345 ] }, "ip_pool_name": "transactional email", "mail_settings": { "bypass_list_management": { "enable": false }, "footer": { "enable": false }, "sandbox_mode": { "enable": false } }, "tracking_settings": { "click_tracking": { "enable": true, "enable_text": false }, "open_tracking": { "enable": true, "substitution_tag": "%open-track%" }, "subscription_tracking": { "enable": false } } } } } ], "responses": { "202": { "description": "" }, "400": { "$ref": "#/responses/trait:mailSendErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "413": { "$ref": "#/responses/trait:mailSendErrors:413" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/mail/batch": { "post": { "operationId": "POST_mail-batch", "summary": "Create a batch ID", "tags": [ "Cancel Scheduled Sends" ], "description": "**This endpoint allows you to generate a new batch ID.**\n\nOnce a `batch_id` is created, you can associate it with a scheduled send using the `/mail/send` endpoint. Passing the `batch_id` as a field in the `/mail/send` request body will assign the ID to the send you are creating.\n\nOnce an ID is associated with a scheduled send, the send can be accessed and its send status can be modified using the `batch_id`.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/mail_batch_id" }, "examples": { "application/json": { "batch_id": "HkJ5yLYULb7Rj8GKSx7u025ouWVlMgAi" } } }, "400": { "$ref": "#/responses/trait:cancelScheduledSendsErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/user/scheduled_sends": { "post": { "operationId": "POST_user-scheduled_sends", "summary": "Cancel or pause a scheduled send", "tags": [ "Cancel Scheduled Sends" ], "description": "**This endpoint allows you to cancel or pause a scheduled send associated with a `batch_id`.**\n\nPassing this endpoint a `batch_id` and status will cancel or pause the scheduled send.\n\nOnce a scheduled send is set to `pause` or `cancel` you must use the \"Update a scheduled send\" endpoint to change its status or the \"Delete a cancellation or pause from a scheduled send\" endpoint to remove the status. Passing a status change to a scheduled send that has already been paused or cancelled will result in a `400` level status code.\n\nIf the maximum number of cancellations/pauses are added to a send, a `400` level status code will be returned.", "parameters": [ { "name": "body", "in": "body", "schema": { "title": "Cancel or pause a scheduled send request", "type": "object", "properties": { "batch_id": { "type": "string", "description": "The batch ID is the identifier that your scheduled mail sends share.", "pattern": "^[a-zA-Z0-9]" }, "status": { "type": "string", "default": "pause", "description": "The status of the send you would like to implement. This can be pause or cancel. To delete a pause or cancel status see DELETE /v3/user/scheduled_sends/{batch_id}", "enum": [ "pause", "cancel" ] } }, "required": [ "batch_id", "status" ], "example": { "batch_id": "YOUR_BATCH_ID", "status": "pause" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/user_scheduled_send_status" } }, "400": { "$ref": "#/responses/trait:cancelScheduledSendsErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_user-scheduled_sends", "summary": "Retrieve all scheduled sends", "tags": [ "Cancel Scheduled Sends" ], "description": "**This endpoint allows you to retrieve all cancelled and paused scheduled send information.**\n\nThis endpoint will return only the scheduled sends that are associated with a `batch_id`. If you have scheduled a send using the `/mail/send` endpoint and the `send_at` field but no `batch_id`, the send will be scheduled for delivery; however, it will not be returned by this endpoint. For this reason, you should assign a `batch_id` to any scheduled send you may need to pause or cancel in the future.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/user_scheduled_send_status" } }, "examples": { "application/json": [ { "batch_id": "QzZmYzLTVWIwYgYzJlM2NhNWI", "status": "cancel" }, { "batch_id": "mQzZmYzLTVlM2NhNWIwYgYzJl", "status": "cancel" } ] } }, "400": { "$ref": "#/responses/trait:cancelScheduledSendsErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/mail/batch/{batch_id}": { "parameters": [ { "name": "batch_id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_mail-batch-batch_id", "summary": "Validate batch ID", "tags": [ "Cancel Scheduled Sends" ], "description": "**This endpoint allows you to validate a batch ID.**\n\nWhen you pass a valid `batch_id` to this endpoint, it will return a `200` status code and the batch ID itself.\n\nIf you pass an invalid `batch_id` to the endpoint, you will receive a `400` level status code and an error message.\n\nA `batch_id` does not need to be assigned to a scheduled send to be considered valid. A successful response means only that the `batch_id` has been created, but it does not indicate that it has been associated with a send.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_batch_id" }, "examples": { "application/json": { "batch_id": "HkJ5yLYULb7Rj8GKSx7u025ouWVlMgAi" } } }, "400": { "$ref": "#/responses/trait:cancelScheduledSendsErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/user/scheduled_sends/{batch_id}": { "parameters": [ { "name": "batch_id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_user-scheduled_sends-batch_id", "summary": "Retrieve scheduled send", "tags": [ "Cancel Scheduled Sends" ], "description": "**This endpoint allows you to retrieve the cancel/paused scheduled send information for a specific `batch_id`.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "title": "Retrieve scheduled send response", "items": { "$ref": "#/definitions/user_scheduled_send_status" } }, "examples": { "application/json": [ { "batch_id": "HkJ5yLYULb7Rj8GKSx7u025ouWVlMgAi", "status": "cancel" }, { "batch_id": "IbLdyLYULb7Rj8GKSx7u025ouWVlAiMg", "status": "pause" } ] } }, "400": { "$ref": "#/responses/trait:cancelScheduledSendsErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_user-scheduled_sends-batch_id", "summary": "Update a scheduled send", "tags": [ "Cancel Scheduled Sends" ], "description": "**This endpoint allows you to update the status of a scheduled send for the given `batch_id`.**\n\nIf you have already set a `cancel` or `pause` status on a scheduled send using the \"Cancel or pause a scheduled send\" endpoint, you can update it's status using this endpoint. Attempting to update a status once it has been set with the \"Cancel or pause a scheduled send\" endpoint will result in a `400` error.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "status": { "type": "string", "description": "The status you would like the scheduled send to have.", "enum": [ "cancel", "pause" ] } }, "required": [ "status" ], "example": { "status": "pause" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "null" } }, "400": { "$ref": "#/responses/trait:cancelScheduledSendsErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_user-scheduled_sends-batch_id", "summary": "Delete a cancellation or pause from a scheduled send", "tags": [ "Cancel Scheduled Sends" ], "description": "**This endpoint allows you to delete the cancellation/pause of a scheduled send.**\n\nScheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "" }, "400": { "$ref": "#/responses/trait:cancelScheduledSendsErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/api_keys": { "post": { "operationId": "create-api-keys", "summary": "Create API keys", "tags": [ "API Keys" ], "description": "**This endpoint allows you to create a new API Key for the user.**\n\nTo create your initial SendGrid API Key, you should [use the SendGrid App](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management.\n\n> There is a limit of 100 API Keys on your account.\n\nA JSON request body containing a `name` property is required when making requests to this endpoint. If the number of maximum keys, 100, is reached, a `403` status will be returned.\n\nThough the `name` field is required, it does not need to be unique. A unique API key ID will be generated for each key you create and returned in the response body.\n\nIt is not necessary to pass a `scopes` field to the API when creating a key, but you should be aware that omitting the `scopes` field from your request will create a key with \"Full Access\" permissions by default.\n\nSee the [API Key Permissions List](https://sendgrid.api-docs.io/v3.0/how-to-use-the-sendgrid-v3-api/api-authorization) for all available scopes. An API key's scopes can be updated after creation using the \"Update API keys\" endpoint.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "The name you will use to describe this API Key." }, "scopes": { "type": "array", "description": "The individual permissions that you are giving to this API Key.", "items": { "type": "string" } } }, "required": [ "name" ], "example": { "name": "My API Key", "scopes": [ "mail.send", "alerts.create", "alerts.read" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "api_key": { "type": "string" }, "api_key_id": { "type": "string" }, "name": { "type": "string" }, "scopes": { "type": "array", "items": { "type": "string" } } } }, "examples": { "application/json": { "api_key": "SG.xxxxxxxx.yyyyyyyy", "api_key_id": "xxxxxxxx", "name": "My API Key", "scopes": [ "mail.send", "alerts.create", "alerts.read" ] } } }, "400": { "$ref": "#/responses/trait:apiKeysErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:apiKeysErrors:403" }, "404": { "$ref": "#/responses/trait:apiKeysErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_api_keys", "summary": "Retrieve all API Keys belonging to the authenticated user", "tags": [ "API Keys" ], "description": "**This endpoint allows you to retrieve all API Keys that belong to the authenticated user.**\n\nA successful response from this API will include all available API keys' names and IDs.\n\nFor security reasons, there is not a way to retrieve the key itself after it's created. If you lose your API key, you must create a new one. Only the \"Create API keys\" endpoint will return a key to you and only at the time of creation.\n\nAn `api_key_id` can be used to update or delete the key, as well as retrieve the key's details, such as its scopes.", "parameters": [ { "name": "limit", "in": "query", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/api_key_name_id" } } } }, "examples": { "application/json": { "result": [ { "name": "API Key Name", "api_key_id": "some-apikey-id" }, { "name": "API Key Name 2", "api_key_id": "another-apikey-id" } ] } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/api_keys/{api_key_id}": { "parameters": [ { "name": "api_key_id", "in": "path", "description": "", "required": true, "type": "string" } ], "get": { "operationId": "GET_api_keys-api_key_id", "summary": "Retrieve an existing API Key", "tags": [ "API Keys" ], "description": "**This endpoint allows you to retrieve a single API key using an `api_key_id`.**\n\nThe endpoint will return a key's name, ID, and scopes. If the API Key ID does not, exist a `404` status will be returned.\n\nSee the [API Key Permissions List](https://sendgrid.api-docs.io/v3.0/how-to-use-the-sendgrid-v3-api/api-authorization) for all available scopes. An API key's scopes can be updated after creation using the \"Update API keys\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/api_key_name_id_scopes" } } } }, "examples": { "application/json": { "result": [ { "name": "API Key Name", "api_key_id": "some-apikey-id" }, { "name": "API Key Name 2", "api_key_id": "another-apikey-id" } ] } } }, "400": { "$ref": "#/responses/trait:apiKeysErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:apiKeysErrors:403" }, "404": { "$ref": "#/responses/trait:apiKeysErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_api_keys-api_key_id", "summary": "Update API key name", "tags": [ "API Keys" ], "description": "**This endpoint allows you to update the name of an existing API Key.**\n\nYou must pass this endpoint a JSON request body with a `name` property, which will be used to rename the key associated with the `api_key_id` passed in the URL.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "The new name of the API Key." } }, "required": [ "name" ], "example": { "name": "A New Hope" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/api_key_name_id" }, "examples": { "application/json": { "api_key_id": "qfTQ6KG0QBiwWdJ0-pCLCA", "name": "A New Hope" } } }, "400": { "$ref": "#/responses/trait:apiKeysErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "put": { "operationId": "PUT_api_keys-api_key_id", "summary": "Update API key name and scopes", "tags": [ "API Keys" ], "description": "**This endpoint allows you to update the name and scopes of a given API key.**\n\nYou must pass this endpoint a JSON request body with a `name` field and a `scopes` array containing at least one scope. The `name` and `scopes` fields will be used to update the key associated with the `api_key_id` in the request URL.\n\nIf you need to update a key's scopes only, pass the `name` field with the key's existing name; the `name` will not be modified. If you need to update a key's name only, use the \"Update API key name\" endpoint.\n\nSee the [API Key Permissions List](https://sendgrid.api-docs.io/v3.0/how-to-use-the-sendgrid-v3-api/api-authorization) for all available scopes.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string" }, "scopes": { "type": "array", "items": { "type": "string" } } }, "required": [ "name" ], "example": { "name": "Profiles key", "scopes": [ "user.profile.read", "user.profile.update" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/api_key_name_id_scopes" }, "examples": { "application/json": { "api_key_id": "qfTQ6KG0QBiwWdJ0-pCLCA", "name": "Profiles Key", "scopes": [ "user.profile.read", "user.profile.update" ] } } }, "400": { "$ref": "#/responses/trait:apiKeysErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_api_keys-api_key_id", "summary": "Delete API keys", "tags": [ "API Keys" ], "description": "**This endpoint allows you to revoke an existing API Key using an `api_key_id`**\n\nAuthentications using a revoked API Key will fail after after some small propogation delay. If the API Key ID does not exist, a `404` status will be returned.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "" }, "400": { "$ref": "#/responses/trait:apiKeysErrors:400" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/scopes": { "get": { "operationId": "GET_scopes", "summary": "Retrieve a list of scopes for which this user has access.", "tags": [ "API Key Permissions" ], "description": "**This endpoint returns a list of all scopes that this user has access to.**\n\nAPI Keys are used to authenticate with [SendGrid's v3 API](https://sendgrid.api-docs.io/v3.0/how-to-use-the-sendgrid-v3-api/api-authorization).\n\nAPI Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access.\n\nThis endpoint returns all the scopes assigned to the key you use to authenticate with it. To retrieve the scopes assigned to another key, you can pass an API key ID to the \"Retrieve an existing API key\" endpoint.\n\nFor a more detailed explanation of how you can use API Key permissions, please visit our [API Keys documentation](https://sendgrid.com/docs/ui/account-and-settings/api-keys/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "scopes": { "type": "array", "description": "The list of scopes for which this user has access.", "uniqueItems": true, "items": { "type": "string" } } }, "required": [ "scopes" ] }, "examples": { "application/json": { "scopes": [ "mail.send", "alerts.create", "alerts.read" ] } } }, "401": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "description": "This 401 response indicates that the user making the call doesn't have the authorization to view the list of scopes.", "items": { "type": "object", "properties": { "field": { "type": "null", "description": "This empty field is returned instead of the list of scopes if the user making the call doesn't have the authorization required." }, "message": { "type": "string", "description": "Explains why the scopes cannot be returned." } }, "required": [ "message" ] } } }, "required": [ "errors" ] }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/user/settings/enforced_tls": { "get": { "operationId": "GET_user-settings-enforced_tls", "summary": "Retrieve current Enforced TLS settings.", "tags": [ "Settings - Enforced TLS" ], "description": "**This endpoint allows you to retrieve your current Enforced TLS settings.**\n\nThe Enforced TLS settings specify whether or not the recipient is required to support TLS or have a valid certificate.\n\nIf either `require_tls` or `require_valid_cert` is set to `true`, the recipient must support TLS 1.1 or higher or have a valid certificate. If these conditions are not met, Twilio SendGrid will drop the message and send a block event with “TLS required but not supported” as the description.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/enforced-tls-request-response" }, "examples": { "application/json": { "require_tls": false, "require_valid_cert": false } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_user-settings-enforced_tls", "summary": "Update Enforced TLS settings", "tags": [ "Settings - Enforced TLS" ], "description": "**This endpoint allows you to update your Enforced TLS settings.**\n\nTo require TLS from recipients, set `require_tls` to `true`. If either `require_tls` or `require_valid_cert` is set to `true`, the recipient must support TLS 1.1 or higher or have a valid certificate. If these conditions are not met, Twilio SendGrid will drop the message and send a block event with “TLS required but not supported” as the description.\n\n> Twilio SendGrid supports TLS 1.1 and higher and does not support older versions of TLS due to security vulnerabilities.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/enforced-tls-request-response", "example": { "require_tls": true, "require_valid_cert": false } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/enforced-tls-request-response" }, "examples": { "application/json": { "require_tls": true, "require_valid_cert": false } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/access_settings/whitelist": { "post": { "operationId": "POST_access_settings-whitelist", "summary": "Add one or more IPs to the allow list", "tags": [ "IP Access Management" ], "description": "**This endpoint allows you to add one or more allowed IP addresses.**\n\nTo allow one or more IP addresses, pass them to this endpoint in an array. Once an IP address is added to your allow list, it will be assigned an `id` that can be used to remove the address. You can retrieve the ID associated with an IP using the \"Retrieve a list of currently allowed IPs\" endpoint.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "ips": { "type": "array", "description": "An array containing the IP(s) you want to allow.", "items": { "type": "object", "properties": { "ip": { "type": "string", "description": "An IP address that you want to allow." } }, "required": [ "ip" ] } } }, "required": [ "ips" ], "example": { "ips": [ { "ip": "192.168.1.1" }, { "ip": "192.*.*.*" }, { "ip": "192.168.1.3/32" } ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/ip-access-response" }, "examples": { "application/json": { "result": [ { "id": 1, "ip": "192.168.1.1/32", "created_at": 1441824715, "updated_at": 1441824715 }, { "id": 2, "ip": "192.0.0.0/8", "created_at": 1441824715, "updated_at": 1441824715 }, { "id": 3, "ip": "192.168.1.3/32", "created_at": 1441824715, "updated_at": 1441824715 } ] } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_access_settings-whitelist", "summary": "Retrieve a list of currently allowed IPs", "tags": [ "IP Access Management" ], "description": "**This endpoint allows you to retrieve a list of IP addresses that are currently allowed to access your account.**\n\nEach IP address returned to you will have `created_at` and `updated_at` dates. Each IP will also be associated with an `id` that can be used to remove the address from your allow list.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/ip-access-response" }, "examples": { "application/json": { "result": [ { "id": 1, "ip": "192.168.1.1/32", "created_at": 1441824715, "updated_at": 1441824715 }, { "id": 2, "ip": "192.168.1.2/32", "created_at": 1441824715, "updated_at": 1441824715 }, { "id": 3, "ip": "192.168.1.3/32", "created_at": 1441824715, "updated_at": 1441824715 } ] } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_access_settings-whitelist", "summary": "Remove one or more IPs from the allow list", "tags": [ "IP Access Management" ], "description": "**This endpoint allows you to remove one or more IP addresses from your list of allowed addresses.**\n\nTo remove one or more IP addresses, pass this endpoint an array containing the ID(s) associated with the IP(s) you intend to remove. You can retrieve the IDs associated with your allowed IP addresses using the \"Retrieve a list of currently allowed IPs\" endpoint.\n\nIt is possible to remove your own IP address, which will block access to your account. You will need to submit a [support ticket](https://sendgrid.com/docs/ui/account-and-settings/support/) if this happens. For this reason, it is important to double check that you are removing only the IPs you intend to remove when using this endpoint.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "ids": { "type": "array", "description": "An array of the IDs of the IP address that you want to remove from your allow list.", "items": { "type": "integer" } } }, "example": { "ids": [ 1, 2, 3 ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/access_settings/activity": { "get": { "operationId": "GET_access_settings-activity", "summary": "Retrieve all recent access attempts", "tags": [ "IP Access Management" ], "description": "**This endpoint allows you to retrieve a list of all of the IP addresses that recently attempted to access your account either through the User Interface or the API.**", "parameters": [ { "name": "limit", "in": "query", "description": "Limits the number of IPs to return.", "type": "integer", "default": 20 }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "description": "An array containing the IPs that recently attempted to access your account.", "items": { "type": "object", "properties": { "allowed": { "type": "boolean", "description": "Indicates if the IP address was granted access to the account." }, "auth_method": { "type": "string", "description": "The authentication method used when attempting access." }, "first_at": { "type": "integer", "description": "A Unix timestamp indicating when the first access attempt was made." }, "ip": { "type": "string", "description": "The IP addressed used during the access attempt." }, "last_at": { "type": "integer", "description": "A Unix timestamp indicating when the most recent access attempt was made" }, "location": { "type": "string", "description": "The geographic location from which the access attempt originated." } }, "required": [ "allowed", "auth_method", "first_at", "ip", "last_at", "location" ] } } }, "required": [ "result" ] }, "examples": { "application/json": { "result": [ { "allowed": false, "auth_method": "Web", "first_at": 1444087966, "ip": "1.1.1.1", "last_at": 1444406672, "location": "Australia" }, { "allowed": false, "auth_method": "Web", "first_at": 1444087505, "ip": "1.2.3.48", "last_at": 1444087505, "location": "Mukilteo, Washington" } ] } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/access_settings/whitelist/{rule_id}": { "parameters": [ { "name": "rule_id", "in": "path", "description": "The ID of the allowed IP address that you want to retrieve.", "required": true, "type": "string" } ], "get": { "operationId": "GET_access_settings-whitelist-rule_id", "summary": "Retrieve a specific allowed IP", "tags": [ "IP Access Management" ], "description": "**This endpoint allows you to retreive a specific IP address that has been allowed to access your account.**\n\nYou must include the ID for the specific IP address you want to retrieve in your call. You can retrieve the IDs associated with your allowed IP addresses using the \"Retrieve a list of currently allowed IPs\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/ip-access-response" }, "examples": { "application/json": { "id": 1, "ip": "192.168.1.1", "created_at": 1441824715, "updated_at": 1441824715 } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_access_settings-whitelist-rule_id", "summary": "Remove a specific IP from the allowed list", "tags": [ "IP Access Management" ], "description": "**This endpoint allows you to remove a specific IP address from your list of allowed addresses.**\n\nWhen removing a specific IP address from your list, you must include the ID in your call. You can retrieve the IDs associated with your allowed IP addresses using the \"Retrieve a list of currently allowed IPs\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] } }, "/sso/certificates": { "post": { "operationId": "POST_sso-certificates", "summary": "Create an SSO Certificate", "tags": [ "Certificates" ], "description": "**This endpoint allows you to create an SSO certificate.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "description": "", "properties": { "public_certificate": { "type": "string", "description": "This public certificate allows SendGrid to verify that SAML requests it receives are signed by an IdP that it recognizes." }, "enabled": { "type": "boolean", "description": "Indicates if the certificate is enabled." }, "integration_id": { "type": "string", "description": "An ID that matches a certificate to a specific IdP integration. This is the `id` returned by the \"Get All SSO Integrations\" endpoint." } }, "required": [ "public_certificate", "integration_id" ], "example": { "public_certificate": "", "enabled": false, "integration_id": "b0b98502-9408-4b24-9e3d-31ed7cb15312" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/sso-certificate-body" }, "examples": { "application/json": { "public_certificate": "", "id": 66138975, "not_before": 1621289880, "not_after": 1621289880, "intergration_id": "b0b98502-9408-4b24-9e3d-31ed7cb15312" } } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } } }, "/sso/integrations/{integration_id}/certificates": { "parameters": [ { "name": "integration_id", "in": "path", "description": "An ID that matches a certificate to a specific IdP integration.", "required": true, "type": "string" } ], "get": { "operationId": "GET_sso-integrations-integration_id-certificates", "summary": "Get All SSO Certificates by Integration", "tags": [ "Certificates" ], "description": "**This endpoint allows you to retrieve all your IdP configurations by configuration ID.**\n\nThe `integration_id` expected by this endpoint is the `id` returned in the response by the \"Get All SSO Integrations\" endpoint.", "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/sso-certificate-body" } }, "examples": { "application/json": [ { "public_certificate": "", "id": 66138975, "not_before": 1621289880, "not_after": 1621289880, "intergration_id": "b0b98502-9408-4b24-9e3d-31ed7cb15312" } ] } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } } }, "/sso/certificates/{cert_id}": { "parameters": [ { "name": "cert_id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_sso-certificates-cert_id", "summary": "Get an SSO Certificate", "tags": [ "Certificates" ], "description": "**This endpoint allows you to retrieve an individual SSO certificate.**", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/sso-certificate-body" }, "examples": { "application/json": { "public_certificate": "", "id": 66138975, "not_before": 1621289880, "not_after": 1621289880, "intergration_id": "b0b98502-9408-4b24-9e3d-31ed7cb15312" } } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } }, "patch": { "operationId": "PATCH_sso-certificates-cert_id", "summary": "Update SSO Certificate", "tags": [ "Certificates" ], "description": "**This endpoint allows you to update an existing certificate by ID.**\n\nYou can retrieve a certificate's ID from the response provided by the \"Get All SSO Integrations\" endpoint.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "public_certificate": { "type": "string", "description": "This public certificate allows SendGrid to verify that SAML requests it receives are signed by an IdP that it recognizes." }, "enabled": { "type": "boolean", "description": "Indicates whether or not the certificate is enabled." }, "integration_id": { "type": "string", "description": "An ID that matches a certificate to a specific IdP integration." } }, "example": { "public_certificate": "", "enabled": false, "intergration_id": "b0b98502-9408-4b24-9e3d-31ed7cb15312" } } } ], "responses": { "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } }, "delete": { "operationId": "DELETE_sso-certificates-cert_id", "summary": "Delete an SSO Certificate", "tags": [ "Certificates" ], "description": "**This endpoint allows you to delete an SSO certificate.**\n\nYou can retrieve a certificate's ID from the response provided by the \"Get All SSO Integrations\" endpoint.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/sso-certificate-body" }, "examples": { "application/json": { "public_certificate": "", "id": 66138975, "not_before": 1621289880, "not_after": 1621289880, "intergration_id": "b0b98502-9408-4b24-9e3d-31ed7cb15312" } } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } } }, "/sso/integrations": { "post": { "operationId": "POST_sso-integrations", "summary": "Create an SSO Integration", "tags": [ "Single Sign-On Settings" ], "description": "**This endpoint allows you to create an SSO integration.**", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/create-integration-request", "example": { "name": "Twilio SendGrid", "enabled": true, "signin_url": "https://example.okta.com/home/examplecompany/yokpGWsmpRUcuvXFb4x6/nfaVADNhuHvvReAEV4x6", "signout_url": "https://example.okta.com/login/signout?fromURI=exampleappurl", "entity_id": "http://www.okta.com/${org.externalKey}", "completed_integration": true, "id": "b0b98502-9408-4b24-9e3d-31ed7cb15312" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/sso-integration" }, "examples": { "application/json": { "name": "Twilio SendGrid", "enabled": true, "signin_url": "https://example.okta.com/home/examplecompany/yokpGWsmpRUcuvXFb4x6/nfaVADNhuHvvReAEV4x6", "signout_url": "https://example.okta.com/login/signout?fromURI=exampleappurl", "entity_id": "http://www.okta.com/${org.externalKey}", "last_updated": 1621288964 } } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } }, "get": { "operationId": "GET_sso-integrations", "summary": "Get All SSO Integrations", "tags": [ "Single Sign-On Settings" ], "description": "**This endpoint allows you to retrieve all SSO integrations tied to your Twilio SendGrid account.**\n\nThe IDs returned by this endpoint can be used by the APIs additional endpoints to modify your SSO integrations.", "parameters": [ { "name": "si", "in": "query", "description": "If this parameter is set to `true`, the response will include the `completed_integration` field.", "type": "boolean" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/sso-integration" } }, "examples": { "application/json": [ { "name": "Twilio SendGrid", "enabled": true, "signin_url": "https://example.okta.com/home/examplecompany/yokpGWsmpRUcuvXFb4x6/nfaVADNhuHvvReAEV4x6", "signout_url": "https://example.okta.com/login/signout?fromURI=exampleappurl", "entity_id": "http://www.okta.com/${org.externalKey}", "last_updated": 1621288520, "completed_integration": true, "id": "b0b98502-9408-4b24-9e3d-31ed7cb15312", "single_signon_url": "https://api.sendgrid.com/v3/public/sso/saml/response/id/b0b98502-9408-4b24-9e3d-31ed7cb15312", "audience_url": "https://api.sendgrid.com/v3/public/sso/saml/response/id/b0b98502-9408-4b24-9e3d-31ed7cb15312" } ] } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } } }, "/sso/integrations/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_sso-integrations-id", "summary": "Get an SSO Integration", "tags": [ "Single Sign-On Settings" ], "description": "**This endpoint allows you to retrieve an SSO integration by ID.**\n\nYou can retrieve the IDs for your configurations from the response provided by the \"Get All SSO Integrations\" endpoint.", "parameters": [ { "name": "si", "in": "query", "description": "If this parameter is set to `true`, the response will include the `completed_integration` field.", "type": "boolean" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/sso-integration" }, "examples": { "application/json": { "name": "Twilio SendGrid", "enabled": true, "signin_url": "https://example.okta.com/home/examplecompany/yokpGWsmpRUcuvXFb4x6/nfaVADNhuHvvReAEV4x6", "signout_url": "https://example.okta.com/login/signout?fromURI=exampleappurl", "entity_id": "http://www.okta.com/${org.externalKey}", "last_updated": 1621288964, "completed_integration": true, "id": "b0b98502-9408-4b24-9e3d-31ed7cb15312", "audience_url": "https://api.sendgrid.com/v3/public/sso/saml/response/id/b0b98502-9408-4b24-9e3d-31ed7cb15312" } } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } }, "patch": { "operationId": "PATCH_sso-integrations-id", "summary": "Update an SSO Integration", "tags": [ "Single Sign-On Settings" ], "description": "**This endpoint allows you to modify an exisiting SSO integration.**\n\nYou can retrieve the IDs for your configurations from the response provided by the \"Get All SSO Integrations\" endpoint.", "parameters": [ { "name": "si", "in": "query", "description": "If this parameter is set to `true`, the response will include the `completed_integration` field.", "type": "boolean" }, { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/create-integration-request", "example": { "name": "Twilio SendGrid", "enabled": true, "signin_url": "https://example.okta.com/home/examplecompany/yokpGWsmpRUcuvXFb4x6/nfaVADNhuHvvReAEV4x6", "signout_url": "https://example.okta.com/login/signout?fromURI=exampleappurl", "entity_id": "http://www.okta.com/${org.externalKey}", "last_updated": 1621288964, "completed_integration": true } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/sso-integration" }, "examples": { "application/json": { "name": "Twilio SendGrid", "enabled": true, "signin_url": "https://example.okta.com/home/examplecompany/yokpGWsmpRUcuvXFb4x6/nfaVADNhuHvvReAEV4x6", "signout_url": "https://example.okta.com/login/signout?fromURI=exampleappurl", "entity_id": "http://www.okta.com/${org.externalKey}", "last_updated": 1621288964, "id": "b0b98502-9408-4b24-9e3d-31ed7cb15312", "single_signon_url": "https://api.sendgrid.com/v3/public/sso/saml/response/id/b0b98502-9408-4b24-9e3d-31ed7cb15312", "audience_url": "https://api.sendgrid.com/v3/public/sso/saml/response/id/b0b98502-9408-4b24-9e3d-31ed7cb15312" } } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } }, "delete": { "operationId": "DELETE_sso-integrations-id", "summary": "Delete an SSO Integration", "tags": [ "Single Sign-On Settings" ], "description": "**This endpoint allows you to delete an IdP configuration by ID.**\n\nYou can retrieve the IDs for your configurations from the response provided by the \"Get All SSO Integrations\" endpoint.", "responses": { "204": { "description": "" }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } } }, "/sso/teammates": { "post": { "operationId": "POST_sso-teammates", "summary": "Create SSO Teammate", "tags": [ "Single Sign-On Teammates" ], "description": "**This endpoint allows you to create an SSO Teammate.**\n\nThe email provided for this user will also function as the Teammate’s username.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/sso-teammate-request", "example": { "first_name": "Jane", "last_name": "Doe", "email": "jane_doe@example.com", "scopes": [ "mail.batch.create", "mail.batch.delete", "mail.batch.read", "mail.batch.update", "mail.send" ] } } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/sso-teammate-response" }, "examples": { "application/json": { "first_name": "Jane", "last_name": "Doe", "email": "jane_doe@example.com", "is_read_only": true, "username": "jane_doe@example.com", "is_sso": true } } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } } }, "/sso/teammates/{username}": { "parameters": [ { "name": "username", "in": "path", "description": "This email address must be the same address assigned to the teammate in your IdP", "required": true, "type": "string", "format": "email" } ], "patch": { "operationId": "PATCH_sso-teammates-username", "summary": "Edit an SSO Teammate", "tags": [ "Single Sign-On Teammates" ], "description": "**This endpoint allows you to modify an existing SSO Teammate.**\n\nTo turn a teammate into an admin, the request body should contain the `is_admin` field set to `true`. Otherwise, set `is_admin` to false and pass in all the scopes that a teammate should have.\n\nOnly the parent user and Teammates with admin permissions can update another Teammate’s permissions. Admin users can only update permissions.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "scopes": { "type": "array", "items": { "type": "string" } }, "is_admin": { "type": "boolean" } }, "example": { "first_name": "Jane", "last_name": "Doe", "email": "jane_doe@example.com", "scopes": [ "mail.batch.create", "mail.batch.delete", "mail.batch.read", "mail.batch.update", "mail.send" ], "is_admin": false } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/sso-teammates-patch-response" }, "examples": { "application/json": { "first_name": "Jane", "last_name": "Doe", "email": "jane_doe@example.com", "is_admin": false, "username": "jane_doe@example.com", "is_sso": true, "address": "1234 Fake St.", "address2": "Suite 5", "city": "San Francisco", "state": "CA", "zip": "94105", "Country": "United States", "phone": "+15555555555", "user_type": "teammate" } } }, "400": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:400" }, "401": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:401" }, "403": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:403" }, "429": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:429" }, "500": { "$ref": "#/responses/trait:singleSignOnErrorsTrait:500" } } } }, "/mail_settings": { "get": { "operationId": "GET_mail_settings", "summary": "Retrieve all mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to retrieve a list of all mail settings.**\n\nEach setting will be returned with an `enabled` status set to `true` or `false` and a short description that explains what the setting does.", "parameters": [ { "name": "limit", "in": "query", "description": "The number of settings to return.", "type": "integer" }, { "name": "offset", "in": "query", "description": "Where in the list of results to begin displaying settings.", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "description": "The list of all mail settings.", "items": { "type": "object", "properties": { "title": { "type": "string", "description": "The title of the mail setting." }, "enabled": { "type": "boolean", "description": "Indicates if this mail setting is currently enabled." }, "name": { "type": "string", "description": "The name of the mail setting." }, "description": { "type": "string", "description": "A description of the mail setting." } }, "required": [ "title", "enabled", "name", "description" ] } } }, "required": [ "result" ] }, "examples": { "application/json": { "result": [ { "title": "Address Whitelist", "enabled": false, "name": "address_whitelist", "description": "Address / domains that should never have email suppressed." }, { "title": "Bounce Purge", "enabled": false, "name": "bounce_purge", "description": "Allows you to automatically purge bounce records from SendGrid after a specified number of days." }, { "title": "Event Notification", "enabled": true, "name": "event_notify", "description": "Controls notifications for events, such as bounces, clicks, and opens." }, { "title": "Footer", "enabled": false, "name": "footer", "description": "Allows you to add a custom footer to outgoing email." }, { "title": "Forward Bounce", "enabled": true, "name": "forward_bounce", "description": "Allows you to forward bounces to a specific email address." }, { "title": "Forward Spam", "enabled": false, "name": "forward_spam", "description": "Allows for a copy of spam reports to be forwarded to an email address." }, { "title": "Legacy Email Template", "enabled": true, "name": "template", "description": "Allows you to customize your outgoing HTML emails." }, { "title": "Plain Content", "enabled": false, "name": "plain_content", "description": "Convert your plain text emails to HTML." }, { "title": "Spam Checker", "enabled": true, "name": "spam_check", "description": "Check outbound messages for spam content." } ] } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] } }, "/mail_settings/address_whitelist": { "patch": { "operationId": "PATCH_mail_settings-address_whitelist", "summary": "Update address whitelist mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to update your current email address whitelist settings.**\n\nYou can select whether or not this setting should be enabled by assigning the `enabled` field a `true` or `false` value.\n\nPassing only the `enabled` field to this endpoint will not alter your current `list` of whitelist entries. However, any modifications to your `list` of entries will overwrite the entire list. For this reason, you must included all existing entries you wish to retain in your `list` in addition to any new entries you intend to add. To remove one or more `list` entries, pass a `list` with only the entries you wish to retain.\n\nYou should not add generic domains such as `gmail.com` or `yahoo.com` in your `list` because your emails will not honor recipients' unsubscribes. This may cause a legal violation of [CAN-SPAM](https://sendgrid.com/docs/glossary/can-spam/) and could damage your sending reputation.\n\nThe Address Whitelist setting allows you to specify email addresses or domains for which mail should never be suppressed.\n\nFor example, if you own the domain `example.com`, and one or more of your recipients use `email@example.com` addresses, placing `example.com` in the address whitelist setting instructs Twilio SendGrid to ignore all bounces, blocks, and unsubscribes logged for that domain. In other words, all bounces, blocks, and unsubscribes will still be sent to `example.com` as if they were sent under normal sending conditions.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if your email address whitelist is enabled." }, "list": { "type": "array", "description": "Either a single email address that you want whitelisted or a domain, for which all email addresses belonging to this domain will be whitelisted.", "items": { "type": "string" } } }, "example": { "enabled": true, "list": [ "email1@example.com", "example.com" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_address_whitelabel" }, "examples": { "application/json": { "enabled": true, "list": [ "email1@example.com" ] } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mail_settings-address_whitelist", "summary": "Retrieve address whitelist mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to retrieve your current email address whitelist settings.**\n\nThe Address Whitelist setting allows you to specify email addresses or domains for which mail should never be suppressed.\n\nFor example, if you own the domain `example.com`, and one or more of your recipients use `email@example.com` addresses, placing `example.com` in the address whitelist setting instructs Twilio SendGrid to ignore all bounces, blocks, and unsubscribes logged for that domain. In other words, all bounces, blocks, and unsubscribes will still be sent to `example.com` as if they were sent under normal sending conditions.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_address_whitelabel" }, "examples": { "application/json": { "enabled": true, "list": [ "example.com", "jane_doe@example1.com" ] } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] } }, "/mail_settings/footer": { "patch": { "operationId": "PATCH_mail_settings-footer", "summary": "Update footer mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to update your current Footer mail settings.**\n\nThe Footer setting will insert a custom footer at the bottom of your text and HTML email message bodies.\n\nYou can insert your HTML or plain text directly using this endpoint, or you can create the footer using the [Mail Settings menu in the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings).", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/mail_settings_footer", "example": { "enabled": true, "html_content": "

Ahoy, World!

\n", "plain_content": "" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_footer" }, "examples": { "application/json": { "enabled": true, "html_content": "

Ahoy, World!

\n", "plain_content": "" } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mail_settings-footer", "summary": "Retrieve footer mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to retrieve your current Footer mail settings.**\n\nThe Footer setting will insert a custom footer at the bottom of your text and HTML email message bodies.\n\nYou can insert your HTML or plain text directly using the \"Update footer mail settings\" endpoint, or you can create the footer using the [Mail Settings menu in the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_footer" }, "examples": { "application/json": { "enabled": true, "html_content": "

Ahoy, World!

\n", "plain_content": "" } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] } }, "/mail_settings/forward_spam": { "patch": { "operationId": "PATCH_mail_settings-forward_spam", "summary": "Update forward spam mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to update your current Forward Spam mail settings.**\n\nEnabling the Forward Spam setting allows you to specify `email` addresses to which spam reports will be forwarded. You can set multiple addresses by passing this endpoint a comma separated list of emails in a single string.\n\n```\n{\n \"email\": \"address1@example.com, address2@exapmle.com\",\n \"enabled\": true\n}\n```\n\nThe Forward Spam setting may also be used to receive emails sent to `abuse@` and `postmaster@` role addresses if you have authenticated your domain.\n\nFor example, if you authenticated `example.com` as your root domain and set a custom return path of `sub` for that domain, you could turn on Forward Spam, and any emails sent to `abuse@sub.example.com` or `postmaster@sub.example.com` would be forwarded to the email address you entered in the `email` field.\n\nYou can authenticate your domain using the \"Authenticate a domain\" endpoint or in the [Sender Authentication section of the Twilio SendGrid App](https://app.sendgrid.com/settings/sender_auth). You can also configure the Forward Spam mail settings in the [Mail Settings section of the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings).", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/mail_settings_forward_spam", "example": { "email": "abuse@example.com", "enabled": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_forward_spam" }, "examples": { "application/json": { "email": "abuse@example.com", "enabled": true } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mail_settings-forward_spam", "summary": "Retrieve forward spam mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to retrieve your current Forward Spam mail settings.**\n\nEnabling the Forward Spam setting allows you to specify `email` addresses to which spam reports will be forwarded. This endpoint returns any email address(es) you have set to receive forwarded spam and an `enabled` status indicating if the setting is active.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_forward_spam" }, "examples": { "application/json": { "email": "abuse@example.com", "enabled": true } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] } }, "/mail_settings/template": { "patch": { "operationId": "PATCH_mail_settings-template", "summary": "Update template mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to update your current legacy email template settings.**\n\nThis setting refers to our original email templates. We currently support more fully featured [Dynamic Transactional Templates](https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/).\n\nThe legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages. For instructions on using legacy templates, see how to [\"Create and Edit Legacy Transactional Templates](https://sendgrid.com/docs/ui/sending-email/create-and-edit-legacy-transactional-templates/). For help migrating to our current template system, see [\"Migrating from Legacy Templates\"](https://sendgrid.com/docs/ui/sending-email/migrating-from-legacy-templates/).", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if you want to enable the legacy email template mail setting." }, "html_content": { "type": "string", "description": "The new HTML content for your legacy email template." } }, "example": { "enabled": true, "html_content": "<% body %>" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if the legacy email template mail setting is enabled." }, "html_content": { "type": "string", "description": "The HTML content of your legacy email template." } }, "required": [ "enabled", "html_content" ] }, "examples": { "application/json": { "enabled": false, "html_content": "

<% body %>Example

\n" } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mail_settings-template", "summary": "Retrieve legacy template mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to retrieve your current legacy email template settings.**\n\nThis setting refers to our original email templates. We currently support more fully featured [Dynamic Transactional Templates](https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/).\n\nThe legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages. For instructions on using legacy templates, see how to [\"Create and Edit Legacy Transactional Templates](https://sendgrid.com/docs/ui/sending-email/create-and-edit-legacy-transactional-templates/). For help migrating to our current template system, see [\"Migrating from Legacy Templates\"](https://sendgrid.com/docs/ui/sending-email/migrating-from-legacy-templates/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_template" }, "examples": { "application/json": { "enabled": false, "html_content": "

<% body %>Example

\n" } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] } }, "/mail_settings/bounce_purge": { "patch": { "operationId": "PATCH_mail_settings-bounce_purge", "summary": "Update bounce purge mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to update your current bounce and purge settings.**\n\nThe Bounce Perge setting allows you to set a schedule that Twilio SendGrid will use to automatically delete contacts from your soft and hard bounce suppression lists. The schedule is set in full days by assigning the number of days, an integer, to the `soft_bounces` and/or `hard_bounces` fields.\n\nA hard bounce occurs when an email message has been returned to the sender because the recipient's address is invalid. A hard bounce might occur because the domain name doesn't exist or because the recipient is unknown.\n\nA soft bounce occurs when an email message reaches the recipient's mail server but is bounced back undelivered before it actually reaches the recipient. A soft bounce might occur because the recipient's inbox is full.\n\nYou can also manage this setting in the [Mail Settings section of the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings). You can manage your bounces manually using the [Bounces API](https://sendgrid.api-docs.io/v3.0/bounces-api) or the [Bounces menu in the Twilio SendGrid App](https://app.sendgrid.com/suppressions/bounces).", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/mail_settings_bounce_purge", "example": { "enabled": true, "hard_bounces": 5, "soft_bounces": 5 } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_bounce_purge" }, "examples": { "application/json": { "enabled": false, "hard_bounces": 5, "soft_bounces": 5 } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mail_settings-bounce_purge", "summary": "Retrieve bounce purge mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to retrieve your current bounce and purge settings.**\n\nThe Bounce Perge setting allows you to set a schedule that Twilio SendGrid will use to automatically delete contacts from your soft and hard bounce suppression lists.\n\nA hard bounce occurs when an email message has been returned to the sender because the recipient's address is invalid. A hard bounce might occur because the domain name doesn't exist or because the recipient is unknown.\n\nA soft bounce occurs when an email message reaches the recipient's mail server but is bounced back undelivered before it actually reaches the recipient. A soft bounce might occur because the recipient's inbox is full.\n\nYou can also manage this setting in the [Mail Settings section of the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings). You can manage your bounces manually using the [Bounces API](https://sendgrid.api-docs.io/v3.0/bounces-api) or the [Bounces menu in the Twilio SendGrid App](https://app.sendgrid.com/suppressions/bounces).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_bounce_purge" }, "examples": { "application/json": { "enabled": false, "soft_bounces": 5, "hard_bounces": 5 } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] } }, "/mail_settings/forward_bounce": { "patch": { "operationId": "PATCH_mail_settings-forward_bounce", "summary": "Update forward bounce mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to update your current bounce forwarding mail settings.**\n\nEnabling the Forward Bounce setting allows you to specify an `email` address to which bounce reports will be forwarded.\n\nYou can also configure the Forward Spam mail settings in the [Mail Settings section of the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings).", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/mail_settings_forward_bounce", "example": { "enabled": true, "email": "bounces@example.com" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_forward_bounce" }, "examples": { "application/json": { "email": "bounces@example.com", "enabled": true } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mail_settings-forward_bounce", "summary": "Retrieve forward bounce mail settings", "tags": [ "Settings - Mail" ], "description": "**This endpoint allows you to retrieve your current bounce forwarding mail settings.**\n\nEnabling the Forward Bounce setting allows you to specify `email` addresses to which bounce reports will be forwarded. This endpoint returns the email address you have set to receive forwarded bounces and an `enabled` status indicating if the setting is active.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/mail_settings_forward_bounce" }, "examples": { "application/json": { "enabled": true, "email": "bounces@example.com" } } }, "400": { "$ref": "#/responses/trait:makoErrorResponse:400" }, "401": { "$ref": "#/responses/trait:makoErrorResponse:401" }, "403": { "$ref": "#/responses/trait:makoErrorResponse:403" }, "404": { "$ref": "#/responses/trait:makoErrorResponse:404" }, "500": { "$ref": "#/responses/trait:makoErrorResponse:500" } }, "security": [ { "Authorization": [] } ] } }, "/partner_settings/new_relic": { "patch": { "operationId": "PATCH_partner_settings-new_relic", "summary": "Updates New Relic partner settings.", "tags": [ "Settings - Partner" ], "description": "**This endpoint allows you to update or change your New Relic partner settings.**\n\nOur partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [Partners documentation](https://sendgrid.com/docs/ui/account-and-settings/partners/).\n\nBy integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [SendGrid for New Relic documentation](https://sendgrid.com/docs/ui/analytics-and-reporting/tracking-stats-using-new-relic/).", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "license_key": { "type": "string", "description": "The license key for your New Relic account." }, "enabled": { "type": "boolean", "description": "Indicates if this partner setting is enabled." }, "enable_subuser_statistics": { "type": "boolean", "description": "Indicates if your subuser statistics will be sent to your New Relic Dashboard." } }, "example": { "license_key": "", "enabled": true, "enable_subuser_statistics": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/partner_settings_new_relic" }, "examples": { "application/json": { "enable_subuser_statistics": true, "enabled": true, "license_key": "" } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_partner_settings-new_relic", "summary": "Returns all New Relic partner settings.", "tags": [ "Settings - Partner" ], "description": "**This endpoint allows you to retrieve your current New Relic partner settings.**\n\nOur partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [Partners documentation](https://sendgrid.com/docs/ui/account-and-settings/partners/).\n\nBy integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [SendGrid for New Relic documentation](https://sendgrid.com/docs/ui/analytics-and-reporting/tracking-stats-using-new-relic/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/partner_settings_new_relic" }, "examples": { "application/json": { "enable_subuser_statistics": false, "enabled": true, "license_key": "" } } } }, "security": [ { "Authorization": [] } ] } }, "/partner_settings": { "get": { "operationId": "GET_partner_settings", "summary": "Returns a list of all partner settings.", "tags": [ "Settings - Partner" ], "description": "**This endpoint allows you to retrieve a list of all partner settings that you can enable.**\n\nOur partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [Partners documentation](https://sendgrid.com/docs/ui/account-and-settings/partners/).", "parameters": [ { "name": "limit", "in": "query", "description": "The number of settings to return per page.", "type": "integer" }, { "name": "offset", "in": "query", "description": "The paging offset.", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string", "description": "The title of the partner." }, "enabled": { "type": "boolean", "description": "Indicates if this partner setting has been enabled." }, "name": { "type": "string", "description": "The name of the partner setting." }, "description": { "type": "string", "description": "A description of this partner setting." } }, "required": [ "title", "enabled", "name", "description" ] } } } }, "examples": { "application/json": { "result": [ { "title": "Partner title", "enabled": true, "name": "partner_name", "description": "A description of a partner." } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/teammates": { "post": { "operationId": "POST_v3-teammates", "summary": "Invite teammate", "tags": [ "Teammates" ], "description": "**This endpoint allows you to invite a Teammate to your account via email.**\n\nYou can set a Teammate's initial permissions using the `scopes` array in the request body. Teammate's will receive a minimum set of scopes from Twilio SendGrid that are necessary for the Teammate to function.\n\n**Note:** A teammate invite will expire after 7 days, but you may resend the invitation at any time to reset the expiration date.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "New teammate's email", "minLength": 5, "maxLength": 255, "pattern": "^.*@.*\\..*" }, "scopes": { "type": "array", "description": "Set to specify list of scopes that teammate should have. Should be empty if teammate is an admin.", "items": { "type": "string" } }, "is_admin": { "type": "boolean", "default": false, "description": "Set to true if teammate should be an admin user" } }, "required": [ "email", "scopes", "is_admin" ], "example": { "email": "teammate1@example.com", "scopes": [ "user.profile.read", "user.profile.update" ], "is_admin": false } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "token": { "type": "string", "description": "Token to identify invite" }, "email": { "type": "string", "description": "Teammate's email address" }, "scopes": { "type": "array", "description": "Initial set of permissions to give to teammate if they accept the invite", "items": {} }, "is_admin": { "type": "boolean", "description": "Set to true if teammate should have admin privileges" } } }, "examples": { "application/json": { "email": "teammate1@example.com", "scopes": [ "user.profile.read", "user.profile.update" ], "is_admin": false } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_v3-teammates", "summary": "Retrieve all teammates", "tags": [ "Teammates" ], "description": "**This endpoint allows you to retrieve a list of all current Teammates.**\n\nYou can limit the number of results returned using the `limit` query paramater. To return results from a specific Teammate, use the `offset` paramter. The Response Headers will include pagination info.", "parameters": [ { "name": "limit", "in": "query", "description": "Number of items to return", "type": "integer", "default": 500, "minimum": 0, "maximum": 500 }, { "name": "offset", "in": "query", "description": "Paging offset", "type": "integer", "default": 0, "minimum": 0 }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "type": "object", "properties": { "username": { "type": "string", "description": "Teammate's username" }, "email": { "type": "string", "description": "Teammate's email" }, "first_name": { "type": "string", "description": "Teammate's first name" }, "last_name": { "type": "string", "description": "Teammate's last name" }, "user_type": { "type": "string", "description": "Indicate the type of user: owner user, teammate admin user, or normal teammate", "enum": [ "admin", "owner", "teammate" ] }, "is_admin": { "type": "boolean", "description": "Set to true if teammate has admin privileges" }, "phone": { "type": "string", "description": "(optional) Teammate's phone number" }, "website": { "type": "string", "description": "(optional) Teammate's website" }, "address": { "type": "string", "description": "(optional) Teammate's address" }, "address2": { "type": "string", "description": "(optional) Teammate's address" }, "city": { "type": "string", "description": "(optional) Teammate's city" }, "state": { "type": "string", "description": "(optional) Teammate's state" }, "zip": { "type": "string", "description": "(optional) Teammate's zip" }, "country": { "type": "string", "description": "(optional) Teammate's country" } } } } } }, "examples": { "application/json": { "results": [ { "username": "teammate1", "email": "teammate1@example.com", "first_name": "Jane", "last_name": "Doe", "user_type": "owner", "is_admin": true, "phone": "123-345-3453", "website": "www.example.com", "company": "ACME Inc.", "address": "123 Acme St", "address2": "", "city": "City", "state": "CA", "country": "USA", "zip": "12345" }, { "username": "teammate2", "email": "teammate2@example.com", "first_name": "John", "last_name": "Doe", "user_type": "teammate", "is_admin": false, "phone": "123-345-3453", "website": "www.example.com", "company": "ACME Inc.", "address": "123 Acme St", "address2": "", "city": "City", "state": "CA", "country": "USA", "zip": "12345" }, { "username": "teammate3", "email": "teammate3@example.com", "first_name": "Steve", "last_name": "Doe", "user_type": "admin", "is_admin": true, "phone": "123-345-3453", "website": "www.example.com", "company": "ACME Inc.", "address": "123 Acme St", "address2": "", "city": "City", "state": "CA", "country": "USA", "zip": "12345" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/teammates/pending/{token}/resend": { "parameters": [ { "name": "token", "in": "path", "description": "The token for the invite that you want to resend.", "required": true, "type": "string" } ], "post": { "operationId": "POST_v3-teammates-pending-token-resend", "summary": "Resend teammate invite", "tags": [ "Teammates" ], "description": "**This endpoint allows you to resend a Teammate invitation.**\n\nTeammate invitations will expire after 7 days. Resending an invitation will reset the expiration date.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "token": { "type": "string", "description": "ID to identify invite" }, "email": { "type": "string", "description": "Teammate's email address" }, "scopes": { "type": "array", "description": "Initial set of permissions to give to teammate if they accept the invite", "items": { "type": "string" } }, "is_admin": { "type": "boolean", "description": "Set to true if teammate should have admin privileges" } } }, "examples": { "application/json": { "pending_id": "abc123abc", "email": "teammate1@example.com", "scopes": [ "user.profile.read", "user.profile.update" ], "is_admin": false } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "invalid pending key", "field": "pending_key" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/scopes/requests": { "get": { "operationId": "GET_v3-scopes-requests", "summary": "Retrieve access requests", "tags": [ "Teammates" ], "description": "**This endpoint allows you to retrieve a list of all recent access requests.**\n\nThe Response Header's `link` parameter will include pagination info.", "parameters": [ { "name": "limit", "in": "query", "description": "Optional field to limit the number of results returned.", "type": "integer", "default": 50 }, { "name": "offset", "in": "query", "description": "Optional beginning point in the list to retrieve from.", "type": "integer", "default": 0 } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "description": "Request ID" }, "scope_group_name": { "type": "string", "description": "Name of group of scopes associated to page teammate is requesting access to" }, "username": { "type": "string", "description": "Teammate's username" }, "email": { "type": "string", "description": "Teammate's email" }, "first_name": { "type": "string", "description": "Teammate's first name" }, "last_name": { "type": "string", "description": "Teammate's last name" } } } }, "examples": { "application/json": [ { "id": 1, "scope_group_name": "Mail Settings", "username": "teammate1", "email": "teammate1@example.com", "first_name": "Teammate", "last_name": "One" }, { "id": 2, "scope_group_name": "Stats", "username": "teammate2", "email": "teammate2@example.com", "first_name": "Teammate", "last_name": "Two" } ] } } }, "security": [ { "Authorization": [] } ] } }, "/teammates/pending": { "get": { "operationId": "GET_v3-teammates-pending", "summary": "Retrieve all pending teammates", "tags": [ "Teammates" ], "description": "**This endpoint allows you to retrieve a list of all pending Teammate invitations.**\n\nEach teammate invitation is valid for 7 days. Users may resend the invitation to refresh the expiration date.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "type": "object", "properties": { "email": { "type": "string", "description": "Email address teammate invite will be sent to" }, "scopes": { "type": "array", "description": "List of permissions to give teammate if they accept", "items": { "type": "string" } }, "is_admin": { "type": "boolean", "description": "Set to true to indicate teammate should have the same set of permissions as parent user" }, "token": { "type": "string", "description": "Invitation token used to identify user" }, "expiration_date": { "type": "integer", "description": "timestamp indicates when invite will expire. Expiration is 7 days after invite creation" } } } } } }, "examples": { "application/json": { "result": [ { "email": "user1@example.com", "scopes": [ "user.profile.read", "user.profile.edit" ], "is_admin": false, "pending_id": "abcd123abc", "expiration_date": 1456424263 }, { "email": "user2@example.com", "scopes": [], "is_admin": true, "pending_id": "bcde234bcd", "expiration_date": 1456424263 } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/teammates/{username}": { "parameters": [ { "name": "username", "in": "path", "description": "The username of the teammate that you want to retrieve.", "required": true, "type": "string" } ], "get": { "operationId": "GET_v3-teammates-username", "summary": "Retrieve specific teammate", "tags": [ "Teammates" ], "description": "**This endpoint allows you to retrieve a specific Teammate by username.**\n\nYou can retrieve the username's for each of your Teammates using the \"Retrieve all Teammates\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "username": { "type": "string", "description": "Teammate's username" }, "first_name": { "type": "string", "description": "Teammate's first name" }, "last_name": { "type": "string", "description": "Teammate's last name" }, "email": { "type": "string", "description": "Teammate's email" }, "scopes": { "type": "array", "description": "Scopes associated to teammate", "items": {} }, "user_type": { "type": "string", "description": "Indicate the type of user: account owner, teammate admin user, or normal teammate", "enum": [ "admin", "owner", "teammate" ] }, "is_admin": { "type": "boolean", "description": "Set to true if teammate has admin privileges" }, "phone": { "type": "string", "description": "(optional) Teammate's phone number" }, "website": { "type": "string", "description": "(optional) Teammate's website" }, "address": { "type": "string", "description": "(optional) Teammate's address" }, "address2": { "type": "string", "description": "(optional) Teammate's address" }, "city": { "type": "string", "description": "(optional) Teammate's city" }, "state": { "type": "string", "description": "(optional) Teammate's state" }, "zip": { "type": "string", "description": "(optional) Teammate's zip" }, "country": { "type": "string", "description": "(optional) Teammate's country" } } }, "examples": { "application/json": { "username": "teammate1", "first_name": "Jane", "last_name": "Doe", "email": "teammate1@example.com", "scopes": [ "user.profile.read", "user.profile.update", "..." ], "user_type": "admin", "is_admin": true, "phone": "123-345-3453", "website": "www.example.com", "company": "ACME Inc.", "address": "123 Acme St", "address2": "", "city": "City", "state": "CA", "country": "USA", "zip": "12345" } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_v3-teammates-username", "summary": "Update teammate's permissions", "tags": [ "Teammates" ], "description": "**This endpoint allows you to update a teammate’s permissions.**\n\nTo turn a teammate into an admin, the request body should contain an `is_admin` set to `true`. Otherwise, set `is_admin` to `false` and pass in all the scopes that a teammate should have.\n\n**Only the parent user or other admin teammates can update another teammate’s permissions.**\n\n**Admin users can only update permissions.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "scopes": { "type": "array", "description": "Provide list of scopes that should be given to teammate. If specifying list of scopes, is_admin should be set to False.", "items": { "type": "string" } }, "is_admin": { "type": "boolean", "description": "Set to True if this teammate should be promoted to an admin user. If True, scopes should be an empty array." } }, "required": [ "scopes", "is_admin" ], "example": { "scopes": [ "user.profile.read", "user.profile.edit" ], "is_admin": false } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "username": { "type": "string", "description": "Teammate's username" }, "first_name": { "type": "string", "description": "Teammate's first name" }, "last_name": { "type": "string", "description": "Teammate's last name" }, "email": { "type": "string", "description": "Teammate's email address" }, "scopes": { "type": "array", "description": "Scopes given to teammate", "items": { "type": "string" } }, "user_type": { "type": "string", "description": "Indicate the type of user: owner user, teammate admin user, or normal teammate", "enum": [ "admin", "owner", "teammate" ] }, "is_admin": { "type": "boolean", "description": "Set to true if teammate has admin priveleges" }, "phone": { "type": "string", "description": "(optional) Teammate's phone number" }, "website": { "type": "string", "description": "(optional) Teammate's website" }, "address": { "type": "string", "description": "(optional) Teammate's address" }, "address2": { "type": "string", "description": "(optional) Teammate's address" }, "city": { "type": "string", "description": "(optional) Teammate's city" }, "state": { "type": "string", "description": "(optional) Teammate's state" }, "zip": { "type": "string", "description": "(optional) Teammate's zip" }, "country": { "type": "string", "description": "(optional) Teammate's country" } } }, "examples": { "application/json": { "username": "teammate1", "first_name": "Jane", "last_name": "Doe", "email": "teammate1@example.com", "scopes": [ "user.profile.read", "user.profile.edit" ], "user_type": "teammate", "is_admin": false, "phone": "123-345-3453", "website": "www.example.com", "company": "ACME Inc.", "address": "123 Acme St", "address2": "", "city": "City", "state": "CA", "country": "USA", "zip": "12345" } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "one or more of given scopes are invalid", "field": "scopes" } ] } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "username not found", "field": "username" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_v3-teammates-username", "summary": "Delete teammate", "tags": [ "Teammates" ], "description": "**This endpoint allows you to delete a teammate.**\n\n**Only the parent user or an admin teammate can delete another teammate.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "username not found", "field": "username" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/scopes/requests/{request_id}/approve": { "parameters": [ { "name": "request_id", "in": "path", "description": "The ID of the request that you want to approve.", "required": true, "type": "string" } ], "patch": { "operationId": "PATCH_v3-scopes-requests-approve-id", "summary": "Approve access request", "tags": [ "Teammates" ], "description": "**This endpoint allows you to approve an access attempt.**\n\n**Note:** Only teammate admins may approve another teammate’s access request.", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "scope_group_name": { "type": "string", "description": "name of feature teammate will be given access to" } } }, "examples": { "application/json": { "scope_group_name": "Stats" } } }, "401": { "description": "", "schema": { "type": "object" } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/scopes/requests/{request_id}": { "parameters": [ { "name": "request_id", "in": "path", "description": "The ID of the request that you want to deny.", "required": true, "type": "string" } ], "delete": { "operationId": "DELETE_v3-scopes-requests-request_id", "summary": "Deny access request", "tags": [ "Teammates" ], "description": "**This endpoint allows you to deny an attempt to access your account.**\n\n**Note:** Only teammate admins may delete a teammate's access request.", "responses": { "204": { "description": "" }, "401": { "description": "" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "Cannot find request", "field": "request_id" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/teammates/pending/{token}": { "parameters": [ { "name": "token", "in": "path", "description": "The token for the invite you want to delete.", "required": true, "type": "string" } ], "delete": { "operationId": "DELETE_v3-teammates-pending-token", "summary": "Delete pending teammate", "tags": [ "Teammates" ], "description": "**This endpoint allows you to delete a pending teammate invite.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/alerts": { "post": { "operationId": "POST_alerts", "summary": "Create a new Alert", "tags": [ "Alerts" ], "description": "**This endpoint allows you to create a new alert.**\n\nAlerts allow you to specify an email address to receive notifications regarding your email usage or statistics. There are two types of alerts that can be created with this endpoint:\n\n* `usage_limit` allows you to set the threshold at which an alert will be sent.\n* `stats_notification` allows you to set how frequently you would like to receive email statistics reports. For example, \"daily\", \"weekly\", or \"monthly\".\n\nFor more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "type": { "type": "string", "description": "The type of alert you want to create. Can be either usage_limit or stats_notification.\nExample: usage_limit", "enum": [ "stats_notification", "usage_limit" ] }, "email_to": { "type": "string", "description": "The email address the alert will be sent to.\nExample: test@example.com", "format": "email", "nullable": true }, "frequency": { "type": "string", "description": "Required for stats_notification. How frequently the alert will be sent.\nExample: daily" }, "percentage": { "type": "integer", "description": "Required for usage_alert. When this usage threshold is reached, the alert will be sent.\nExample: 90" } }, "required": [ "type", "email_to" ], "example": { "type": "stats_notification", "email_to": "example@example.com", "frequency": "daily" } } }, { "name": "Authorization", "in": "header", "type": "string" }, { "name": "on-behalf-of", "in": "header", "type": "string" } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "created_at": { "type": "integer", "description": "A Unix timestamp indicating when the alert was created." }, "email_to": { "type": "string", "description": "The email address that the alert will be sent to.", "format": "email" }, "frequency": { "type": "string", "description": "If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent. For example, \"daily\", \"weekly\", or \"monthly\"." }, "id": { "type": "integer", "description": "The ID of the alert." }, "type": { "type": "string", "description": "The type of alert." }, "updated_at": { "type": "integer", "description": "A Unix timestamp indicating when the alert was last modified." }, "percentage": { "type": "integer", "description": "\"If the alert is of type usage_limit, this indicates the percentage of email usage that must be reached before the alert will be sent." } }, "required": [ "created_at", "email_to", "id", "type", "updated_at" ] }, "examples": { "application/json": { "created_at": 1451520930, "email_to": "test@example.com", "frequency": "daily", "id": 48, "type": "stats_notification", "updated_at": 1451520930 } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" } } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_alerts", "summary": "Retrieve all alerts", "tags": [ "Alerts" ], "description": "**This endpoint allows you to retrieve all of your alerts.**\n\nAlerts allow you to specify an email address to receive notifications regarding your email usage or statistics. \n* Usage alerts allow you to set the threshold at which an alert will be sent.\n* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, \"daily\", \"weekly\", or \"monthly\".\n\nFor more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).", "parameters": [ { "name": "Authorization", "in": "header", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "description": "The list of alerts.", "items": { "type": "object", "properties": { "created_at": { "type": "integer", "description": "A Unix timestamp indicating when the alert was created." }, "email_to": { "type": "string", "description": "The email address that the alert will be sent to." }, "id": { "type": "integer", "description": "The ID of the alert." }, "percentage": { "type": "integer", "description": "If the alert is of type usage_limit, this indicates the percentage of email usage that must be reached before the alert will be sent." }, "type": { "type": "string", "description": "The type of alert.", "enum": [ "usage_limit", "stats_notification" ] }, "updated_at": { "type": "integer", "description": "A Unix timestamp indicating when the alert was last modified." }, "frequency": { "type": "string", "description": "If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent. For example, \"daily\", \"weekly\", or \"monthly\"." } }, "required": [ "created_at", "email_to", "id", "type" ] } }, "examples": { "application/json": [ { "created_at": 1451498784, "email_to": "example1@example.com", "id": 46, "percentage": 90, "type": "usage_limit", "updated_at": 1451498784 }, { "created_at": 1451498812, "email_to": "example2@example.com", "frequency": "monthly", "id": 47, "type": "stats_notification", "updated_at": 1451498812 }, { "created_at": 1451520930, "email_to": "example3@example.com", "frequency": "daily", "id": 48, "type": "stats_notification", "updated_at": 1451520930 } ] } } }, "security": [ { "Authorization": [] } ] } }, "/alerts/{alert_id}": { "parameters": [ { "name": "alert_id", "in": "path", "description": "The ID of the alert you would like to retrieve.", "required": true, "type": "integer" } ], "get": { "operationId": "GET_alerts-alert_id", "summary": "Retrieve a specific alert", "tags": [ "Alerts" ], "description": "**This endpoint allows you to retrieve a specific alert.**\n\nAlerts allow you to specify an email address to receive notifications regarding your email usage or statistics. \n* Usage alerts allow you to set the threshold at which an alert will be sent.\n* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, \"daily\", \"weekly\", or \"monthly\".\n\nFor more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).", "parameters": [ { "name": "Authorization", "in": "header", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "created_at": { "type": "integer", "description": "A Unix timestamp indicating when the alert was created." }, "email_to": { "type": "string", "description": "The email address that the alert will be sent to." }, "frequency": { "type": "string", "description": "If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent. For example: \"daily\", \"weekly\", or \"monthly\"." }, "id": { "type": "integer", "description": "The ID of the alert." }, "type": { "type": "string", "description": "The type of alert.", "enum": [ "usage_alert", "stats_notification" ] }, "updated_at": { "type": "integer", "description": "A Unix timestamp indicating when the alert was last modified." }, "percentage": { "type": "integer", "description": "If the alert is of type usage_limit, this indicates the percentage of email usage that must be reached before the alert will be sent." } }, "required": [ "created_at", "email_to", "id", "type", "updated_at" ] }, "examples": { "application/json": { "created_at": 1451520930, "email_to": "example@example.com", "frequency": "daily", "id": 48, "type": "stats_notification", "updated_at": 1451520930 } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_alerts-alert_id", "summary": "Delete an alert", "tags": [ "Alerts" ], "description": "**This endpoint allows you to delete an alert.**\n\nAlerts allow you to specify an email address to receive notifications regarding your email usage or statistics. \n* Usage alerts allow you to set the threshold at which an alert will be sent.\n* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, \"daily\", \"weekly\", or \"monthly\".\n\nFor more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_alerts-alert_id", "summary": "Update an alert", "tags": [ "Alerts" ], "description": "**This endpoint allows you to update an alert.**\n\nAlerts allow you to specify an email address to receive notifications regarding your email usage or statistics. \n* Usage alerts allow you to set the threshold at which an alert will be sent.\n* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, \"daily\", \"weekly\", or \"monthly\".\n\nFor more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "email_to": { "type": "string", "description": "The new email address you want your alert to be sent to.\nExample: test@example.com" }, "frequency": { "type": "string", "description": "The new frequency at which to send the stats_notification alert.\nExample: monthly" }, "percentage": { "type": "integer", "description": "The new percentage threshold at which the usage_limit alert will be sent.\nExample: 90" } }, "example": { "email_to": "example@example.com" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "created_at": { "type": "integer", "description": "A Unix timestamp indicating when the alert was created." }, "email_to": { "type": "string", "description": "The email address that the alert will be sent to." }, "frequency": { "type": "string", "description": "If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent. For example: \"daily\", \"weekly\", or \"monthly\"." }, "id": { "type": "integer", "description": "The ID of the alert." }, "type": { "type": "string", "description": "The type of alert.", "enum": [ "usage_alert", "stats_notification" ] }, "updated_at": { "type": "integer", "description": "A Unix timestamp indicating when the alert was last modified." }, "percentage": { "type": "integer", "description": "If the alert is of type usage_limit, this indicates the percentage of email usage that must be reached before the alert will be sent." } }, "required": [ "created_at", "email_to", "id", "type", "updated_at" ] }, "examples": { "application/json": { "created_at": 1451520930, "email_to": "example@example.com", "frequency": "daily", "id": 48, "type": "stats_notification", "updated_at": 1451522691 } } } }, "security": [ { "Authorization": [] } ] } }, "/user/profile": { "get": { "operationId": "GET_user-profile", "summary": "Get a user's profile", "tags": [ "Users API" ], "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "GET User Profile response", "type": "object", "properties": { "address": { "type": "string", "description": "The user's address." }, "address2": { "type": "string", "description": "The second line of the user's address." }, "city": { "type": "string", "description": "The user's city." }, "company": { "type": "string", "description": "The name of the user's company." }, "country": { "type": "string", "description": "The user's country." }, "first_name": { "type": "string", "description": "The user's first name." }, "last_name": { "type": "string", "description": "The user's last name." }, "phone": { "type": "string", "description": "The user's phone number." }, "state": { "type": "string", "description": "The user's state." }, "website": { "type": "string", "description": "The user's website URL." }, "zip": { "type": "string", "description": "The user's zip code." } }, "required": [ "address", "city", "company", "country", "first_name", "last_name", "phone", "state", "website", "zip" ] }, "examples": { "application/json": { "address": "814 West Chapman Avenue", "address2": "", "city": "Orange", "company": "SendGrid", "country": "US", "first_name": "Test", "last_name": "User", "phone": "555-555-5555", "state": "CA", "website": "http://www.sendgrid.com", "zip": "92868" } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_user-profile", "summary": "Update a user's profile", "tags": [ "Users API" ], "description": "**This endpoint allows you to update your current profile details.**\n\nAny one or more of the parameters can be updated via the PATCH `/user/profile` endpoint. You must include at least one when you PATCH.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/user_profile", "example": { "first_name": "Example", "last_name": "User", "city": "Orange" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/user_profile" }, "examples": { "application/json": { "address": "814 West Chapman Avenue", "address2": "", "city": "Orange", "company": "SendGrid", "country": "US", "first_name": "Example", "last_name": "User", "phone": "555-555-5555", "state": "CA", "website": "http://www.sendgrid.com", "zip": "92868" } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/user/account": { "get": { "operationId": "GET_user-account", "summary": "Get a user's account information.", "tags": [ "Users API" ], "description": "**This endpoint allows you to retrieve your user account details.**\n\nYour user's account information includes the user's account type and reputation.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "GET User Account response", "type": "object", "properties": { "type": { "type": "string", "description": "The type of account for this user.", "enum": [ "free", "paid" ] }, "reputation": { "type": "number", "description": "The sender reputation for this user." } }, "required": [ "type", "reputation" ] }, "examples": { "application/json": { "reputation": 100, "type": "paid" } } } }, "security": [ { "Authorization": [] } ] } }, "/user/email": { "get": { "operationId": "GET_user-email", "summary": "Retrieve your account email address", "tags": [ "Users API" ], "description": "**This endpoint allows you to retrieve the email address currently on file for your account.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address currently on file for your account.", "format": "email" } }, "required": [ "email" ] }, "examples": { "application/json": { "email": "test@example.com" } } } }, "security": [ { "Authorization": [] } ] }, "put": { "operationId": "PUT_user-email", "summary": "Update your account email address", "tags": [ "Users API" ], "description": "**This endpoint allows you to update the email address currently on file for your account.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "The new email address that you would like to use for your account." } }, "example": { "email": "example@example.com" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "The current email address on file for your account.", "format": "email" } }, "required": [ "email" ] }, "examples": { "application/json": { "email": "example@example.com" } } } }, "security": [ { "Authorization": [] } ] } }, "/user/username": { "get": { "operationId": "GET_user-username", "summary": "Retrieve your username", "tags": [ "Users API" ], "description": "**This endpoint allows you to retrieve your current account username.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "username": { "type": "string", "description": "Your account username." }, "user_id": { "type": "integer", "description": "The user ID for your account." } }, "required": [ "username", "user_id" ] }, "examples": { "application/json": { "username": "test_username", "user_id": 1 } } } }, "security": [ { "Authorization": [] } ] }, "put": { "operationId": "PUT_user-username", "summary": "Update your username", "tags": [ "Users API" ], "description": "**This endpoint allows you to update the username for your account.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "username": { "type": "string", "description": "The new username you would like to use for your account." } }, "example": { "username": "test_username" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "username": { "type": "string", "description": "The current username on file for your account." } }, "required": [ "username" ] }, "examples": { "application/json": { "username": "test_username" } } } }, "security": [ { "Authorization": [] } ] } }, "/user/credits": { "get": { "operationId": "GET_user-credits", "summary": "Retrieve your credit balance", "tags": [ "Users API" ], "description": "**This endpoint allows you to retrieve the current credit balance for your account.**\n\nEach account has a credit balance, which is a base number of emails it can send before receiving per-email charges. For more information about credits and billing, see [Billing and Plan details information](https://sendgrid.com/docs/ui/account-and-settings/billing/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "remain": { "type": "integer", "description": "The remaining number of credits available on your account." }, "total": { "type": "integer", "description": "The total number of credits assigned to your account." }, "overage": { "type": "integer", "description": "The number of overdrawn credits for your account." }, "used": { "type": "integer", "description": "The number of credits that you have used." }, "last_reset": { "type": "string", "description": "The date that your credit balance was last reset." }, "next_reset": { "type": "string", "description": "The next date that your credit balance will be reset." }, "reset_frequency": { "type": "string", "description": "The frequency at which your credit balance will be reset." } }, "required": [ "remain", "total", "overage", "used", "last_reset", "next_reset", "reset_frequency" ] }, "examples": { "application/json": { "remain": 200, "total": 200, "overage": 0, "used": 0, "last_reset": "2013-01-01", "next_reset": "2013-02-01", "reset_frequency": "monthly" } } } }, "security": [ { "Authorization": [] } ] } }, "/user/password": { "put": { "operationId": "PUT_user-password", "summary": "Update your password", "tags": [ "Users API" ], "description": "**This endpoint allows you to update your password.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "new_password": { "type": "string", "description": "The new password you would like to use for your account." }, "old_password": { "type": "string", "description": "The old password for your account." } }, "required": [ "new_password", "old_password" ], "example": { "new_password": "new_password", "old_password": "old_password" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] } }, "/subusers": { "get": { "operationId": "GET_subusers", "summary": "List all Subusers", "tags": [ "Subusers API" ], "description": "**This endpoint allows you to retrieve a list of all of your subusers.**\n\nYou can choose to retrieve specific subusers as well as limit the results that come back from the API.", "parameters": [ { "name": "username", "in": "query", "description": "The username of this subuser.", "type": "string" }, { "name": "limit", "in": "query", "description": "The number of results you would like to get in each request.", "type": "integer" }, { "name": "offset", "in": "query", "description": "The number of subusers to skip.", "type": "integer" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/subuser" } }, "examples": { "application/json": [ { "disabled": false, "email": "example@example.com", "id": 1234, "username": "example_subuser" }, { "disabled": false, "email": "example2@example.com", "id": 1234, "username": "example_subuser2" } ] } }, "401": { "description": "Unexpected error in API call. See HTTP response body for details.", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "post": { "operationId": "POST_subusers", "summary": "Create Subuser", "tags": [ "Subusers API" ], "description": "**This endpoint allows you to create a new subuser.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "username": { "type": "string", "description": "The username for this subuser." }, "email": { "type": "string", "description": "The email address of the subuser.", "format": "email" }, "password": { "type": "string", "description": "The password this subuser will use when logging into SendGrid." }, "ips": { "type": "array", "description": "The IP addresses that should be assigned to this subuser.", "items": { "type": "string", "format": "ipv4" } } }, "required": [ "username", "email", "password", "ips" ], "example": { "username": "John@example.com", "email": "John@example.com", "password": "johns_password", "ips": [ "1.1.1.1", "2.2.2.2" ] } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/subuser_post" }, "examples": { "application/json": { "username": "example_subuser", "user_id": 1234, "email": "example@example.com", "signup_session_token": "", "authorization_token": "", "credit_allocation": { "type": "unlimited" } } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "username exists" }, { "message": "unable to validate IPs at this time" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "403": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "you dont have permission to access this resource" } ] } } }, "500": { "description": "", "schema": { "type": "object" }, "examples": { "application/json": { "errors": [ { "message": "unable to validate IPs at this time" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/subusers/{subuser_name}": { "parameters": [ { "name": "subuser_name", "in": "path", "required": true, "type": "string" } ], "patch": { "operationId": "PATCH_subusers-subuser_name", "summary": "Enable/disable a subuser", "tags": [ "Subusers API" ], "description": "**This endpoint allows you to enable or disable a subuser.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "disabled": { "type": "boolean", "description": "Whether or not this subuser is disabled. True means disabled, False means enabled." } }, "example": { "disabled": false } } } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "invalid username" }, { "message": "no fields provided" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "500": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "unable to enable user" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_subusers-subuser_name", "summary": "Delete a subuser", "tags": [ "Subusers API" ], "description": "**This endpoint allows you to delete a subuser.**\n\nThis is a permanent action. Once deleted, a subuser cannot be retrieved.", "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/subusers/reputations": { "get": { "operationId": "GET_subusers-reputations", "summary": "Retrieve Subuser Reputations", "tags": [ "Subusers API" ], "description": "**This endpoint allows you to request the reputations for your subusers.**\n\nSubuser sender reputations give a good idea how well a sender is doing with regards to how recipients and recipient servers react to the mail that is being received. When a bounce, spam report, or other negative action happens on a sent email, it will affect your sender rating.", "parameters": [ { "name": "usernames", "in": "query", "type": "string" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "reputation": { "type": "number", "description": "The sender reputation this subuser has attained." }, "username": { "type": "string", "description": "The subuser that has this reputation.f" } }, "required": [ "reputation", "username" ] } }, "examples": { "application/json": [ { "username": "example_subuser", "reputation": 99 }, { "username": "example_subuser2", "reputation": 95.2 } ] } } }, "security": [ { "Authorization": [] } ] } }, "/subusers/{subuser_name}/ips": { "parameters": [ { "name": "subuser_name", "in": "path", "required": true, "type": "string" } ], "put": { "operationId": "PUT_subusers-subuser_name-ips", "summary": "Update IPs assigned to a subuser", "tags": [ "Subusers API" ], "description": "**This endpoint allows you update your subusers' assigned IP.**\n\nEach subuser should be assigned to an IP address from which all of this subuser's mail will be sent. Often, this is the same IP as the parent account, but each subuser can have one or more of their own IP addresses as well. \n\nMore information:\n\n* [How to request more IPs](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/)\n* [Setup Reverse DNS](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/)", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "array", "description": "The IP addresses you would like to assign to the subuser.", "items": { "type": "string", "format": "ipv4" }, "example": [ "127.0.0.1" ] } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "ips": { "type": "array", "description": "The IP addresses that are assigned to the subuser.", "items": { "type": "string", "format": "ipv4" } } } }, "examples": { "application/json": { "ips": [ "127.0.0.1" ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/subusers/{subuser_name}/monitor": { "parameters": [ { "name": "subuser_name", "in": "path", "description": "The name of the subuser for which to retrieve monitor settings.", "required": true, "type": "string" } ], "get": { "operationId": "GET_subusers-subuser_name-monitor", "summary": "Retrieve monitor settings for a subuser", "tags": [ "Subuser Monitor Settings" ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/monitor" }, "examples": { "application/json": { "email": "example@example.com", "frequency": 500 } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "No monitor settings for this user" } ] } } } }, "security": [ { "Authorization": [] } ] }, "post": { "operationId": "POST_subusers-subuser_name-monitor", "summary": "Create monitor settings", "tags": [ "Subuser Monitor Settings" ], "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/monitor", "example": { "email": "example@example.com", "frequency": 50000 } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/monitor" }, "examples": { "application/json": { "email": "example@example.com", "frequency": 50000 } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "User already has a monitor" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "put": { "operationId": "PUT_subusers-subuser_name-monitor", "summary": "Update Monitor Settings for a subuser", "tags": [ "Subuser Monitor Settings" ], "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/monitor", "example": { "email": "example@example.com", "frequency": 500 } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/monitor" }, "examples": { "application/json": { "email": "example@example.com", "frequency": 500 } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "email", "message": "Email is required" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_subusers-subuser_name-monitor", "summary": "Delete monitor settings", "tags": [ "Subuser Monitor Settings" ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "No monitor settings for this user" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/subusers/{subuser_name}/stats/monthly": { "parameters": [ { "name": "subuser_name", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_subusers-subuser_name-stats-monthly", "summary": "Retrieve the monthly email statistics for a single subuser", "tags": [ "Subuser Statistics" ], "description": "**This endpoint allows you to retrive the monthly email statistics for a specific subuser.**\n\nWhen using the `sort_by_metric` to sort your stats by a specific metric, you can not sort by the following metrics:\n`bounce_drops`, `deferred`, `invalid_emails`, `processed`, `spam_report_drops`, `spam_reports`, or `unsubscribe_drops`.", "parameters": [ { "name": "date", "in": "query", "description": "The date of the month to retrieve statistics for. Must be formatted YYYY-MM-DD", "required": true, "type": "string" }, { "name": "sort_by_metric", "in": "query", "description": "The metric that you want to sort by. Metrics that you can sort by are: `blocks`, `bounces`, `clicks`, `delivered`, `opens`, `requests`, `unique_clicks`, `unique_opens`, and `unsubscribes`.'", "required": false, "type": "string", "default": "delivered" }, { "name": "sort_by_direction", "in": "query", "description": "The direction you want to sort.", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "limit", "in": "query", "description": "Optional field to limit the number of results returned.", "required": false, "type": "integer", "default": 5 }, { "name": "offset", "in": "query", "description": "Optional beginning point in the list to retrieve from.", "required": false, "type": "integer", "default": 0 } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/subuser_stats" }, "examples": { "application/json": { "date": "2016-02-01", "stats": [ { "first_name": "John", "last_name": "Doe", "metrics": { "blocks": 0, "bounce_drops": 0, "bounces": 0, "clicks": 5, "deferred": 0, "delivered": 0, "invalid_emails": 0, "opens": 10, "processed": 10, "requests": 10, "spam_report_drops": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0, "unsubscribe_drops": 0, "unsubscribes": 0 }, "name": "user1", "type": "subuser" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/subusers/stats/monthly": { "get": { "operationId": "GET_subusers-stats-monthly", "summary": "Retrieve monthly stats for all subusers", "tags": [ "Subuser Statistics" ], "description": "**This endpoint allows you to retrieve the monthly email statistics for all subusers over the given date range.**\n\nWhen using the `sort_by_metric` to sort your stats by a specific metric, you can not sort by the following metrics:\n`bounce_drops`, `deferred`, `invalid_emails`, `processed`, `spam_report_drops`, `spam_reports`, or `unsubscribe_drops`.", "parameters": [ { "name": "date", "in": "query", "description": "The date of the month to retrieve statistics for. Must be formatted YYYY-MM-DD", "required": true, "type": "string" }, { "name": "subuser", "in": "query", "description": "A substring search of your subusers.", "required": false, "type": "string" }, { "name": "sort_by_metric", "in": "query", "description": "The metric that you want to sort by. Metrics that you can sort by are: `blocks`, `bounces`, `clicks`, `delivered`, `opens`, `requests`, `unique_clicks`, `unique_opens`, and `unsubscribes`.'", "required": false, "type": "string", "default": "delivered", "enum": [ "blocks", "bounces", "clicks", "delivered", "opens", "requests", "unique_clicks", "unique_opens", "unsubscribes" ] }, { "name": "sort_by_direction", "in": "query", "description": "The direction you want to sort.", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "limit", "in": "query", "description": "Optional field to limit the number of results returned.", "required": false, "type": "integer", "default": 5 }, { "name": "offset", "in": "query", "description": "Optional beginning point in the list to retrieve from.", "required": false, "type": "integer", "default": 0 } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/subuser_stats" }, "examples": { "application/json": { "date": "2016-02-01", "stats": [ { "first_name": "John", "last_name": "Doe", "metrics": { "blocks": 0, "bounce_drops": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "invalid_emails": 0, "opens": 1, "processed": 0, "requests": 100, "spam_report_drops": 0, "spam_reports": 99, "unique_clicks": 0, "unique_opens": 0, "unsubscribe_drops": 0, "unsubscribes": 0 }, "name": "user1", "type": "subuser" }, { "first_name": "Jane", "last_name": "Doe", "metrics": { "blocks": 0, "bounce_drops": 0, "bounces": 0, "clicks": 5, "deferred": 0, "delivered": 0, "invalid_emails": 0, "opens": 10, "processed": 10, "requests": 10, "spam_report_drops": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0, "unsubscribe_drops": 0, "unsubscribes": 0 }, "name": "user2", "type": "subuser" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/subusers/stats/sums": { "get": { "operationId": "GET_subusers-stats-sums", "summary": "Retrieve the totals for each email statistic metric for all subusers.", "tags": [ "Subuser Statistics" ], "description": "**This endpoint allows you to retrieve the total sums of each email statistic metric for all subusers over the given date range.**", "parameters": [ { "name": "sort_by_direction", "in": "query", "description": "The direction you want to sort. ", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "start_date", "in": "query", "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", "required": true, "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, "type": "string" }, { "name": "limit", "in": "query", "description": "Limits the number of results returned per page.", "required": false, "type": "integer", "default": 5 }, { "name": "offset", "in": "query", "description": "The point in the list to begin retrieving results from.", "required": false, "type": "integer", "default": 0 }, { "name": "aggregated_by", "in": "query", "description": "How to group the statistics. Defaults to today. Must follow format YYYY-MM-DD.", "required": false, "type": "string" }, { "name": "sort_by_metric", "in": "query", "description": "The metric that you want to sort by. Must be a single metric.", "required": false, "type": "string", "default": "delivered" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/category_stats" }, "examples": { "application/json": { "date": "2015-10-11", "stats": [] } } } }, "security": [ { "Authorization": [] } ] } }, "/subusers/stats": { "get": { "operationId": "GET_subusers-stats", "summary": "Retrieve email statistics for your subusers.", "tags": [ "Subuser Statistics" ], "description": "**This endpoint allows you to retrieve the email statistics for the given subusers.**\n\nYou may retrieve statistics for up to 10 different subusers by including an additional _subusers_ parameter for each additional subuser.", "parameters": [ { "name": "limit", "in": "query", "description": "Limits the number of results returned per page.", "required": false, "type": "integer" }, { "name": "offset", "in": "query", "description": "The point in the list to begin retrieving results from.", "required": false, "type": "integer" }, { "name": "aggregated_by", "in": "query", "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", "required": false, "type": "string", "enum": [ "day", "week", "month" ] }, { "name": "subusers", "in": "query", "description": "The subuser you want to retrieve statistics for. You may include this parameter up to 10 times to retrieve statistics for multiple subusers.", "required": true, "type": "string" }, { "name": "start_date", "in": "query", "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", "required": true, "type": "string" }, { "name": "end_date", "in": "query", "description": "The end date of the statistics to retrieve. Defaults to today.", "required": false, "type": "string" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/category_stats" }, "examples": { "application/json": [ { "date": "2015-10-01", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-02", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-03", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-04", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-05", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-06", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-07", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-08", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-09", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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-10-10", "stats": [ { "type": "subuser", "name": "Matt_subuser", "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 } } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/links": { "post": { "operationId": "POST_whitelabel-links", "summary": "Create a branded link", "tags": [ "Link branding" ], "description": "**This endpoint allows you to create a new branded link.**\n\nTo create the link branding, supply the root domain and, optionally, the subdomain — these go into separate fields in your request body. The root domain should match your FROM email address. If you provide a subdomain, it must be different from the subdomain you used for authenticating your domain.\n\nYou can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "domain": { "type": "string", "description": "The root domain for the subdomain that you are creating the link branding for. This should match your FROM email address." }, "subdomain": { "type": "string", "description": "The subdomain to create the link branding for. Must be different from the subdomain you used for authenticating your domain." }, "default": { "type": "boolean", "description": "Indicates if you want to use this link branding as the default or fallback. When setting a new default, the existing default link branding will have its default status removed automatically.", "enum": [ true, false ] } }, "required": [ "domain" ], "example": { "domain": "example.com", "subdomain": "mail", "default": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/link_branding_200_response" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "john@example.com", "user_id": 7, "default": false, "valid": true, "legacy": false, "dns": { "domain_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "sendgrid.net" }, "owner_cname": { "valid": true, "type": "cname", "host": "7.example.com", "data": "sendgrid.net" } } } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_whitelabel-links", "summary": "Retrieve all branded links", "tags": [ "Link branding" ], "description": "**This endpoint allows you to retrieve all branded links**.\n\nYou can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.", "parameters": [ { "name": "limit", "in": "query", "description": "Limits the number of results returned per page.", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/link_branding_200_response" } }, "examples": { "application/json": [ { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "john@example.com", "user_id": 7, "default": true, "valid": true, "legacy": false, "dns": { "domain_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "sendgrid.net" }, "owner_cname": { "valid": true, "type": "cname", "host": "7.example.com", "data": "sendgrid.net" } } }, { "id": 2, "domain": "example2.com", "subdomain": "news", "username": "john@example.com", "user_id": 8, "default": false, "valid": false, "legacy": false, "dns": { "domain_cname": { "valid": true, "type": "cname", "host": "news.example2.com", "data": "sendgrid.net" }, "owner_cname": { "valid": false, "type": "cname", "host": "8.example2.com", "data": "sendgrid.net" } } } ] } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/links/{id}/validate": { "parameters": [ { "name": "id", "in": "path", "description": "The ID of the branded link that you want to validate.", "required": true, "type": "integer" } ], "post": { "operationId": "POST_whitelabel-links-id-validate", "summary": "Validate a branded link", "tags": [ "Link branding" ], "description": "**This endpoint allows you to validate a branded link.**\n\nYou can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the branded link." }, "valid": { "type": "boolean", "description": "Indicates if the link branding is valid.", "enum": [ true, false ] }, "validation_results": { "type": "object", "description": "The individual validation results for each of the DNS records associated with this branded link.", "required": [ "domain_cname" ], "properties": { "domain_cname": { "type": "object", "description": "The DNS record generated for the sending domain used for this branded link.", "required": [ "valid", "reason" ], "properties": { "valid": { "type": "boolean", "description": "Indicates if this DNS record is valid.", "enum": [ true, false ] }, "reason": { "type": "string", "nullable": true, "description": "Null if the DNS record is valid. If the DNS record is invalid, this will explain why." } } }, "owner_cname": { "type": "object", "description": "The DNS record created to verify the branded link.", "properties": { "valid": { "type": "boolean", "description": "Indicates if the DNS record is valid.", "enum": [ true, false ] }, "reason": { "type": "string", "nullable": true, "description": "Null if valid. If the DNS record is invalid, this will explain why." } }, "required": [ "valid", "reason" ] } } } }, "required": [ "id", "valid", "validation_results" ] }, "examples": { "application/json": { "id": 1, "valid": true, "validation_results": { "domain_cname": { "valid": false, "reason": "Expected CNAME to match \"sendgrid.net.\" but found \"example.com.\"." }, "owner_cname": { "valid": true, "reason": null } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "description": "The reasons why the validation failed.", "items": { "type": "object", "properties": { "message": { "type": "string", "description": "The reason why the link whitelabel could not be validated." } }, "required": [ "message" ] } } }, "required": [ "errors" ] }, "examples": { "application/json": { "errors": [ { "message": "internal error getting CNAME" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/links/{link_id}/subuser": { "parameters": [ { "name": "link_id", "in": "path", "description": "The ID of the branded link you want to associate.", "required": true, "type": "integer" } ], "post": { "operationId": "POST_whitelabel-links-link_id-subuser", "summary": "Associate a branded link with a subuser", "tags": [ "Link branding" ], "description": "**This endpoint allows you to associate a branded link with a subuser account.**\n\nLink branding can be associated with subusers from the parent account. This functionality allows subusers to send mail using their parent's link branding. To associate link branding, the parent account must first create a branded link and validate it. The parent may then associate that branded link with a subuser via the API or the [Subuser Management page of the Twilio SendGrid App](https://app.sendgrid.com/settings/subusers).", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "username": { "type": "string", "description": "The username of the subuser account that you want to associate the branded link with." } }, "example": { "username": "jane@example.com" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/link_branding_200_response" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "john@example.com", "user_id": 7, "default": false, "valid": true, "legacy": false, "dns": { "domain_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "sendgrid.net" }, "owner_cname": { "valid": true, "type": "cname", "host": "7.example.com", "data": "sendgrid.net" } } } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/links/{id}": { "parameters": [ { "name": "id", "in": "path", "description": "The ID of the branded link you want to retrieve.", "required": true, "type": "integer" } ], "get": { "operationId": "GET_whitelabel-links-id", "summary": "Retrieve a branded link", "tags": [ "Link branding" ], "description": "**This endpoint allows you to retrieve a specific branded link by providing its ID.**\n\nYou can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/link_branding_200_response" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "john@example.com", "user_id": 7, "default": false, "valid": true, "legacy": false, "dns": { "domain_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "sendgrid.net" }, "owner_cname": { "valid": true, "type": "cname", "host": "7.example.com", "data": "sendgrid.net" } } } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_whitelabel-links-id", "summary": "Update a branded link", "tags": [ "Link branding" ], "description": "**This endpoint allows you to update a specific branded link. You can use this endpoint to change a branded link's default status.**\n\nYou can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "default": { "type": "boolean", "description": "Indicates if the branded link is set as the default. When setting a new default, the existing default link branding will have its default status removed automatically.", "enum": [ true, false ] } }, "example": { "default": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/link_branding_200_response" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "john@example.com", "user_id": 7, "default": true, "valid": true, "legacy": false, "dns": { "domain_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "sendgrid.net" }, "owner_cname": { "valid": true, "type": "cname", "host": "7.example.com", "data": "sendgrid.net" } } } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_whitelabel-links-id", "summary": "Delete a branded link", "tags": [ "Link branding" ], "description": "**This endpoint allows you to delete a branded link.**\n\nYour request will receive a response with a 204 status code if the deletion was successful. The call does not return the link's details, so if you wish to record these make sure you call the \"Retrieve a branded link\" endpoint *before* you request its deletion.\n\nYou can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/links/default": { "get": { "operationId": "GET_whitelabel-links-default", "summary": "Retrieve the default branded link", "tags": [ "Link branding" ], "description": "**This endpoint allows you to retrieve the default branded link.**\n\nThe default branded link is the actual URL to be used when sending messages. If you have more than one branded link, the default is determined by the following order:\n\n* The validated branded link marked as `default` (set when you call the \"Create a branded link\" endpoint or by calling the \"Update a branded link\" endpoint on an existing link)\n* Legacy branded links (migrated from the whitelabel wizard)\n* Default SendGrid-branded links (i.e., `100.ct.sendgrid.net`)\n\nYou can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.", "parameters": [ { "name": "domain", "in": "query", "description": "The domain to match against when finding the default branded link.", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/link_branding_200_response" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "john@example.com", "user_id": 7, "default": false, "valid": true, "legacy": false, "dns": { "domain_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "sendgrid.net" }, "owner_cname": { "valid": true, "type": "cname", "host": "7.example.com", "data": "sendgrid.net" } } } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/links/subuser": { "get": { "operationId": "GET_whitelabel-links-subuser", "summary": "Retrieve a subuser's branded link", "tags": [ "Link branding" ], "description": "**This endpoint allows you to retrieve the branded link associated with a subuser.**\n\nLink branding can be associated with subusers from the parent account. This functionality allows subusers to send mail using their parent's link branding. To associate link branding, the parent account must first create a branded link and then validate it. The parent may then associate that branded link with a subuser via the API or the [Subuser Management page of the Twilio SendGrid App](https://app.sendgrid.com/settings/subusers).", "parameters": [ { "name": "username", "in": "query", "description": "The username of the subuser to retrieve associated branded links for.", "required": true, "type": "string" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/link_branding_200_response" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "john@example.com", "user_id": 7, "default": false, "valid": true, "legacy": false, "dns": { "domain_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "sendgrid.net" }, "owner_cname": { "valid": true, "type": "cname", "host": "7.example.com", "data": "sendgrid.net" } } } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_whitelabel-links-subuser", "summary": "Disassociate a branded link from a subuser", "tags": [ "Link branding" ], "description": "**This endpoint allows you to take a branded link away from a subuser.**\n\nLink branding can be associated with subusers from the parent account. This functionality allows subusers to send mail using their parent's link branding. To associate link branding, the parent account must first create a branded link and validate it. The parent may then associate that branded link with a subuser via the API or the [Subuser Management page of the Twilio SendGrid App](https://app.sendgrid.com/settings/subusers).\n\nYour request will receive a response with a 204 status code if the disassociation was successful.", "parameters": [ { "name": "username", "in": "query", "description": "The username of the subuser account that you want to disassociate a branded link from.", "required": true, "type": "string" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/ips/warmup": { "post": { "operationId": "POST_ips-warmup", "summary": "Start warming up an IP address", "tags": [ "IP Warmup" ], "description": "**This endpoint allows you to put an IP address into warmup mode.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "ip": { "type": "string", "description": "The IP address that you want to begin warming up." } }, "example": { "ip": "0.0.0.0" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/ip_warmup_response" }, "examples": { "application/json": [ { "ip": "0.0.0.0", "start_date": 1409616000 } ] } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "description": "The errors that were encountered.", "items": { "type": "object", "properties": { "field": { "type": "null" }, "message": { "type": "string", "description": "A message explaining why the IP couldn't entered into warmup mode." } } } } } }, "examples": { "application/json": { "errors": [ { "field": null, "message": "resource not found" } ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_ips-warmup", "summary": "Retrieve all IPs currently in warmup", "tags": [ "IP Warmup" ], "description": "**This endpoint allows you to retrieve all of your IP addresses that are currently warming up.**", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/ip_warmup_response" }, "examples": { "application/json": [ { "ip": "0.0.0.0", "start_date": 1409616000 } ] } } }, "security": [ { "Authorization": [] } ] } }, "/ips/warmup/{ip_address}": { "parameters": [ { "name": "ip_address", "in": "path", "description": "The IP address that you want to retrieve the warmup status for.", "required": true, "type": "string" } ], "get": { "operationId": "GET_ips-warmup-ip_address", "summary": "Retrieve the warmup status for a specific IP address", "tags": [ "IP Warmup" ], "description": "**This endpoint allows you to retrieve the warmup status for a specific IP address.**\n\nYou can retrieve all of your warming IPs using the \"Retrieve all IPs currently in warmup\" endpoint.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/ip_warmup_response" }, "examples": { "application/json": [ { "ip": "0.0.0.0", "start_date": 1409616000 } ] } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "description": "The errors that were encountered.", "items": { "type": "object", "properties": { "field": { "type": "null" }, "message": { "type": "string", "description": "A message explaining why the warmup status could not be retrieved." } } } } } }, "examples": { "application/json": { "errors": [ { "field": null, "message": "resource not found" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_ips-warmup-ip_address", "summary": "Stop warming up an IP address", "tags": [ "IP Warmup" ], "description": "**This endpoint allows you to remove an IP address from warmup mode.**\n\nYour request will return a 204 status code if the specified IP was successfully removed from warmup mode. To retrieve details of the IP’s warmup status *before* removing it from warmup mode, call the \"Retrieve the warmpup status for a specific IP address\" endpoint.", "responses": { "204": { "description": "", "schema": { "type": "object" } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "description": "The errors that were encountered.", "items": { "type": "object", "properties": { "field": { "type": "null" }, "message": { "type": "string", "description": "A message explaining why the IP couldn't be removed from warmup." } } } } } }, "examples": { "application/json": { "errors": [ { "field": null, "message": "resource not found" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/ips": { "post": { "operationId": "POST_whitelabel-ips", "summary": "Set up reverse DNS", "tags": [ "Reverse DNS" ], "description": "**This endpoint allows you to set up reverse DNS.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "ip": { "type": "string", "description": "The IP address for which you want to set up reverse DNS." }, "subdomain": { "type": "string", "description": "The subdomain that will be used to send emails from the IP address. This should be the same as the subdomain used to set up an authenticated domain." }, "domain": { "type": "string", "description": "The root, or sending, domain that will be used to send message from the IP address." } }, "required": [ "ip", "domain" ], "example": { "ip": "192.168.1.1", "subdomain": "email", "domain": "example.com" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/reverse_dns" }, "examples": { "application/json": { "id": 123, "ip": "192.168.1.2", "rdns": "o1.email.example.com", "users": [], "subdomain": "email", "domain": "example.com", "valid": true, "legacy": false, "a_record": { "valid": true, "type": "a", "host": "o1.email.example.com", "data": "192.168.1.2" } } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_whitelabel-ips", "summary": "Retrieve all reverse DNS records", "tags": [ "Reverse DNS" ], "description": "**This endpoint allows you to retrieve all of the Reverse DNS records created by this account.**\n\nYou may include a search key by using the `ip` query string parameter. This enables you to perform a prefix search for a given IP segment (e.g., `?ip=\"192.\"`).\n\nUse the `limit` query string parameter to reduce the number of records returned. All records will be returned if you have fewer records than the specified limit.\n\nThe `offset` query string parameter allows you to specify a non-zero index from which records will be returned. For example, if you have ten records, `?offset=5` will return the last five records (at indexes 5 through 9). The list starts at index zero.", "parameters": [ { "name": "limit", "in": "query", "description": "The maximum number of results to retrieve.", "type": "integer" }, { "name": "offset", "in": "query", "description": "The point in the list of results to begin retrieving IP addresses from.", "type": "integer" }, { "name": "ip", "in": "query", "description": "The IP address segment that you'd like to use in a prefix search.", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/reverse_dns" } }, "examples": { "application/json": [ { "id": 1, "ip": "192.168.1.1", "rdns": "o1.email.example.com", "users": [ { "username": "john@example.com", "user_id": 7 }, { "username": "jane@example.com", "user_id": 8 } ], "subdomain": "email", "domain": "example.com", "valid": true, "legacy": false, "a_record": { "valid": true, "type": "a", "host": "o1.email.example.com", "data": "192.168.1.1" } }, { "id": 2, "ip": "192.168.1.2", "rdns": "o2.email.example.com", "users": [ { "username": "john@example.com", "user_id": 7 }, { "username": "jane@example2.com", "user_id": 9 } ], "subdomain": "email", "domain": "example.com", "valid": true, "legacy": false, "a_record": { "valid": true, "type": "a", "host": "o2.email.example.com", "data": "192.168.1.2" } } ] } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/ips/{id}/validate": { "parameters": [ { "name": "id", "in": "path", "description": "The ID of the reverse DNS record that you would like to validate.", "required": true, "type": "string" } ], "post": { "operationId": "POST_whitelabel-ips-id-validate", "summary": "Validate a reverse DNS record", "tags": [ "Reverse DNS" ], "description": "**This endpoint allows you to validate a reverse DNS record.**\n\nAlways check the `valid` property of the response’s `validation_results.a_record` object. This field will indicate whether it was possible to validate the reverse DNS record. If the `validation_results.a_record.valid` is `false`, this indicates only that Twilio SendGrid could not determine the validity your reverse DNS record — it may still be valid.\n\nIf validity couldn’t be determined, you can check the value of `validation_results.a_record.reason` to find out why.\n\nYou can retrieve the IDs associated with all your reverse DNS records using the \"Retrieve all reverse DNS records\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the reverse DNS record." }, "valid": { "type": "boolean", "description": "Indicates if the reverse DNS record is valid.", "enum": [ true, false ] }, "validation_results": { "type": "object", "description": "The specific results of the validation.", "properties": { "a_record": { "type": "object", "properties": { "valid": { "type": "boolean", "description": "Indicates if the reverse DNS record could be validated.", "enum": [ true, false ] }, "reason": { "type": [ "null", "string" ], "description": "The reason the reverse DNS record could not be validated. Is `null` if the reverse DNS record was validated." } }, "required": [ "valid", "reason" ] } } } }, "required": [ "id", "valid", "validation_results" ] }, "examples": { "application/json": { "id": 123456, "valid": false, "validation_results": { "a_record": { "valid": false, "reason": "Failed to resolve A Record at o1.ptr4283.example.com: lookup o1.ptr4283.example.com on 192.168.0.10:53: no such host" } } } } }, "404": { "description": "Unexpected error in API call. See HTTP response body for details.", "schema": { "type": "object", "properties": { "errors": { "type": "array", "description": "The error messages for the failed validation.", "items": { "type": "object", "properties": { "message": { "type": "string", "description": "A message describing why the reverse DNS could not be validated." } }, "required": [ "message" ] } } }, "required": [ "errors" ] }, "examples": { "application/json": { "errors": [ { "message": "Reverse DNS record not found." } ] } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "description": "The error messages for the failed validation.", "items": { "type": "object", "properties": { "message": { "type": "string", "description": "A message describing why the IP whitelabel could not be validated." } }, "required": [ "message" ] } } }, "required": [ "errors" ] }, "examples": { "application/json": { "errors": [ { "message": "internal error getting rDNS" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/ips/{id}": { "parameters": [ { "name": "id", "in": "path", "description": "The ID of the reverse DNS record that you would like to retrieve.", "required": true, "type": "string" } ], "get": { "operationId": "GET_whitelabel-ips-id", "summary": "Retrieve a reverse DNS record", "tags": [ "Reverse DNS" ], "description": "**This endpoint allows you to retrieve a reverse DNS record.**\n\nYou can retrieve the IDs associated with all your reverse DNS records using the \"Retrieve all reverse DNS records\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/reverse_dns" }, "examples": { "application/json": { "id": 123, "ip": "192.168.1.1", "rdns": "o1.email.example.com", "users": [ { "username": "john@example.com", "user_id": 7 } ], "subdomain": "email", "domain": "example.com", "valid": true, "legacy": false, "a_record": { "valid": true, "type": "a", "host": "o1.email.example.com", "data": "192.168.1.1" } } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_whitelabel-ips-id", "summary": "Delete a reverse DNS record", "tags": [ "Reverse DNS" ], "description": "**This endpoint allows you to delete a reverse DNS record.**\n\nA call to this endpoint will respond with a 204 status code if the deletion was successful.\n\nYou can retrieve the IDs associated with all your reverse DNS records using the \"Retrieve all reverse DNS records\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/validations/email": { "post": { "operationId": "POST_validations-email", "summary": "Validate an email", "tags": [ "Email Address Validation" ], "description": "**This endpoint allows you to validate an email address.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address that you want to validate." }, "source": { "type": "string", "description": "A one-word classifier for where this validation originated." } }, "required": [ "email" ], "example": { "email": "example@example.com", "source": "signup" } } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "object", "required": [ "email", "verdict", "score", "local", "host", "checks", "ip_address" ], "properties": { "email": { "type": "string", "description": "The email being validated", "format": "email" }, "verdict": { "type": "string", "description": "A generic classification of whether or not the email address is valid.", "enum": [ "Valid", "Risky", "Invalid" ] }, "score": { "type": "number", "description": "A numeric representation of the email validity." }, "local": { "type": "string", "description": "The local part of the email address." }, "host": { "type": "string", "description": "The domain of the email address.", "format": "hostname" }, "suggestion": { "type": "string", "description": "A suggested correction in the event of domain name typos (e.g., gmial.com)" }, "checks": { "type": "object", "description": "Granular checks for email address validity.", "required": [ "domain", "local_part", "additional" ], "properties": { "domain": { "type": "object", "description": "Checks on the domain portion of the email address.", "required": [ "has_valid_address_syntax", "has_mx_or_a_record", "is_suspected_disposable_address" ], "properties": { "has_valid_address_syntax": { "type": "boolean", "description": "Whether the email address syntax is valid." }, "has_mx_or_a_record": { "type": "boolean", "description": "Whether the email has appropriate DNS records to deliver a message. " }, "is_suspected_disposable_address": { "type": "boolean", "description": "Whether the domain appears to be from a disposable email address service." } } }, "local_part": { "type": "object", "description": "Checks on the local part of the email address.", "required": [ "is_suspected_role_address" ], "properties": { "is_suspected_role_address": { "type": "boolean", "description": "Whether the local part of email appears to be a role or group (e.g., hr, admin)" } } }, "additional": { "type": "object", "description": "Additional checks on the email address.", "required": [ "has_known_bounces", "has_suspected_bounces" ], "properties": { "has_known_bounces": { "type": "boolean", "description": "WHether email sent to this address from your account has bounced." }, "has_suspected_bounces": { "type": "boolean", "description": "Whether our model predicts that the email address might bounce." } } } } }, "source": { "type": "string", "description": "The source of the validation, as per the API request." }, "ip_address": { "type": "string", "description": "The IP address associated with this email." } } } }, "required": [ "result" ] }, "examples": { "application/json": { "result": { "email": "cedric@fogowl.com", "verdict": "Valid", "score": 0.85021, "local": "cedric", "host": "fogowl.com", "checks": { "domain": { "has_valid_address_syntax": true, "has_mx_or_a_record": true, "is_suspected_disposable_address": false }, "local_part": { "is_suspected_role_address": false }, "additional": { "has_known_bounces": false, "has_suspected_bounces": false } }, "ip_address": "192.168.1.1" } } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/dns/email": { "post": { "operationId": "POST_whitelabel-dns-email", "summary": "Email DNS records to a co-worker", "tags": [ "Email CNAME records" ], "description": "**This endpoint is used to share DNS records with a colleagues**\n\nUse this endpoint to send SendGrid-generated DNS record information to a co-worker so they can enter it into your DNS provider to validate your domain and link branding. \n\nWhat type of records are sent will depend on whether you have chosen Automated Security or not. When using Automated Security, SendGrid provides you with three CNAME records. If you turn Automated Security off, you are instead given TXT and MX records.\n\nIf you pass a `link_id` to this endpoint, the generated email will supply the DNS records necessary to complete [Link Branding](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) setup. If you pass a `domain_id` to this endpoint, the generated email will supply the DNS records needed to complete [Domain Authentication](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Passing both IDs will generate an email with the records needed to complete both setup steps.\n\nYou can retrieve all your domain IDs from the returned `id` fields for each domain using the \"List all authenticated domains\" endpoint. You can retrieve all of your link IDs using the \"Retrieve all branded links\" endpoint.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "link_id": { "type": "integer", "minimum": 0, "desc": "The ID of the branded link." }, "domain_id": { "type": "integer", "minimum": 0, "description": "The ID of your SendGrid domain record." }, "email": { "type": "string", "format": "email", "description": "The email address to send the DNS information to." }, "message": { "type": "string", "default": "Please set these DNS records in our hosting solution.", "description": "A custom text block to include in the email body sent with the records." } }, "required": [ "link_id", "domain_id", "email" ], "example": { "link_id": 29719392, "domain_id": 46873408, "email": "my_colleague@example.com", "message": "DNS Record for verification" } } } ], "responses": { "204": { "description": "" }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "object", "properties": { "error": { "type": "string" }, "field": { "type": "string" } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/ips/pools": { "post": { "operationId": "POST_ips-pools", "summary": "Create an IP pool", "tags": [ "IP Pools" ], "description": "**This endpoint allows you to create an IP pool.**\n\nBefore you can create an IP pool, you need to activate the IP in your SendGrid account: \n\n1. Log into your SendGrid account. \n1. Navigate to **Settings** and then select **IP Addresses**. \n1. Find the IP address you want to activate and then click **Edit**. \n1. Check **Allow my account to send mail using this IP address**.\n1. Click **Save**.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "The name of your new IP pool.", "maxLength": 64 } }, "required": [ "name" ], "example": { "name": "marketing" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/ip_pool_response" }, "examples": { "application/json": { "name": "marketing" } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_ips-pools", "summary": "Retrieve all IP pools", "tags": [ "IP Pools" ], "description": "**This endpoint allows you to get all of your IP pools.**", "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/ip_pool_response" } }, "examples": { "application/json": [ { "name": "marketing" }, { "name": "transactional" } ] } } }, "security": [ { "Authorization": [] } ] } }, "/ips/pools/{pool_name}/ips": { "parameters": [ { "name": "pool_name", "in": "path", "description": "The name of the IP pool you want to add the address to. If the name contains spaces, they must be URL encoded (e.g., \"Test Pool\" becomes \"Test%20Pool\").", "required": true, "type": "string" } ], "post": { "operationId": "POST_ips-pools-pool_name-ips", "summary": "Add an IP address to a pool", "tags": [ "IP Pools" ], "description": "**This endpoint allows you to add an IP address to an IP pool.**\n\nYou can add the same IP address to multiple pools. It may take up to 60 seconds for your IP address to be added to a pool after your request is made.\n\nBefore you can add an IP to a pool, you need to activate it in your SendGrid account:\n\n1. Log into your SendGrid account. \n1. Navigate to **Settings** and then select **IP Addresses**. \n1. Find the IP address you want to activate and then click **Edit**. \n1. Check **Allow my account to send mail using this IP address**.\n1. Click **Save**.\n\nYou can retrieve all of your available IP addresses from the \"Retrieve all IP addresses\" endpoint.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "ip": { "type": "string", "description": "The IP address that you want to add to the named pool." } }, "example": { "ip": "0.0.0.0" } } } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "ip": { "type": "string", "description": "The IP address." }, "pools": { "type": "array", "description": "The IP pools that this IP address has been added to.", "items": { "type": "string" } }, "start_date": { "type": "integer", "description": "A Unix timestamp indicating when the warmup process began for the added IP address." }, "warmup": { "type": "boolean", "description": "Indicates if the IP address is in warmup." } }, "required": [ "ip", "pools", "start_date", "warmup" ] }, "examples": { "application/json": { "ip": "000.00.00.0", "pools": [ "test1" ], "start_date": 1409616000, "warmup": true } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "description": "The error returned.", "items": { "type": "object", "properties": { "field": { "type": "null" }, "message": { "type": "string", "description": "A message explaining why the IP address could not be added to the IP Pool." } } } } } }, "examples": { "application/json": { "errors": [ { "field": null, "message": "resource not found" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/ips/pools/{pool_name}": { "parameters": [ { "name": "pool_name", "in": "path", "description": "The name of the IP pool that you want to retrieve the IP addresses for.", "required": true, "type": "string" } ], "get": { "operationId": "GET_ips-pools-pool_name", "summary": "Retrieve all the IPs in a specified pool", "tags": [ "IP Pools" ], "description": "**This endpoint allows you to get all of the IP addresses that are in a specific IP pool.**", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "pool_name": { "type": "string", "description": "The name of the IP pool.", "maxLength": 64 }, "ips": { "description": "The IP addresses that belong to this pool.", "type": "array", "items": { "type": "string" } } } }, "examples": { "application/json": { "pool_name": "Sample", "ips": [ "192.168.1.1", "192.158.1.2", "192.138.2.1" ] } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string", "description": "The name of the error." }, "message": { "type": "string", "description": "A message explaining why the IP addresses could not be listed." } } } } } }, "examples": { "application/json": { "errors": [ { "field": "error", "message": "Unable to locate specified IPs Pool" } ] } } } }, "security": [ { "Authorization": [] } ] }, "put": { "operationId": "PUT_ips-pools-pool_name", "summary": "Rename an IP pool", "tags": [ "IP Pools" ], "description": "**This endpoint allows you to update the name of an IP pool.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "The new name for your IP pool.", "maxLength": 64 } }, "example": { "name": "new_pool_name" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/ip_pool_response" }, "examples": { "application/json": { "name": "new_pool_name" } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "null" }, "message": { "type": "string", "description": "A message explaining why the name of your IP pool could not be updated." } } } } } }, "examples": { "application/json": { "errors": [ { "field": null, "message": "ip pool not found" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_ips-pools-pool_name", "summary": "Delete an IP pool", "tags": [ "IP Pools" ], "description": "**This endpoint allows you to delete an IP pool.**", "responses": { "204": { "description": "", "schema": { "type": "object" } }, "404": { "description": "", "schema": { "type": "object", "properties": { "error": { "type": "string", "description": "An error explaining why the pool could not be deleted." } } }, "examples": { "application/json": { "error": "Unable to locate specified IPs Pool" } } } }, "security": [ { "Authorization": [] } ] } }, "/ips/pools/{pool_name}/ips/{ip}": { "parameters": [ { "name": "pool_name", "in": "path", "description": "The name of the IP pool that you are removing the IP address from.", "required": true, "type": "string" }, { "name": "ip", "in": "path", "description": "The IP address that you wish to remove.", "required": true, "type": "string" } ], "delete": { "operationId": "DELETE_ips-pools-pool_name-ips-ip", "summary": "Remove an IP address from a pool", "tags": [ "IP Pools" ], "description": "**This endpoint allows you to remove an IP address from an IP pool.**", "responses": { "204": { "description": "", "schema": { "type": "object" } }, "404": { "description": "", "schema": { "type": "object", "properties": { "error": { "type": "string", "description": "An error explaining why the IP address could not be removed from the IP pool." } } }, "examples": { "application/json": { "error": "Unable to locate specified IPs Pool" } } } }, "security": [ { "Authorization": [] } ] } }, "/ips": { "post": { "operationId": "POST_ips", "summary": "Add IPs", "tags": [ "IP Addresses" ], "description": "**This endpoint is for adding a(n) IP Address(es) to your account.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "count": { "type": "integer", "description": "The amount of IPs to add to the account." }, "subusers": { "type": "array", "description": "Array of usernames to be assigned a send IP.", "items": { "type": "string" } }, "warmup": { "type": "boolean", "default": false, "description": "Whether or not to warmup the IPs being added." } }, "required": [ "count" ], "example": { "count": 90323478, "subusers": [ "subuser1", "subuser2" ], "warmup": true, "user_can_send": true } } } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "ips": { "type": "array", "description": "List of IP objects.", "items": { "type": "object", "properties": { "ip": { "type": "string", "description": "IP added to account." }, "subusers": { "type": "array", "description": "Array of usernames assigned a send IP.", "items": { "type": "string" } } }, "required": [ "ip", "subusers" ] } }, "remaining_ips": { "type": "integer", "description": "The number of IPs that can still be added to the user." }, "warmup": { "type": "boolean", "description": "Whether or not the IPs are being warmed up." } }, "required": [ "ips", "remaining_ips", "warmup" ] }, "examples": { "application/json": { "ips": [ { "ip": "1.2.3.4", "subusers": [ "user", "subuser1" ] }, { "ip": "1.2.3.5", "subusers": [ "user", "subuser1" ] } ], "remaining_ips": 1, "warmup": true } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "one or more subusers do not belong to this user" } ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_ips", "summary": "Retrieve all IP addresses", "tags": [ "IP Addresses" ], "description": "**This endpoint allows you to retrieve a list of all assigned and unassigned IPs.**\n\nResponse includes warm up status, pools, assigned subusers, and reverse DNS info. The start_date field corresponds to when warmup started for that IP.\n\nA single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.", "parameters": [ { "name": "ip", "in": "query", "description": "The IP address to get", "type": "string" }, { "name": "exclude_whitelabels", "in": "query", "description": "Should we exclude reverse DNS records (whitelabels)?", "type": "boolean" }, { "name": "limit", "in": "query", "description": "The number of IPs you want returned at the same time.", "type": "integer", "default": 10 }, { "name": "offset", "in": "query", "description": "The offset for the number of IPs that you are requesting.", "type": "integer", "default": 0 }, { "name": "subuser", "in": "query", "description": "The subuser you are requesting for.", "type": "string" }, { "name": "sort_by_direction", "in": "query", "description": "The direction to sort the results.", "type": "string", "enum": [ "desc", "asc" ] } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "ip": { "type": "string", "description": "An IP address." }, "subusers": { "type": "array", "description": "The subusers that are able to send email from this IP.", "items": { "type": "string" } }, "rdns": { "type": "string", "description": "The reverse DNS record for this IP address." }, "pools": { "type": "array", "description": "The IP pools that this IP has been added to.", "items": { "type": "string" } }, "warmup": { "type": "boolean", "description": "Indicates if this IP address is currently warming up." }, "start_date": { "type": [ "number", "null" ], "description": "The date that the IP address was entered into warmup." }, "whitelabeled": { "type": "boolean", "description": "Indicates if this IP address is associated with a reverse DNS record." }, "assigned_at": { "type": [ "integer", "null" ], "description": "The date that the IP address was assigned to the user." } }, "required": [ "ip", "subusers", "pools", "warmup", "start_date", "whitelabeled", "assigned_at" ] } }, "examples": { "application/json": [ { "ip": "192.168.1.1", "pools": [ "pool1", "pool2" ], "whitelabeled": false, "start_date": 1409616000, "subusers": [ "tim@sendgrid.net" ], "warmup": false, "assigned_at": 1482883200 }, { "ip": "208.115.214.22", "pools": [], "whitelabeled": true, "rdns": "o1.email.burgermail.com", "start_date": 1409616000, "subusers": [], "warmup": false, "assigned_at": 1482883200 } ] } } }, "security": [ { "Authorization": [] } ] } }, "/ips/remaining": { "get": { "operationId": "GET_ips-remaining", "summary": "Get remaining IPs count", "tags": [ "IP Addresses" ], "description": "**This endpoint gets amount of IP Addresses that can still be created during a given period and the price of those IPs.**", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "results": { "type": "array", "items": { "type": "object", "properties": { "remaining": { "type": "integer", "description": "The number of IPs that can still be added to the user." }, "period": { "type": "string", "description": "The length of time until user can add more IPs." }, "price_per_ip": { "type": "number", "description": "The current cost to add an IP." } }, "required": [ "remaining", "period", "price_per_ip" ] } } }, "required": [ "results" ] }, "examples": { "application/json": { "results": [ { "remaining": 2, "period": "month", "price_per_ip": 20 } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/ips/assigned": { "get": { "operationId": "GET_ips-assigned", "summary": "Retrieve all assigned IPs", "tags": [ "IP Addresses" ], "description": "**This endpoint allows you to retrieve only assigned IP addresses.**\n\nA single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.", "responses": { "200": { "description": "", "schema": { "type": "array", "title": "List all assigned IPs response", "items": { "type": "object", "properties": { "ip": { "type": "string", "description": "The IP address." }, "pools": { "type": "array", "description": "The IP pools that this IP address has been added to.", "items": { "type": "string" } }, "warmup": { "type": "boolean", "description": "Indicates if this IP address is currently warming up." }, "start_date": { "type": "integer", "description": "The start date that this IP address was entered into warmup." } }, "required": [ "ip", "pools", "warmup", "start_date" ] } }, "examples": { "application/json": [ { "ip": "167.89.21.3", "pools": [ "new_test5" ], "warmup": true, "start_date": 1409616000 } ] } } }, "security": [ { "Authorization": [] } ] } }, "/ips/{ip_address}": { "parameters": [ { "name": "ip_address", "in": "path", "description": "The IP address you are retrieving the IP pools for.", "required": true, "type": "string" } ], "get": { "operationId": "GET_ips-ip_address", "summary": "Retrieve all IP pools an IP address belongs to", "tags": [ "IP Addresses" ], "description": "**This endpoint allows you to see which IP pools a particular IP address has been added to.**\n\nThe same IP address can be added to multiple IP pools.\n\nA single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "ip": { "type": "string", "description": "The IP address." }, "subusers": { "type": "array", "description": "The subusers that can send email using this IP address.", "items": { "type": "string" } }, "rdns": { "type": "string", "description": "The reverse DNS record for this IP address." }, "pools": { "type": "array", "description": "The list of IP pools that this IP address belongs to.", "items": { "type": "string" } }, "warmup": { "type": "boolean", "description": "Indicates if this IP address is currently warming up." }, "start_date": { "type": [ "integer", "null" ], "description": "The date that the IP address was entered into warmup." }, "whitelabeled": { "type": "boolean", "description": "Indicates if this IP address is associated with a reverse DNS record." } }, "required": [ "ip", "subusers", "rdns", "pools", "warmup", "start_date", "whitelabeled" ] }, "examples": { "application/json": { "ip": "000.00.00.0", "subusers": [ "subuser1", "subuser2" ], "rdns": "o1.em.example.com", "pools": [ "test1" ], "warmup": false, "start_date": null, "whitelabeled": true } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/domains": { "get": { "operationId": "GET_whitelabel-domains", "summary": "List all authenticated domains", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to retrieve a list of all domains you have authenticated.**", "parameters": [ { "name": "limit", "in": "query", "description": "Number of domains to return.", "type": "integer" }, { "name": "offset", "in": "query", "description": "Paging offset.", "type": "integer" }, { "name": "exclude_subusers", "in": "query", "description": "Exclude subuser domains from the result.", "type": "boolean" }, { "name": "username", "in": "query", "description": "The username associated with an authenticated domain.", "type": "string" }, { "name": "domain", "in": "query", "description": "Search for authenticated domains.", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/domain-authentication-200-response" }, "examples": { "application/json": [ { "id": 1, "user_id": 7, "subdomain": "mail", "domain": "example.com", "username": "jane@example.com", "ips": [ "192.168.1.1", "192.168.1.2" ], "custom_spf": true, "default": true, "legacy": false, "automatic_security": true, "valid": true, "dns": { "mail_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "u7.wl.sendgrid.net" }, "dkim1": { "valid": true, "type": "cname", "host": "s1._domainkey.example.com", "data": "s1._domainkey.u7.wl.sendgrid.net" }, "dkim2": { "valid": true, "type": "cname", "host": "s2._domainkey.example.com", "data": "s2._domainkey.u7.wl.sendgrid.net" } } }, { "id": 2, "user_id": 8, "subdomain": "new", "domain": "example2.com", "username": "john@example2.com", "ips": [], "custom_spf": false, "default": true, "legacy": false, "automatic_security": true, "valid": false, "dns": { "mail_cname": { "valid": false, "type": "mx", "host": "news.example2.com", "data": "sendgrid.net" }, "dkim1": { "valid": false, "type": "txt", "host": "example2.com", "data": "k=rsa; t=s; p=publicKey" }, "dkim2": { "valid": false, "type": "txt", "host": "example2.com", "data": "k=rsa; t=s p=publicKey" } } } ] } } }, "security": [ { "Authorization": [] } ] }, "post": { "operationId": "POST_whitelabel-domains", "summary": "Authenticate a domain", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to authenticate a domain.**\n\nIf you are authenticating a domain for a subuser, you have two options:\n1. Use the \"username\" parameter. This allows you to authenticate a domain on behalf of your subuser. This means the subuser is able to see and modify the authenticated domain.\n2. Use the Association workflow (see Associate Domain section). This allows you to authenticate a domain created by the parent to a subuser. This means the subuser will default to the assigned domain, but will not be able to see or modify that authenticated domain. However, if the subuser authenticates their own domain it will overwrite the assigned domain.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "domain": { "type": "string", "description": "Domain being authenticated." }, "subdomain": { "type": "string", "description": "The subdomain to use for this authenticated domain." }, "username": { "type": "string", "description": "The username associated with this domain." }, "ips": { "type": "array", "description": "The IP addresses that will be included in the custom SPF record for this authenticated domain.", "items": { "type": "string" } }, "custom_spf": { "type": "boolean", "description": "Specify whether to use a custom SPF or allow SendGrid to manage your SPF. This option is only available to authenticated domains set up for manual security." }, "default": { "type": "boolean", "description": "Whether to use this authenticated domain as the fallback if no authenticated domains match the sender's domain." }, "automatic_security": { "type": "boolean", "description": "Whether to allow SendGrid to manage your SPF records, DKIM keys, and DKIM key rotation." }, "custom_dkim_selector": { "type": "string", "description": "Add a custom DKIM selector. Accepts three letters or numbers." } }, "required": [ "domain" ], "example": { "domain": "example.com", "subdomain": "news", "username": "john@example.com", "ips": [ "192.168.1.1", "192.168.1.2" ], "custom_spf": true, "default": true, "automatic_security": false } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/authentication::domain" }, "examples": { "application/json": { "id": 302183, "user_id": 1446226, "subdomain": "example", "domain": "example.com", "username": "mbernier", "ips": [], "custom_spf": false, "default": true, "legacy": false, "automatic_security": true, "valid": false, "dns": { "mail_cname": { "valid": false, "type": "cname", "host": "example.example.com", "data": "u1446226.wl.sendgrid.net" }, "dkim1": { "valid": false, "type": "cname", "host": "s1._domainkey.example.com", "data": "s1.domainkey.u1446226.wl.sendgrid.net" }, "dkim2": { "valid": false, "type": "cname", "host": "s2._domainkey.example.com", "data": "s2.domainkey.u1446226.wl.sendgrid.net" } } } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/domains/{domain_id}": { "parameters": [ { "name": "domain_id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_whitelabel-domains-domain_id", "summary": "Retrieve an authenticated domain", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to retrieve a specific authenticated domain.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/authentication::domain" }, "examples": { "application/json": { "id": 45373692, "user_id": 66036447, "subdomain": "sub", "domain": "example.com", "username": "jdoe", "ips": [ "127.0.0.1" ], "custom_spf": false, "default": true, "legacy": false, "automatic_security": true, "valid": true, "dns": { "mail_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "u7.wl.sendgrid.net" }, "dkim1": { "valid": true, "type": "cname", "host": "s1._domainkey.example.com", "data": "s1._domainkey.u7.wl.sendgrid.net" }, "dkim2": { "valid": true, "type": "cname", "host": "s2._domainkey.example.com", "data": "s2._domainkey.u7.wl.sendgrid.net" } } } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_whitelabel-domains-domain_id", "summary": "Update an authenticated domain", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to update the settings for an authenticated domain.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "default": { "type": "boolean", "default": false, "description": "Indicates whether this is the default authenticated domain." }, "custom_spf": { "type": "boolean", "default": false, "description": "Indicates whether to generate a custom SPF record for manual security." } }, "example": { "default": false, "custom_spf": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/domain-authentication-200-response" }, "examples": { "application/json": [ { "id": 1, "user_id": 7, "subdomain": "mail", "domain": "example.com", "username": "jane@example.com", "ips": [ "192.168.1.1", "192.168.1.2" ], "custom_spf": true, "default": true, "legacy": false, "automatic_security": true, "valid": true, "dns": { "mail_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "u7.wl.sendgrid.net" }, "dkim1": { "valid": true, "type": "cname", "host": "s1._domainkey.example.com", "data": "s1._domainkey.u7.wl.sendgrid.net" }, "dkim2": { "valid": true, "type": "cname", "host": "s2._domainkey.example.com", "data": "s2._domainkey.u7.wl.sendgrid.net" } } }, { "id": 2, "user_id": 8, "subdomain": "new", "domain": "example2.com", "username": "john@example2.com", "ips": [], "custom_spf": false, "default": true, "legacy": false, "automatic_security": true, "valid": false, "dns": { "mail_cname": { "valid": false, "type": "mx", "host": "news.example2.com", "data": "sendgrid.net" }, "dkim1": { "valid": false, "type": "txt", "host": "example2.com", "data": "k=rsa; t=s; p=publicKey" }, "dkim2": { "valid": false, "type": "txt", "host": "example2.com", "data": "k=rsa; t=s p=publicKey" } } } ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_whitelabel-domains-domain_id", "summary": "Delete an authenticated domain.", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to delete an authenticated domain.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/domains/default": { "get": { "operationId": "GET_whitelabel-domains-default", "summary": "Get the default authentication", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to retrieve the default authentication for a domain.**\n\nWhen creating or updating a domain authentication, you can set the domain as a default. The default domain will be used to send all mail. If you have multiple authenticated domains, the authenticated domain matching the domain of the From address will be used, and the default will be overridden.\n\nThis endpoint will return a default domain and its details only if a default is set. You are not required to set a default. If you do not set a default domain, this endpoint will return general information about your domain authentication status.", "parameters": [ { "name": "domain", "in": "query", "description": "The domain to find a default authentication.", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/domain-authentication-200-response" }, "examples": { "application/json": [ { "id": 1, "user_id": 7, "subdomain": "mail", "domain": "example.com", "username": "jane@example.com", "ips": [ "192.168.1.1", "192.168.1.2" ], "custom_spf": true, "default": true, "legacy": false, "automatic_security": true, "valid": true, "dns": { "mail_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "u7.wl.sendgrid.net" }, "dkim1": { "valid": true, "type": "cname", "host": "s1._domainkey.example.com", "data": "s1._domainkey.u7.wl.sendgrid.net" }, "dkim2": { "valid": true, "type": "cname", "host": "s2._domainkey.example.com", "data": "s2._domainkey.u7.wl.sendgrid.net" } } } ] } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/domains/{id}/ips": { "parameters": [ { "name": "id", "in": "path", "description": "ID of the domain to which you are adding an IP", "required": true, "type": "integer" } ], "post": { "operationId": "POST_whitelabel-domains-id-ips", "summary": "Add an IP to an authenticated domain", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to add an IP address to an authenticated domain.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "ip": { "type": "string", "description": "IP to associate with the domain. Used for manually specifying IPs for custom SPF." } }, "required": [ "ip" ], "example": { "ip": "192.168.0.1" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/domain_authentication:domain_spf" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "john@example.com", "user_id": 7, "ips": [], "custom_spf": true, "default": false, "legacy": false, "automatic_security": false, "valid": false, "dns": { "mail_server": { "host": "mail.example.com", "type": "mx", "data": "sendgrid.net", "valid": false }, "subdomain_spf": { "host": "mail.example.com", "type": "txt", "data": "v=spf1 ip4:192.168.1.1 ip4:192.168.0.1 -all", "valid": false }, "domain_spf": { "host": "example.com", "type": "txt", "data": "v=spf1 include:mail.example.com -all", "valid": false }, "dkim": { "host": "s1._domainkey.example.com", "type": "txt", "data": "k=rsa; t=s; p=publicKey", "valid": false } } } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/domains/{id}/ips/{ip}": { "parameters": [ { "name": "id", "in": "path", "description": "ID of the domain to delete the IP from.", "required": true, "type": "integer" }, { "name": "ip", "in": "path", "description": "IP to remove from the domain.", "required": true, "type": "string" } ], "delete": { "operationId": "DELETE_whitelabel-domains-id-ips-ip", "summary": "Remove an IP from an authenticated domain.", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to remove an IP address from that domain's authentication.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/domain_authentication:domain_spf" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "mail@example.com", "user_id": 7, "ips": [], "custom_spf": true, "default": false, "legacy": false, "automatic_security": false, "valid": false, "dns": { "mail_server": { "host": "mail.example.com", "type": "mx", "data": "sendgrid.net", "valid": false }, "subdomain_spf": { "host": "mail.example.com", "type": "txt", "data": "v=spf1 ip4:192.168.1.1 ip4:192.168.0.1 -all", "valid": false }, "domain_spf": { "host": "example.com", "type": "txt", "data": "v=spf1 include:mail.example.com -all", "valid": false }, "dkim": { "host": "s1._domainkey.example.com", "type": "txt", "data": "k=rsa; t=s; p=publicKey", "valid": false } } } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/domains/{id}/validate": { "parameters": [ { "name": "id", "in": "path", "description": "ID of the domain to validate.", "required": true, "type": "integer" } ], "post": { "operationId": "POST_whitelabel-domains-id-validate", "summary": "Validate a domain authentication.", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to validate an authenticated domain. If it fails, it will return an error message describing why the domain could not be validated.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the authenticated domain." }, "valid": { "type": "boolean", "description": "Indicates if this is a valid authenticated domain." }, "validation_results": { "type": "object", "description": "The individual DNS records that are checked when validating, including the reason for any invalid DNS records.", "properties": { "mail_cname": { "type": "object", "description": "The CNAME record for the authenticated domain.", "properties": { "valid": { "type": "boolean", "description": "Indicates if this DNS record is valid." }, "reason": { "type": [ "string", "null" ], "description": "The reason this record is invalid." } } }, "dkim1": { "type": "object", "description": "A DNS record for this authenticated domain.", "properties": { "valid": { "type": "boolean", "description": "Indicates if the DNS record is valid." }, "reason": { "type": [ "string", "null" ] } } }, "dkim2": { "type": "object", "description": "A DNS record for this authenticated domain.", "properties": { "valid": { "type": "boolean", "description": "Indicates if the DNS record is valid." }, "reason": { "type": [ "string", "null" ] } } }, "spf": { "type": "object", "description": "The SPF record for the authenticated domain.", "properties": { "valid": { "type": "boolean", "description": "Indicates if the SPF record is valid." }, "reason": { "type": [ "string", "null" ] } } } } } } }, "examples": { "application/json": { "id": 1, "valid": true, "validation_resuts": { "mail_cname": { "valid": false, "reason": "Expected your MX record to be \"mx.sendgrid.net\" but found \"example.com\"." }, "dkim1": { "valid": true, "reason": null }, "dkim2": { "valid": true, "reason": null }, "spf": { "valid": true, "reason": null } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string", "description": "A message explaining the reason for the error." } }, "required": [ "message" ] } } } }, "examples": { "application/json": { "errors": [ { "message": "internal error getting TXT" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/domains/subuser": { "get": { "operationId": "GET_whitelabel-domains-subuser", "summary": "List the authenticated domain associated with the given user.", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to retrieve all of the authenticated domains that have been assigned to a specific subuser.**\n\nAuthenticated domains can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's domain authentication. To associate an authenticated domain with a subuser, the parent account must first authenticate and validate the domain. The parent may then associate the authenticated domain via the subuser management tools.", "parameters": [ { "name": "username", "in": "query", "description": "Username for the subuser to find associated authenticated domain.", "required": true, "type": "string" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/domain_authentication:domain_spf" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "mail@example.com", "user_id": 7, "ips": [], "custom_spf": true, "default": false, "legacy": false, "automatic_security": false, "valid": false, "dns": { "mail_server": { "host": "mail.example.com", "type": "mx", "data": "sendgrid.net", "valid": false }, "subdomain_spf": { "host": "mail.example.com", "type": "txt", "data": "v=spf1 ip4:192.168.1.1 ip4:192.168.0.1 -all", "valid": false }, "domain_spf": { "host": "example.com", "type": "txt", "data": "v=spf1 include:mail.example.com -all", "valid": false }, "dkim": { "host": "s1._domainkey.example.com", "type": "txt", "data": "k=rsa; t=s; p=publicKey", "valid": false } } } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_whitelabel-domains-subuser", "summary": "Disassociate an authenticated domain from a given user.", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to disassociate a specific authenticated domain from a subuser.**\n\nAuthenticated domains can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's domain authentication. To associate an authenticated domain with a subuser, the parent account must first authenticate and validate the domain. The parent may then associate the authenticated domain via the subuser management tools.", "parameters": [ { "name": "username", "in": "query", "description": "Username for the subuser to find associated authenticated domain.", "type": "string" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/whitelabel/domains/{domain_id}/subuser": { "parameters": [ { "name": "domain_id", "in": "path", "description": "ID of the authenticated domain to associate with the subuser", "required": true, "type": "integer" } ], "post": { "operationId": "POST_whitelabel-domains-domain_id-subuser", "summary": "Associate an authenticated domain with a given user.", "tags": [ "Domain Authentication" ], "description": "**This endpoint allows you to associate a specific authenticated domain with a subuser.**\n\nAuthenticated domains can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's domain authentication. To associate an authenticated domain with a subuser, the parent account must first authenticate and validate the domain. The parent may then associate the authenticated domain via the subuser management tools.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "username": { "type": "string", "description": "Username to associate with the authenticated domain." } }, "required": [ "username" ], "example": { "username": "jdoe" } } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/domain_authentication:domain_spf" }, "examples": { "application/json": { "id": 1, "domain": "example.com", "subdomain": "mail", "username": "mail@example.com", "user_id": 7, "ips": [], "custom_spf": true, "default": false, "legacy": false, "automatic_security": false, "valid": false, "dns": { "mail_server": { "host": "mail.example.com", "type": "mx", "data": "sendgrid.net", "valid": false }, "subdomain_spf": { "host": "mail.example.com", "type": "txt", "data": "v=spf1 ip4:192.168.1.1 ip4:192.168.0.1 -all", "valid": false }, "domain_spf": { "host": "example.com", "type": "txt", "data": "v=spf1 include:mail.example.com -all", "valid": false }, "dkim": { "host": "s1._domainkey.example.com", "type": "txt", "data": "k=rsa; t=s; p=publicKey", "valid": false } } } } } }, "security": [ { "Authorization": [] } ] } }, "/verified_senders/domains": { "get": { "operationId": "GET_verified_senders-domains", "summary": "Domain Warn List", "tags": [ "Sender Verification" ], "description": "**This endpoint returns a list of domains known to implement DMARC and categorizes them by failure type — hard failure or soft failure**.\n\nDomains listed as hard failures will not deliver mail when used as a [Sender Identity](https://sendgrid.com/docs/for-developers/sending-email/sender-identity/) due to the domain's DMARC policy settings.\n\nFor example, using a `yahoo.com` email address as a Sender Identity will likely result in the rejection of your mail. For more information about DMARC, see [Everything about DMARC](https://sendgrid.com/docs/ui/sending-email/dmarc/).", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "results": { "type": "object", "required": [ "soft_failures", "hard_failures" ], "properties": { "soft_failures": { "type": "array", "items": { "type": "string" } }, "hard_failures": { "type": "array", "items": { "type": "string" } } } } }, "required": [ "results" ] }, "examples": { "application/json": { "results": { "soft_failures": [ "gmail.com" ], "hard_failures": [ "yahoo.com" ] } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/verified_senders/steps_completed": { "get": { "operationId": "GET_verified_senders-steps_completed", "summary": "Completed Steps", "tags": [ "Sender Verification" ], "description": "**This endpoint allows you to determine which of SendGrid’s verification processes have been completed for an account**.\n\nThis endpoint returns boolean values, `true` and `false`, for [Domain Authentication](https://sendgrid.com/docs/for-developers/sending-email/sender-identity/#domain-authentication), `domain_verified`, and [Single Sender Verification](https://sendgrid.com/docs/for-developers/sending-email/sender-identity/#single-sender-verification), `sender_verified`, for the account.\n\nAn account may have one, both, or neither verification steps completed. If you need to authenticate a domain rather than a Single Sender, see the \"Authenticate a domain\" endpoint.", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "results": { "type": "object", "properties": { "sender_verified": { "type": "boolean" }, "domain_verified": { "type": "boolean" } } } } }, "examples": { "application/json": { "results": { "domain_verified": true, "sender_verified": true } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/verified_senders": { "post": { "operationId": "POST_verified_senders", "summary": "Create Verified Sender Request", "tags": [ "Sender Verification" ], "description": "**This endpoint allows you to create a new Sender Identify**.\n\nUpon successful submission of a `POST` request to this endpoint, an identity will be created, and a verification email will be sent to the address assigned to the `from_email` field. You must complete the verification process using the sent email to fully verify the sender.\n\nIf you need to resend the verification email, you can do so with the Resend Verified Sender Request, `/resend/{id}`, endpoint.\n\nIf you need to authenticate a domain rather than a Single Sender, see the [Domain Authentication API](https://sendgrid.api-docs.io/v3.0/domain-authentication/authenticate-a-domain).", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/verified-sender-request-schema" } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/verified-sender-response-schema" }, "examples": { "application/json": { "id": 1234, "nickname": "Example Orders", "from_email": "orders@example.com", "from_name": "Example Orders", "reply_to": "orders@example.com", "reply_to_name": "Example Orders", "address": "1234 Fake St.", "address2": "PO Box 1234", "state": "CA", "city": "San Francisco", "country": "USA", "zip": "94105", "verified": true, "locked": false } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } }, "required": [ "errors" ] } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_verified_senders", "summary": "Get All Verified Senders", "tags": [ "Sender Verification" ], "description": "**This endpoint allows you to retrieve all the Sender Identities associated with an account.**\n\nThis endpoint will return both verified and unverified senders.\n\nYou can limit the number of results returned using the `limit`, `lastSeenID`, and `id` query string parameters.\n\n* `limit` allows you to specify an exact number of Sender Identities to return.\n* `lastSeenID` will return senders with an ID number occuring after the passed in ID. In other words, the `lastSeenID` provides a starting point from which SendGrid will iterate to find Sender Identities associated with your account.\n* `id` will return information about only the Sender Identity passed in the request.", "parameters": [ { "name": "limit", "in": "query", "type": "number" }, { "name": "lastSeenID", "in": "query", "type": "number" }, { "name": "id", "in": "query", "type": "integer" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/verified-sender-response-schema" } } } }, "examples": { "application/json": { "results": [ { "id": 1234, "nickname": "Example Orders", "from_email": "orders@example.com", "from_name": "Example Orders", "reply_to": "orders@example.com", "reply_to_name": "Example Orders", "address": "1234 Fake St.", "address2": "PO Box 1234", "state": "CA", "city": "San Francisco", "country": "USA", "zip": "94105", "verified": true, "locked": false }, { "id": 1235, "nickname": "Example Support", "from_email": "support@example.com", "from_name": "Example Support", "reply_to": "support@example.com", "reply_to_name": "Example Support", "address": "1234 Fake St.", "address2": "PO Box 1234", "state": "CA", "city": "San Francisco", "country": "USA", "zip": "94105", "verified": true, "locked": false } ] } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/verified_senders/verify/{token}": { "parameters": [ { "name": "token", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_verified_senders-verify-token", "summary": "Verify Sender Request", "tags": [ "Sender Verification" ], "description": "**This endpoint allows you to verify a sender requests.**\n\nThe token is generated by SendGrid and included in a verification email delivered to the address that's pending verification.", "responses": { "204": { "description": "" }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } }, "required": [ "errors" ] } }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/verified_senders/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "patch": { "operationId": "PATCH_verified_senders-id", "summary": "Edit Verified Sender", "tags": [ "Sender Verification" ], "description": "**This endpoint allows you to update an existing Sender Identity**.\n\nPass the `id` assigned to a Sender Identity to this endpoint as a path parameter. Include any fields you wish to update in the request body in JSON format.\n\nYou can retrieve the IDs associated with Sender Identities by passing a `GET` request to the Get All Verified Senders endpoint, `/verified_senders`.\n\n**Note:** Unlike a `PUT` request, `PATCH` allows you to update only the fields you wish to edit. Fields that are not passed as part of a request will remain unaltered.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/verified-sender-request-schema" } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/verified-sender-response-schema" }, "examples": { "application/json": { "id": 1234, "nickname": "Example Orders", "from_email": "orders@example.com", "from_name": "Example Orders", "reply_to": "orders@example.com", "reply_to_name": "Example Orders", "address": "1234 Fake St.", "address2": "PO Box 1234", "state": "CA", "city": "San Francisco", "country": "USA", "zip": "94105", "verified": true, "locked": false } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } }, "required": [ "errors" ] } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } }, "required": [ "errors" ] } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } }, "required": [ "errors" ] } }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_verified_senders-id", "summary": "Delete Verified Sender", "tags": [ "Sender Verification" ], "description": "**This endpoint allows you to delete a Sender Identity**.\n\nPass the `id` assigned to a Sender Identity to this endpoint to delete the Sender Identity from your account.\n\nYou can retrieve the IDs associated with Sender Identities using the \"Get All Verified Senders\" endpoint.", "responses": { "204": { "description": "", "schema": { "type": "object" } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } }, "required": [ "errors" ] } }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/verified_senders/resend/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "post": { "operationId": "POST_verified_senders-resend-id", "summary": "Resend Verified Sender Request", "tags": [ "Sender Verification" ], "description": "**This endpoint allows you to resend a verification email to a specified Sender Identity**.\n\nPassing the `id` assigned to a Sender Identity to this endpoint will resend a verification email to the `from_address` associated with the Sender Identity. This can be useful if someone loses their verification email or needs to have it resent for any other reason.\n\nYou can retrieve the IDs associated with Sender Identities by passing a \"Get All Verified Senders\" endpoint.", "responses": { "204": { "description": "", "schema": { "type": "object" } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } }, "required": [ "errors" ] } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "error_id" ] } } }, "required": [ "errors" ] } }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/designs/{id}": { "parameters": [ { "name": "id", "in": "path", "description": "The ID of the Design you want to duplicate.", "required": true, "type": "string", "format": "uuid" } ], "post": { "operationId": "POST-design", "summary": "Duplicate Design", "tags": [ "Designs API" ], "description": "**This endpoint allows you to duplicate one of your existing designs**.\n\nModifying an existing design is often the easiest way to create something new.\n\nYou are not required to pass any data in the body of a request to this endpoint. If you choose to leave the `name` field blank, your duplicate will be assigned the name of the design it was copied from with the text \"Duplicate: \" prepended to it. This name change is only a convenience, as the duplicate will be assigned a unique ID that differentiates it from your other designs.\n\nYou can modify your duplicate’s name at the time of creation by passing an updated value to the `name` field when making the initial request.\nMore on retrieving design IDs can be found below.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/design-duplicate-input", "example": { "name": "Ahoy, Cake or Pie Cafe!", "editor": "design" } } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/design-output" }, "examples": { "application/json": { "id": "15b85720-ce48-48ef-8a07-672b0d3455da", "name": "Ahoy, Cake or Pie Cafe!", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

\n
\n \n \n \n \n \n
Ahoy, World!

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "plain_content": "Ahoy, World!\n\n{{Sender_Name}}\n\n{{Sender_Address}} , {{Sender_City}} , {{Sender_State}} {{Sender_Zip}}\n\nUnsubscribe ( {{{unsubscribe}}} ) - Unsubscribe Preferences ( {{{unsubscribe_preferences}}} )", "generate_plain_content": false, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/79bb769ae6464960a307040120ad6f9921896fe9825e845ad1f24d12285ea068.png", "subject": "Getting Started", "created_at": "2021-04-30T19:00:16Z", "updated_at": "2021-04-30T19:00:16Z", "editor": "design", "categories": [] } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/api-error" } }, "404": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET-design", "summary": "Get Design", "tags": [ "Designs API" ], "description": "**This endpoint allows you to retrieve a single design**.\n\nA GET request to `/designs/{id}` will retrieve details about a specific design in your Design Library.\n\nThis endpoint is valuable when retrieving information stored in a field that you wish to update using a PATCH request.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/design-output" }, "examples": { "application/json": { "id": "15b85720-ce48-48ef-8a07-672b0d3455da", "name": "Ahoy, World!", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

\n
\n \n \n \n \n \n
Ahoy, World!

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "plain_content": "Ahoy, World!\n\n{{Sender_Name}}\n\n{{Sender_Address}} , {{Sender_City}} , {{Sender_State}} {{Sender_Zip}}\n\nUnsubscribe ( {{{unsubscribe}}} ) - Unsubscribe Preferences ( {{{unsubscribe_preferences}}} )", "generate_plain_content": false, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/5yysvuyi1lpdnxo1ym8ax8yd7ompve3azjtme76gamdace01vko3eyn1kzso1lhy.png", "subject": "Getting Started", "created_at": "2021-04-30T18:51:20Z", "updated_at": "2021-04-30T18:51:20Z", "editor": "design", "categories": [] } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } }, "404": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PUT-design", "summary": "Update Design", "tags": [ "Designs API" ], "description": "**This endpoint allows you to edit a design**.\n\nThe Design API supports PATCH requests, which allow you to make partial updates to a single design. Passing data to a specific field will update only the data stored in that field; all other fields will be unaltered.\n\nFor example, updating a design's name requires that you make a PATCH request to this endpoint with data specified for the `name` field only.\n\n```\n{\n \"name\": \"\"\n}\n```", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "Name of the Design.", "maxLength": 100, "default": "My Design" }, "html_content": { "type": "string", "description": "The HTML content of the Design.", "maxLength": 1048576 }, "plain_content": { "type": "string", "description": "Plain text content of the Design.", "maxLength": 1048576, "default": "" }, "generate_plain_content": { "type": "boolean", "description": "If true, plain_content is always generated from html_content. If false, plain_content is not altered.", "default": true }, "subject": { "type": "string", "description": "Subject of the Design.", "maxLength": 5000 }, "categories": { "type": "array", "description": "The list of categories applied to the design", "uniqueItems": true, "maxItems": 10, "items": { "type": "string", "maxLength": 255 } } }, "example": { "name": "Ahoy, World!", "subject": "Getting Started", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

\n
\n \n \n \n \n \n
Ahoy, World!

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "generate_plain_content": false, "categories": [ "promotions" ] } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/design-output" }, "examples": { "application/json": { "id": "15b85720-ce48-48ef-8a07-672b0d3455da", "name": "Ahoy, World!", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

\n
\n \n \n \n \n \n
Ahoy, World!

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "generate_plain_content": false, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/5yysvuyi1lpdnxo1ym8ax8yd7ompve3azjtme76gamdace01vko3eyn1kzso1lhy.png", "subject": "Getting Started", "created_at": "2021-04-30T18:51:20Z", "updated_at": "2021-04-30T18:51:20Z", "editor": "design", "categories": [ "promotions" ] } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } }, "404": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE-design", "summary": "Delete Design", "tags": [ "Designs API" ], "description": "**This endpoint allows you to delete a single design**.\n\nBe sure to check the ID of the design you intend to delete before making this request; deleting a design is a permanent action.", "responses": { "204": { "description": "", "schema": { "type": "object" } }, "400": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } }, "404": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } } }, "security": [ { "Authorization": [] } ] } }, "/designs": { "post": { "operationId": "POST-design", "summary": "Create Design", "tags": [ "Designs API" ], "description": "**This endpoint allows you to create a new design**.\n\nYou can add a new design by passing data, including a string of HTML email content, to `/designs`. When creating designs from scratch, be aware of the styling constraints inherent to many email clients. For a list of best practices, see our guide to [Cross-Platform Email Design](https://sendgrid.com/docs/ui/sending-email/cross-platform-html-design/).\n\nThe Design Library can also convert your design’s HTML elements into drag and drop modules that are editable in the Designs Library user interface. For more, visit the [Design and Code Editor documentation](https://sendgrid.com/docs/ui/sending-email/editor/#drag--drop-markup).\n\nBecause the `/designs` endpoint makes it easy to add designs, you can create a design with your preferred tooling or migrate designs you already own without relying on the Design Library UI.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/design-input", "example": { "name": "Ahoy, World!", "editor": "design", "subject": "Getting Started", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

\n
\n \n \n \n \n \n
Ahoy, World!

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "plain_content": "Ahoy, World!\n\n{{Sender_Name}}\n\n{{Sender_Address}} , {{Sender_City}} , {{Sender_State}} {{Sender_Zip}}\n\nUnsubscribe ( {{{unsubscribe}}} ) - Unsubscribe Preferences ( {{{unsubscribe_preferences}}} )" } } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/design-output" }, "examples": { "application/json": { "id": "3247eaea-c912-42a3-b0bc-60bdaf210396", "name": "Ahoy, World!", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

\n
\n \n \n \n \n \n
Ahoy, World!

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "plain_content": "Ahoy, World!\n\n{{Sender_Name}}\n\n{{Sender_Address}} , {{Sender_City}} , {{Sender_State}} {{Sender_Zip}}\n\nUnsubscribe ( {{{unsubscribe}}} ) - Unsubscribe Preferences ( {{{unsubscribe_preferences}}} )", "generate_plain_content": false, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/kjlrmded0qnrscv8zqr39npoimrpdwgiax59q8iq6ovj7yoks2fzxoxpfjpwph6o.png", "subject": "Getting Started", "created_at": "2021-04-30T18:51:20Z", "updated_at": "2021-04-30T18:51:20Z", "editor": "design", "categories": [] } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "LIST-designs", "summary": "List Designs", "tags": [ "Designs API" ], "description": "**This endpoint allows you to retrieve a list of designs already stored in your Design Library**.\n\nA GET request to `/designs` will return a list of your existing designs. This endpoint will not return the pre-built Twilio SendGrid designs. Pre-built designs can be retrieved using the `/designs/pre-builts` endpoint, which is detailed below.\n\nBy default, you will receive 100 results per request; however, you can modify the number of results returned by passing an integer to the `page_size` query parameter.", "parameters": [ { "$ref": "#/parameters/trait:designsQueryStrings:page_size" }, { "$ref": "#/parameters/trait:designsQueryStrings:page_token" }, { "$ref": "#/parameters/trait:designsQueryStrings:summary" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/design-output-summary" } }, "_metadata": { "$ref": "#/definitions/_metadata" } } }, "examples": { "application/json": { "result": [ { "id": "3247eaea-c912-42a3-b0bc-60bdaf210396", "name": "Welcome Email", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/llny8o5b3m636z92p7hbjnmq1jvpka39p370jwtin2s1wxv7x1sgm0y5fk518d0s.png", "subject": "Welcom to the Cake or Pie Cafe", "created_at": "2021-04-09T17:29:46Z", "updated_at": "2021-04-09T17:29:55Z", "editor": "code", "categories": [ "welcome", "new customer" ] }, { "id": "02dfd792-f31f-439a-a79e-5c47fbcfdbac", "name": "Monthly Promo", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/hfyxahd7ues2ajuoeoqq2xe6ibdasl1q89ox0y9ncya2ftpoicssmtf9ddus4c39.png", "subject": "Free Dozen Cupcakes", "created_at": "2021-04-09T17:29:21Z", "updated_at": "2021-04-09T17:29:42Z", "editor": "design", "categories": [ "promo", "coupon" ] }, { "id": "e54be823-19ef-4c6f-8b60-efd7514f492d", "name": "Duplicate: Ingrid & Anders", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/12kni9gjpyb9uxmwr9vk7unycjr70u95zoyhe9sg2zounul2zg7dih1s20k13q2z.png", "subject": "Welcome to Ingrid & Anders!", "created_at": "2020-10-09T17:33:46Z", "updated_at": "2021-04-07T19:57:52Z", "editor": "design", "categories": [] } ], "_metadata": { "self": "https://api.sendgrid.com/v3/designs?page_token=vHdvHCg0w1F-TmWJcPNpTEnFY2aPEmRBHONwOgZ6TgJbX2_I", "count": 3 } } } } }, "security": [ { "Authorization": [] } ] } }, "/designs/pre-builts/{id}": { "parameters": [ { "name": "id", "in": "path", "description": "The ID of the pre-built Design you want to duplicate.", "required": true, "type": "string", "format": "uuid" } ], "post": { "operationId": "POST-sendgrid-pre-built-design", "summary": "Duplicate SendGrid Pre-built Design", "tags": [ "Designs API" ], "description": "**This endpoint allows you to duplicate one of the pre-built Twilio SendGrid designs**.\n\nLike duplicating one of your existing designs, you are not required to pass any data in the body of a request to this endpoint. If you choose to leave the `name` field blank, your duplicate will be assigned the name of the design it was copied from with the text \"Duplicate: \" prepended to it. This name change is only a convenience, as the duplicate design will be assigned a unique ID that differentiates it from your other designs. You can retrieve the IDs for Twilio SendGrid pre-built designs using the \"List SendGrid Pre-built Designs\" endpoint.\n\nYou can modify your duplicate’s name at the time of creation by passing an updated value to the `name` field when making the initial request.\nMore on retrieving design IDs can be found above.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/design-duplicate-input", "example": { "name": "Ahoy, Cake or Pie Cafe!", "editor": "design" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/design-output" }, "examples": { "application/json": { "id": "abe0877f-a224-21e2-b62e-c789d326cda5", "name": "Ahoy, Pre-built Design!", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

You've found the secret!

\n
\n \n \n \n
\"Off
\n \n \n \n
\"\"
\n \n \n \n
Welcome to the family!
\n \n \n \n
You've found a community of travelers that are just like you.
\n
 
\n
We don't want to be stuck in tourist traps that isolate us from vibrant, local experiences. We want to discover the hidden gems and less-traveled roads of our next destination.
\n
 
\n
Ready for your next authentic travel experience?
Browse Gallery
\n \n \n \n
\"\"
\n \n \n \n
\n
\n \n \n \n
\n \n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n \n \n
\n \n \n
\n \n \"Facebook\"\n \n \n \n \"Twitter\"\n \n \n \n \"Instagram\"\n \n \n \n \"Pinterest\"\n \n
\n

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "plain_content": "You've found the secret!\n\nWelcome to the family!\n\nYou've found a community of travelers that are just like you.\n\nWe don't want to be stuck in tourist traps that isolate us from vibrant, local experiences. We want to discover the hidden gems and less-traveled roads of our next destination.\n\nReady for your next authentic travel experience?\n\nBrowse Gallery\n\n( https://www.facebook.com/sendgrid/ ) ( https://twitter.com/sendgrid?ref_src=twsrc%5egoogle%7ctwcamp%5eserp%7ctwgr%5eauthor ) ( https://www.instagram.com/sendgrid/?hl=en ) ( https://www.pinterest.com/sendgrid/ )\n\n{{Sender_Name}}\n\n{{Sender_Address}} , {{Sender_City}} , {{Sender_State}} {{Sender_Zip}}\n\nUnsubscribe ( {{{unsubscribe}}} ) - Unsubscribe Preferences ( {{{unsubscribe_preferences}}} )", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/a85b4b202ff28094828f11ff472360caecf67ead2d186b69b45c904b9251aa0b.png", "subject": "Welcome to the family!", "created_at": "2021-04-30T19:15:28Z", "updated_at": "2021-04-30T19:15:28Z", "editor": "design", "categories": [] } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } }, "404": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET-sendgrid-pre-built-design", "summary": "Get SendGrid Pre-built Design", "tags": [ "Designs API" ], "description": "**This endpoint allows you to retrieve a single pre-built design**.\n\nA GET request to `/designs/pre-builts/{id}` will retrieve details about a specific pre-built design.\n\nThis endpoint is valuable when retrieving details about a pre-built design that you wish to duplicate and modify.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/design-output" }, "examples": { "application/json": { "id": "6ad69134-7165-48cb-964a-6c3cf03e8af8", "name": "Off Grid Adventures", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

You've found the secret!

\n
\n \n \n \n
\"Off
\n \n \n \n
\"\"
\n \n \n \n
Welcome to the family!
\n \n \n \n
You've found a community of travelers that are just like you.
\n
 
\n
We don't want to be stuck in tourist traps that isolate us from vibrant, local experiences. We want to discover the hidden gems and less-traveled roads of our next destination.
\n
 
\n
Ready for your next authentic travel experience?
Browse Gallery
\n \n \n \n
\"\"
\n \n \n \n
\n
\n \n \n \n
\n \n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n \n \n
\n \n \n
\n \n \"Facebook\"\n \n \n \n \"Twitter\"\n \n \n \n \"Instagram\"\n \n \n \n \"Pinterest\"\n \n
\n

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "plain_content": "You've found the secret!\n\nWelcome to the family!\n\nYou've found a community of travelers that are just like you.\n\nWe don't want to be stuck in tourist traps that isolate us from vibrant, local experiences. We want to discover the hidden gems and less-traveled roads of our next destination.\n\nReady for your next authentic travel experience?\n\nBrowse Gallery\n\n( https://www.facebook.com/sendgrid/ ) ( https://twitter.com/sendgrid?ref_src=twsrc%5egoogle%7ctwcamp%5eserp%7ctwgr%5eauthor ) ( https://www.instagram.com/sendgrid/?hl=en ) ( https://www.pinterest.com/sendgrid/ )\n\n{{Sender_Name}}\n\n{{Sender_Address}} , {{Sender_City}} , {{Sender_State}} {{Sender_Zip}}\n\nUnsubscribe ( {{{unsubscribe}}} ) - Unsubscribe Preferences ( {{{unsubscribe_preferences}}} )", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/a85b4b202ff28094828f11ff472360caecf67ead2d186b69b45c904b9251aa0b.png", "subject": "Welcome to the family!", "created_at": "2019-09-10T02:11:34Z", "updated_at": "2021-01-11T21:47:52Z", "editor": "design", "categories": [] } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } }, "404": { "description": "", "schema": { "$ref": "#/definitions/api-errors" } } }, "security": [ { "Authorization": [] } ] } }, "/designs/pre-builts": { "get": { "operationId": "LIST-Sendgrid-Pre-built-designs", "summary": "List SendGrid Pre-built Designs", "tags": [ "Designs API" ], "description": "**This endpoint allows you to retrieve a list of pre-built designs provided by Twilio SendGrid**.\n\nUnlike the `/designs` endpoint where *your* designs are stored, a GET request made to `designs/pre-builts` will retrieve a list of the pre-built Twilio SendGrid designs. This endpoint will not return the designs stored in your Design Library.\n\nBy default, you will receive 100 results per request; however, you can modify the number of results returned by passing an integer to the `page_size` query parameter.\n\nThis endpoint is useful for retrieving the IDs of Twilio SendGrid designs that you want to duplicate and modify.", "parameters": [ { "$ref": "#/parameters/trait:designsQueryStrings:page_size" }, { "$ref": "#/parameters/trait:designsQueryStrings:page_token" }, { "$ref": "#/parameters/trait:designsQueryStrings:summary" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/design-output-summary" } }, "_metadata": { "$ref": "#/definitions/_metadata" } } }, "examples": { "application/json": { "result": [ { "id": "6ad69134-7165-48cb-964a-6c3cf03e8af8", "name": "Off Grid Adventures", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/a85b4b202ff28094828f11ff472360caecf67ead2d186b69b45c904b9251aa0b.png", "subject": "Welcome to the family!", "created_at": "2019-09-10T02:11:34Z", "updated_at": "2021-01-11T21:47:52Z", "editor": "design", "categories": [] }, { "id": "b0a9c6f7-a9a1-4b52-b0c5-16fc6f4cdb2b", "name": "Song Riddle", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/4ef3a39249f3accb8461b03950c071454a745a232508feca89a626b3e7f578d3.png", "subject": "Welcome to Song Riddle!", "created_at": "2019-09-10T02:12:32Z", "updated_at": "2021-01-11T21:46:43Z", "editor": "design", "categories": [] }, { "id": "f8d8da76-bcca-4cfe-b809-733887855f57", "name": "Ingrid & Anders 1", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/15c97ffa97ee31693581a67526728d096eef00adfbaa34bb030d91034d477da4.png", "subject": "Welcome to Ingrid & Anders!", "created_at": "2019-09-10T02:10:38Z", "updated_at": "2021-01-11T21:45:05Z", "editor": "design", "categories": [] }, { "id": "2935a7d0-7f02-4e0f-a570-dc302ce09749", "name": "Ingrid & Anders 2", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/7b36a6c0955cab0c350d105114ad248700a685bd11032592cdef85ae26540afc.png", "subject": "Check out these exclusive deals!", "created_at": "2019-09-10T02:09:31Z", "updated_at": "2021-01-11T21:44:08Z", "editor": "design", "categories": [] }, { "id": "7826ef14-7ba6-4dbc-91f0-a8c610ebe962", "name": "Ingrid & Anders 3", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/6dd8dd73a1a62bd7a76c4313b52d7c749250d49e31b19cce718906655fcbc675.png", "subject": "Join our VIP club and save big!", "created_at": "2019-09-10T02:08:29Z", "updated_at": "2021-01-11T21:41:35Z", "editor": "design", "categories": [] }, { "id": "41da47e7-d3e2-491b-a83f-f499a4139d6a", "name": "Mercado", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/9cc87cc7671719712d9d363184995d0ec05103355db300ff03641fe9e205651d.png", "subject": "Subject", "created_at": "2019-09-10T02:03:06Z", "updated_at": "2021-01-11T21:39:23Z", "editor": "design", "categories": [] } ], "_metadata": { "self": "https://api.sendgrid.com/v3/designs/pre-builts?page_token=yYzyCxj-iIVgP54t6NjKkunDCKYLLpngo-5vAsfYXz0To34U", "count": 6 } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts": { "put": { "operationId": "PUT_mc-contacts", "summary": "Add or Update a Contact", "tags": [ "Contacts" ], "description": "**This endpoint allows the [upsert](https://en.wiktionary.org/wiki/upsert) (insert or update) of up to 30,000 contacts, or 6MB of data, whichever is lower**. \n\nBecause the creation and update of contacts is an asynchronous process, the response will not contain immediate feedback on the processing of your upserted contacts. Rather, it will contain an HTTP 202 response indicating the contacts are queued for processing or an HTTP 4XX error containing validation errors. Should you wish to get the resulting contact's ID or confirm your contacts have been updated or added, you can use the \"Get Contacts by Emails\" endpoint. \n\nPlease note that custom fields need to have been already created if you wish to set their values for the contacts being upserted. To do this, please use the \"Create Custom Field Definition\" endpoint.\n\nYou will see a `job_id` in the response to your request. This can be used to check the status of your upsert job. To do so, please use the \"Import Contacts Status\" endpoint.\n\nIf the contact already exists in the system, any entries submitted via this endpoint will update the existing contact. The contact to update will be determined only by the `email` field and any fields omitted from the request will remain as they were. A contact's ID cannot be used to update the contact.\n\nThe email field will be changed to all lower-case. If a contact is added with an email that exists but contains capital letters, the existing contact with the all lower-case email will be updated.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "list_ids": { "type": "array", "description": "An array of List ID strings that this contact will be added to.", "items": { "type": "string", "format": "uuid" } }, "contacts": { "type": "array", "description": "One or more contacts objects that you intend to upsert. The available fields for a contact, including the required `email` field are described below.", "minItems": 1, "maxItems": 30000, "items": { "$ref": "#/definitions/contact-request" } } }, "required": [ "contacts" ] } } ], "responses": { "202": { "description": "", "schema": { "type": "object", "properties": { "job_id": { "type": "string", "description": "Indicates that the contacts are queued for processing. Check the job status with the \"Import Contacts Status\" endpoint." } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/error" } } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_mc-contacts", "summary": "Delete Contacts", "tags": [ "Contacts" ], "description": "**This endpoint can be used to delete one or more contacts**.\n\nThe query parameter `ids` must set to a comma-separated list of contact IDs for bulk contact deletion.\n\nThe query parameter `delete_all_contacts` must be set to `\"true\"` to delete **all** contacts. \n\nYou must set either `ids` or `delete_all_contacts`.\n\nDeletion jobs are processed asynchronously.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "parameters": [ { "name": "delete_all_contacts", "in": "query", "description": "Must be set to `\"true\"` to delete all contacts.", "required": false, "type": "string" }, { "name": "ids", "in": "query", "description": "A comma-separated list of contact IDs.", "required": false, "type": "string" } ], "responses": { "202": { "description": "", "schema": { "type": "object", "description": "The deletion job has been accepted and is being processed.", "properties": { "job_id": { "type": "object", "description": "The deletion job ID." } }, "required": [ "job_id" ] } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object" } } }, "required": [ "errors" ] } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mc-contats", "summary": "Get Sample Contacts", "tags": [ "Contacts" ], "description": "**This endpoint will return up to 50 of the most recent contacts uploaded or attached to a list**. \n\nThis list will then be sorted by email address.\n\nThe full contact count is also returned.\n\nPlease note that pagination of the contacts has been deprecated.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/contact-details3" } }, "_metadata": { "$ref": "#/definitions/selfmetadata" }, "contact_count": { "type": "integer" } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/error" } } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "type": "object" } }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts/count": { "get": { "operationId": "GET_mc-contacts-count", "summary": "Get Total Contact Count", "tags": [ "Contacts" ], "description": "**This endpoint returns the total number of contacts you have stored.**\n\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "contact_count": { "type": "integer", "description": "The total number of contacts." }, "billable_count": { "type": "integer", "default": 0, "description": "The count of contacts this month for billing purposes.", "minimum": 0 }, "billable_breakdown": { "type": "object", "description": "`billable_breakdown` will only appear to the parent user in an account with subusers.", "properties": { "total": { "type": "integer", "description": "The sum of all the subuser's billable contacts" }, "breakdown": { "type": "object", "description": "A map of each subuser's billable contact usage. Each key is the subuser's ID and each value is the usage thus far this month.", "minProperties": 0 } } } }, "required": [ "contact_count" ] } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts/exports": { "post": { "operationId": "POST_mc-contacts-exports", "summary": "Export Contacts", "tags": [ "Contacts" ], "description": "**Use this endpoint to export lists or segments of contacts**.\n\nIf you would just like to have a link to the exported list sent to your email set the `notifications.email` option to `true` in the `POST` payload.\n\nIf you would like to download the list, take the `id` that is returned and use the \"Export Contacts Status\" endpoint to get the `urls`. Once you have the list of URLs, make a `GET` request to each URL provided to download your CSV file(s).\n\nYou specify the segements and or/contact lists you wish to export by providing the relevant IDs in, respectively, the `segment_ids` and `list_ids` fields in the request body.\n\nThe lists will be provided in either JSON or CSV files. To specify which of these you would required, set the request body `file_type` field to `json` or `csv`.\n\nYou can also specify a maximum file size (in MB). If the export file is larger than this, it will be split into multiple files.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "list_ids": { "description": "IDs of the contact lists you want to export.", "type": "array", "items": { "type": "string", "format": "uuid" } }, "segment_ids": { "description": "IDs of the contact segments you want to export.", "type": "array", "items": { "type": "string" } }, "notifications": { "type": "object", "properties": { "email": { "type": "boolean" } } }, "file_type": { "type": "string", "enum": [ "csv", "json" ], "description": "File type for export file. Choose from `json` or `csv`.", "default": "csv" }, "max_file_size": { "description": "The maximum size of an export file in MB. Note that when this option is specified, multiple output files may be returned from the export.", "default": 5000, "type": "integer" } } } } ], "responses": { "202": { "description": "", "schema": { "type": "object", "properties": { "_metadata": { "$ref": "#/definitions/metadata" }, "id": { "type": "string", "description": "The ID of the export job." } }, "required": [ "_metadata" ] } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/error" } } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_marketing-contacts-exports", "summary": "Get All Existing Exports", "tags": [ "Contacts" ], "description": "**Use this endpoint to retrieve details of all current exported jobs**.\n\nIt will return an array of objects, each of which records an export job in flight or recently completed. \n\nEach object's `export_type` field will tell you which kind of export it is and its `status` field will indicate what stage of processing it has reached. Exports which are `ready` will be accompanied by a `urls` field which lists the URLs of the export's downloadable files — there will be more than one if you specified a maximum file size in your initial export request.\n\nUse this endpoint if you have exports in flight but do not know their IDs, which are required for the \"Export Contacts Status\" endpoint.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Export jobs ID." }, "status": { "type": "string", "description": "Allowed values: `pending`, `ready`, or `failure`." }, "created_at": { "type": "string", "description": "This ISO8601 timestamp when the export was created." }, "completed_at": { "type": "string", "description": "This ISO8601 timestamp when the export was completed." }, "expires_at": { "type": "string", "description": "This ISO8601 timestamp when the export expires." }, "urls": { "type": "array", "description": "One or more download URLs for the contact file(s) if the status is `ready`.", "items": { "type": "string" } }, "user_id": { "type": "string", "description": "User ID." }, "export_type": { "type": "string", "description": "Allowed types: `contacts_export`, `list_export`, or `segment_export`." }, "segments": { "type": "array", "items": { "type": "object", "properties": { "ID": { "type": "string" }, "Name": { "type": "string" } } } }, "lists": { "type": "array", "items": { "type": "object", "properties": { "ID": { "type": "string" }, "Name": { "type": "string" } } } }, "_metadata": { "type": "object", "properties": { "prev": { "type": "string" }, "self": { "type": "string" }, "next": { "type": "string" } } } } } }, "_metadata": { "type": "object", "properties": { "prev": { "type": "string" }, "self": { "type": "string", "description": "Link to this page." }, "next": { "type": "string", "description": "Link to next page." } } } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message" ] } } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_mc-contacts-id", "summary": "Get a Contact by ID", "tags": [ "Contacts" ], "description": "**This endpoint returns the full details and all fields for the specified contact**.\n\nThe \"Get Contacts by Emails\" endpoint can be used to get the ID of a contact.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contact-details3" } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts/search": { "post": { "operationId": "POST_mc-contacts-search", "summary": "Search Contacts", "tags": [ "Contacts" ], "description": "**Use this endpoint to locate contacts**.\n\nThe request body's `query` field accepts valid [SGQL](https://sendgrid.com/docs/for-developers/sending-email/segmentation-query-language/) for searching for a contact.\n\nBecause contact emails are stored in lower case, using SGQL to search by email address requires the provided email address to be in lower case. The SGQL `lower()` function can be used for this.\n\nOnly the first 50 contacts that meet the search criteria will be returned.\n\nIf the query takes longer than 20 seconds, a `408 Request Timeout` status will be returned.\n\nFormatting the `created_at` and `updated_at` values as Unix timestamps is deprecated. Instead they are returned as ISO format as string.\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "query": { "type": "string", "Description": "An SGQL search string or other pattern." } }, "required": [ "query" ], "example": { "query": "email LIKE 'ENTER_COMPLETE_OR_PARTIAL_EMAIL_ADDRESS_HERE%' AND CONTAINS(list_ids, 'YOUR_LIST_IDs')" } } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/contact-details3" } }, "_metadata": { "$ref": "#/definitions/selfmetadata" }, "contact_count": { "type": "number", "description": "The total number of contacts matched." } }, "required": [ "contact_count" ] } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" } } } } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "408": { "description": "" }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts/imports": { "put": { "operationId": "PUT_mc-contacts-imports", "summary": "Import Contacts", "tags": [ "Contacts" ], "description": "**This endpoint allows a CSV upload containing up to one million contacts or 5GB of data, whichever is smaller.**\n\nImports take place asynchronously: the endpoint returns a URL (`upload_uri`) and HTTP headers (`upload_headers`) which can subsequently be used to `PUT` a file of contacts to be imported into our system.\n\nUploaded CSV files may also be [gzip-compressed](https://en.wikipedia.org/wiki/Gzip).\n\nIn either case, you must include the field `file_type` with the value `csv` in your request body.\n\nThe `field_mappings` paramter is a respective list of field definition IDs to map the uploaded CSV columns to. It allows you to use CSVs where one or more columns are skipped (`null`) or remapped to the contact field. \n\nFor example, if `field_mappings` is set to `[null, \"w1\", \"_rf1\"]`, this means skip column 0, map column 1 to the custom field with the ID `w1`, and map column 2 to the reserved field with the ID `_rf1`. See the \"Get All Field Definitions\" endpoint to fetch your custom and reserved field IDs to use with `field_mappings`.\n\nOnce you recieve the response body you can then initiate a **second** API call where you use the supplied URL and HTTP header to upload your file. For example:\n\n`curl --upload-file \"file/path.csv\" \"URL_GIVEN\" -H 'HEADER_GIVEN'`\n\nIf you'd like to monitor the status of your import job, use the `job_id` and the \"Import Contacts Status\" endpoint.\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "list_ids": { "type": "array", "description": "All contacts will be added to each of the specified lists.", "items": { "type": "string" } }, "file_type": { "type": "string", "enum": [ "csv" ], "description": "Upload file type." }, "field_mappings": { "type": "array", "description": "Import file header to reserved/custom field mapping.", "uniqueItems": false, "minItems": 1, "items": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } } }, "required": [ "file_type", "field_mappings" ] } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "job_id": { "type": "string", "description": "The ID of the import job." }, "upload_uri": { "type": "string", "description": "The URI to PUT the upload file to." }, "upload_headers": { "type": "array", "description": "A list of headers that must be included in PUT request.", "items": { "type": "object", "properties": { "header": { "type": "string" }, "value": { "type": "string" } }, "required": [ "header", "value" ] } } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/definitions/error" } } }, "required": [ "errors" ] } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "type": "object", "description": "If any of the specified lists do not exist.", "properties": { "errors": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/definitions/error" } } }, "required": [ "errors" ] } }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts/imports/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_marketing-contacts-imports-id", "summary": "Import Contacts Status", "tags": [ "Contacts" ], "description": "**This endpoint can be used to check the status of a contact import job**. \n\nUse the `job_id` from the \"Import Contacts,\" \"Add or Update a Contact,\" or \"Delete Contacts\" endpoints as the `id` in the path parameter.\n\nIf there is an error with your `PUT` request, download the `errors_url` file and open it to view more details.\n\nThe job `status` field indicates whether the job is `pending`, `completed`, `errored`, or `failed`. \n\nPending means not started. Completed means finished without any errors. Errored means finished with some errors. Failed means finshed with all errors, or the job was entirely unprocessable: for example, if you attempt to import file format we do not support.\n\nThe `results` object will have fields depending on the job type.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contact-import" } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "$ref": "#/definitions/error" } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts/exports/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_mc-contacts-exports-id", "summary": "Export Contacts Status", "tags": [ "Contacts" ], "description": "**This endpoint can be used to check the status of a contact export job**. \n\nTo use this call, you will need the `id` from the \"Export Contacts\" call.\n\nIf you would like to download a list, take the `id` that is returned from the \"Export Contacts\" endpoint and make an API request here to get the `urls`. Once you have the list of URLs, make a `GET` request on each URL to download your CSV file(s).\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contact-export" } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/error" } } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/contacts/batch": { "post": { "operationId": "POST_marketing-contacts-batch", "summary": "Get Batched Contacts by IDs", "tags": [ "Contacts" ], "description": "**This endpoint is used to retrieve a set of contacts identified by their IDs.**\n\nThis can be more efficient endpoint to get contacts than making a series of individual `GET` requests to the \"Get a Contact by ID\" endpoint.\n\nYou can supply up to 100 IDs. Pass them into the `ids` field in your request body as an array or one or more strings.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "description": "Array of IDs", "properties": { "ids": { "maxItems": 100, "type": "array", "items": { "type": "string" } } }, "required": [ "ids" ], "example": { "ids": [ "1234", "1235" ] } } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/contact-details3" } } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "type": "object" } }, "500": { "$ref": "#/responses/trait:globalErrors:500" } } } }, "/marketing/contacts/search/emails": { "post": { "operationId": "POST_marketing-contacts-search-emails", "summary": "Get Contacts by Emails", "tags": [ "Contacts" ], "description": "**This endpoint allows you to retrieve up to 100 contacts matching the searched `email` address(es), including any `alternate_emails`.** \n\nEmail addresses are unique to a contact, meaning this endpoint can treat an email address as a primary key to search by. The contact object associated with the address, whether it is their `email` or one of their `alternate_emails` will be returned if matched.\n\nEmail addresses in the search request do not need to match the case in which they're stored, but the email addresses in the result will be all lower case. Empty strings are excluded from the search and will not be returned.\n\nThis endpoint should be used in place of the \"Search Contacts\" endpoint when you can provide exact email addresses and do not need to include other [Segmentation Query Language (SGQL)](https://sendgrid.com/docs/for-developers/sending-email/segmentation-query-language/) filters when searching.\n\nIf you need to access a large percentage of your contacts, we recommend exporting your contacts with the \"Export Contacts\" endpoint and filtering the results client side.\n\nThis endpoint returns a `200` status code when any contacts match the address(es) you supplied. When searching multiple addresses in a single request, it is possible that some addresses will match a contact while others will not. When a partially successful search like this is made, the matching contacts are returned in an object and an error message is returned for the email address(es) that are not found. \n\nThis endpoint returns a `404` status code when no contacts are found for the provided email address(es).\n\nA `400` status code is returned if any searched addresses are invalid.\n\nTwilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "description": "", "properties": { "emails": { "type": "array", "description": "One or more primary emails and/or alternate emails to search through your contacts for.", "items": { "type": "string", "maxLength": 100 } } }, "required": [ "emails" ], "example": { "emails": [ "jane_doe@example.com", "john_doe@example.com", "joann_doe@example.com" ] } } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "object", "additionalProperties": false, "patternProperties": { "^[A-Za-z0-9\\._%\\+-]+@[A-Za-z0-9\\.-]+\\.[A-Za-z]{2,6}$": { "type": "object", "description": "This will be one of the specified email adresses.", "properties": { "contact": { "$ref": "#/definitions/contact-details3" }, "error": { "type": "string" } } } } } } }, "examples": { "application/json": { "result": { "jane_doe@example.com": { "contact": { "address_line_1": "", "address_line_2": "", "alternate_emails": [ "janedoe@example1.com" ], "city": "", "country": "", "email": "jane_doe@example.com", "first_name": "Jane", "id": "asdf-Jkl-zxCvBNm", "last_name": "Doe", "list_ids": [], "segment_ids": [], "postal_code": "", "state_province_region": "", "phone_number": "", "whatsapp": "", "line": "", "facebook": "", "unique_name": "", "custom_fields": {}, "created_at": "2021-03-02T15:25:47Z", "updated_at": "2021-03-30T15:26:16Z", "_metadata": { "self": "" } } }, "john_doe@example.com": { "contact": { "address_line_1": "", "address_line_2": "", "alternate_emails": [], "city": "", "country": "", "email": "john_doe@example.com", "first_name": "Jane", "id": "asdf-Jkl-qWeRTy", "last_name": "Doe", "list_ids": [], "segment_ids": [], "postal_code": "", "state_province_region": "", "phone_number": "", "whatsapp": "", "line": "", "facebook": "", "unique_name": "", "custom_fields": {}, "created_at": "2020-01-02T15:25:47Z", "updated_at": "2020-12-20T15:26:16Z", "_metadata": { "self": "" } } }, "joann_doe@example.com": { "error": "contact not found" } } } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/segments/2.0": { "post": { "operationId": "POST_segments", "summary": "Create Segment", "tags": [ "Segmenting Contacts V2 - Beta" ], "description": "**The Segmentation V2 API is currently in private beta. If you'd like to be added to the beta, please fill out this [form]({https://docs.google.com/forms/d/e/1FAIpQLSd5zwC9dRk8lAp1oTWjdGc-aSY69flW_7wnutvKBhpUluSnfQ/viewform)**\n\nSegment `name` has to be unique. A user can not create a new segment with an existing segment name.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/segment_write_v2" } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/segment_response" } }, "400": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } }, "404": { "description": "" }, "429": { "description": "" }, "500": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_segments", "summary": "Get List of Segments", "tags": [ "Segmenting Contacts V2 - Beta" ], "description": "**The Segmentation V2 API is currently in private beta. If you'd like to be added to the beta, please fill out this [form]({https://docs.google.com/forms/d/e/1FAIpQLSd5zwC9dRk8lAp1oTWjdGc-aSY69flW_7wnutvKBhpUluSnfQ/viewform)**\n\nThe query param `parent_list_ids` is treated as a filter. Any match will be returned. 0 matches will return a response code of 200 with an empty `results` array.\n\n`parent_list_ids` | `no_parent_list_id` | `result`\n-----------------:|:--------------------:|:-------------\nempty | false | all segments\nvalues | false | segments filtered by list_ids\nvalues | true | segments filtered by list_ids and segments with no parent list_ids\nempty | true | segments with no parent list_ids", "parameters": [ { "name": "parent_list_ids", "in": "query", "description": "A comma separated list up to 50 in size, to filter segments on. Only segments that have any of these list ids as the parent list will be retrieved. This is different from the parameter of the same name used when creating a segment.", "required": false, "type": "string" }, { "name": "no_parent_list_id", "in": "query", "description": "If set to `true` segments with an empty value of `parent_list_id` will be returned in the filter. If the value is not present it defaults to 'false'.", "required": false, "type": "boolean", "default": false } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/all_segments_response" } }, "400": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } }, "404": { "description": "" }, "500": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/segments/2.0/{segment_id}": { "parameters": [ { "name": "segment_id", "in": "path", "required": true, "type": "string" } ], "patch": { "operationId": "PATCH_segments-segment_id", "summary": "Update Segment", "tags": [ "Segmenting Contacts V2 - Beta" ], "description": "**The Segmentation V2 API is currently in private beta. If you'd like to be added to the beta, please fill out this [form]({https://docs.google.com/forms/d/e/1FAIpQLSd5zwC9dRk8lAp1oTWjdGc-aSY69flW_7wnutvKBhpUluSnfQ/viewform)**\n\nSegment `name` has to be unique. A user can not create a new segment with an existing segment name.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/segment_update" } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/segment_response" } }, "400": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } }, "429": { "description": "" }, "500": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_segments-segment_id", "summary": "Get Segment by ID", "tags": [ "Segmenting Contacts V2 - Beta" ], "description": "**The Segmentation V2 API is currently in private beta. If you'd like to be added to the beta, please fill out this [form]({https://docs.google.com/forms/d/e/1FAIpQLSd5zwC9dRk8lAp1oTWjdGc-aSY69flW_7wnutvKBhpUluSnfQ/viewform)**", "parameters": [ { "name": "contacts_sample", "in": "query", "description": "Defaults to `true`. Set to `false` to exclude the contacts_sample in the response.", "type": "boolean" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/segment_response" } }, "400": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } }, "500": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_segments-segment_id", "summary": "Delete segment", "tags": [ "Segmenting Contacts V2 - Beta" ], "description": "**The Segmentation V2 API is currently in private beta. If you'd like to be added to the beta, please fill out this [form]({https://docs.google.com/forms/d/e/1FAIpQLSd5zwC9dRk8lAp1oTWjdGc-aSY69flW_7wnutvKBhpUluSnfQ/viewform)**", "responses": { "202": { "description": "" }, "400": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } }, "404": { "description": "" }, "500": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/senders": { "post": { "operationId": "POST_marketing-senders", "summary": "Create a Sender Identity", "tags": [ "Senders" ], "description": "**This endpoint allows you to create a new sender identity.**\n\n*You may create up to 100 unique sender identities.*\n\nSender identities are required to be verified before use. If your domain has been authenticated, a new sender identity will auto verify on creation. Otherwise an email will be sent to the `from.email`.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "nickname": { "type": "string", "description": "A nickname for the sender identity. Not used for sending." }, "from": { "type": "object", "required": [ "email", "name" ], "properties": { "email": { "type": "string", "description": "This is where the email will appear to originate from for your recipient" }, "name": { "type": "string", "description": "This is the name appended to the from email field. IE - Your name or company name." } } }, "reply_to": { "type": "object", "properties": { "email": { "type": "string", "description": "This is the email that your recipient will reply to." }, "name": { "type": "string", "description": "This is the name appended to the reply to email field. IE - Your name or company name." } }, "required": [ "email" ] }, "address": { "type": "string", "description": "The physical address of the sender identity." }, "address_2": { "type": "string", "description": "Additional sender identity address information." }, "city": { "type": "string", "description": "The city of the sender identity." }, "state": { "type": "string", "description": "The state of the sender identity." }, "zip": { "type": "string", "description": "The zipcode of the sender identity." }, "country": { "type": "string", "description": "The country of the sender identity." } }, "required": [ "nickname", "from", "address", "city", "country" ], "example": { "nickname": "Example Orders", "from": { "email": "orders@example.com", "name": "Example Orders" }, "reply_to": { "email": "support@example.com", "name": "Example Support" }, "address": "1234 Fake St.", "address_2": "", "city": "San Francisco", "state": "CA", "zip": "94105", "country": "United States" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/senderID" } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/lists": { "post": { "operationId": "POST_mc-lists", "summary": "Create List", "tags": [ "Lists" ], "description": "**This endpoint creates a new contacts list.**\n\nOnce you create a list, you can use the UI to [trigger an automation](https://sendgrid.com/docs/ui/sending-email/getting-started-with-automation/#create-an-automation) every time you add a new contact to the list.\n\nA link to the newly created object is in `_metadata`.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "Your name for your list", "minLength": 1, "maxLength": 100 } }, "required": [ "name" ], "example": { "name": "list-name" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/list" }, "examples": { "application/json": { "id": "ca7a3796-e8a8-4029-9ccb-df8937940562", "name": "list-name", "contact_count": 0, "_metadata": { "self": "https://api.sendgrid.com/v3/marketing/lists/ca7a3796-e8a8-4029-9ccb-df8937940562" } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/error" } } } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mc-lists", "summary": "Get All Lists", "tags": [ "Lists" ], "description": "**This endpoint returns an array of all of your contact lists.**", "parameters": [ { "name": "page_size", "in": "query", "description": "Maximum number of elements to return. Defaults to 100, returns 1000 max", "required": false, "type": "number", "default": 100, "minimum": 1, "maximum": 1000 }, { "name": "page_token", "in": "query", "required": false, "type": "string" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/list" } }, "_metadata": { "$ref": "#/definitions/metadata" } } }, "examples": { "application/json": { "result": [ { "id": "abc12312-x3y4-1234-abcd-123qwe456rty", "name": "list-name", "contact_count": 0, "_metadata": { "self": "https://api.sendgrid.com/v3/marketing/lists/abc12312-x3y4-1234-abcd-123qwe456rty" } } ], "_metadata": { "self": "https://api.sendgrid.com/v3/marketing/lists?page_size=100&page_token=" } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/lists/{id}/contacts/count": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_mc-lists-id-contacts-count", "summary": "Get List Contact Count", "tags": [ "Lists" ], "description": "**This endpoint returns the number of contacts on a specific list.**", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "contact_count": { "type": "integer" }, "billable_count": { "type": "integer" } } }, "examples": { "application/json": { "contact_count": 0, "billable_count:": 0 } } }, "404": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/lists/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_mc-lists-id", "summary": "Get a List by ID", "tags": [ "Lists" ], "description": "**This endpoint returns data about a specific list.**\n\nSetting the optional parameter `contact_sample=true` returns the `contact_sample` in the response body. Up to fifty of the most recent contacts uploaded or attached to a list will be returned, sorted alphabetically, by email address.\n\nThe full contact count is also returned.", "parameters": [ { "name": "contact_sample", "in": "query", "description": "Setting this parameter to the true will cause the contact_sample to be returned", "type": "boolean", "default": false } ], "responses": { "200": { "description": "", "schema": { "allOf": [ { "$ref": "#/definitions/list" }, { "type": "object", "properties": { "contact_sample": { "$ref": "#/definitions/contact-details2" } } } ] }, "examples": { "application/json": { "contact_count": 2, "contact_sample": { "id": "c3445f88-5c69-4237-86e6-9ec9de958050", "list_ids": [ "199abb98-0af3-4a8d-b371-6811ff85d062" ], "created_at": "2620-06-16T17:03:54.867Z", "updated_at": "4780-12-06T06:51:30.024Z" }, "_metadata": { "self": "https://api.sendgrid.com/v3/marketing/lists/199abb98-0af3-4a8d-b371-6811ff85d062" }, "id": "199abb98-0af3-4a8d-b371-6811ff85d062", "name": "list-name" } } }, "404": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/error" } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_mc-lists-id", "summary": "Update List", "tags": [ "Lists" ], "description": "**This endpoint updates the name of a list.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "Your name for your list." } }, "example": { "name": "updated-list-name" } } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/list" }, "examples": { "application/json": { "id": "abc12312-x3y4-1234-abcd-123qwe456rty", "name": "updated-list-name", "contact_count": 0, "_metadata": { "self": "https://api.sendgrid.com/v3/marketing/lists/abc12312-x3y4-1234-abcd-123qwe456rty" } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/error" } } } } }, "404": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_lists-id", "summary": "Delete a list", "tags": [ "Lists" ], "description": "**This endpoint allows you to deletes a specific list.**\n\nOptionally, you can also delete contacts associated to the list. The query parameter, `delete_contacts=true`, will delete the list and start an asynchronous job to delete associated contacts.", "parameters": [ { "name": "delete_contacts", "in": "query", "description": "Flag indicates that all contacts on the list are also to be deleted.", "required": false, "type": "boolean", "default": false } ], "responses": { "200": { "description": "", "schema": { "type": "object", "description": "The delete has been accepted and is processing.", "properties": { "job_id": { "type": "string", "description": "job_id of the async job" } } }, "examples": { "application/json": { "job_id": "abc12312-x3y4-1234-abcd-123qwe456rty" } } }, "204": { "description": "", "schema": { "type": "string", "description": "The delete has been processed. " } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object" } } }, "required": [ "errors" ] } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/lists/{id}/contacts": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "delete": { "operationId": "DELETE_mc-lists-id-contacts", "summary": "Remove Contacts from a List", "tags": [ "Lists" ], "description": "**This endpoint allows you to remove contacts from a given list.**\n\nThe contacts will not be deleted. Only their list membership will be changed.", "parameters": [ { "name": "contact_ids", "in": "query", "description": "comma separated list of contact ids", "required": true, "type": "string", "minLength": 1 } ], "responses": { "202": { "description": "", "schema": { "type": "object", "description": "The removal is accepted and processing.", "properties": { "job_id": { "type": "string", "description": "job_id of the async job" } } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/error" } }, "404": { "description": "", "schema": { "description": "If the specified list id does not exist. If the specified contact does not exist." } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/field_definitions": { "post": { "operationId": "POST_mc-field_definitions", "summary": "Create Custom Field Definition", "tags": [ "Custom Fields" ], "description": "**This endpoint creates a new custom field definition.**\n\nCustom field definitions are created with the given `name` and `field_type`. Although field names are stored in a case-sensitive manner, all field names must be case-insensitively unique. This means you may create a field named `CamelCase` or `camelcase`, but not both. Additionally, a Custom Field name cannot collide with any Reserved Field names. You should save the returned `id` value in order to update or delete the field at a later date. You can have up to 120 custom fields.\n\nThe custom field name should be created using only alphanumeric characters (A-Z and 0-9) and underscores (\\_). Custom fields can only begin with letters A-Z or underscores (_). The field type can be date, text, or number fields. The field type is important for creating segments from your contact database.\n\n**Note: Creating a custom field that begins with a number will cause issues with sending in Marketing Campaigns.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "field_type": { "type": "string", "enum": [ "Text", "Number", "Date" ] } }, "required": [ "name", "field_type" ], "example": { "name": "custom_field_name", "field_type": "Text" } } } ], "responses": { "200": { "description": "", "schema": { "allOf": [ { "$ref": "#/definitions/custom_field_definitions_response" }, { "type": "object", "properties": { "_metadata": { "$ref": "#/definitions/_metadata" } } } ] }, "examples": { "application/json": { "id": "a1_T", "name": "custom_field_name", "field_type": "Text", "_metadata": { "self": "https://api.sendgrid.com/v3/marketing/field_definitions/a1_B" } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/definitions/error" } } }, "required": [ "errors" ] } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_mc-field_definitions", "summary": "Get All Field Definitions", "tags": [ "Custom Fields" ], "description": "**This endpoint retrieves all defined Custom Fields and Reserved Fields.**", "responses": { "200": { "description": "", "schema": { "type": "object", "minProperties": 0, "maxProperties": 120, "properties": { "custom_fields": { "type": "array", "items": { "$ref": "#/definitions/custom_field_definitions_response" } }, "reserved_fields": { "$ref": "#/definitions/reserved_field_definitions_response" }, "_metadata": { "$ref": "#/definitions/_metadata" } }, "required": [ "custom_fields", "reserved_fields" ] }, "examples": { "application/json": { "custom_fields": [ { "id": "w1", "name": "num_orders", "field_type": "Number" }, { "id": "w2", "name": "dob", "field_type": "Date" } ], "reserved_fields": [ { "id": "_rf0_T", "name": "first_name", "field_type": "Text" }, { "id": "_rf1_T", "name": "last_name", "field_type": "Text" }, { "id": "_rf2_T", "name": "email", "field_type": "Text" }, { "id": "_rf3_T", "name": "alternate_emails", "field_type": "Text" }, { "id": "_rf4_T", "name": "address_line_1", "field_type": "Text" }, { "id": "_rf5_T", "name": "address_line_2", "field_type": "Text" }, { "id": "_rf6_T", "name": "city", "field_type": "Text" }, { "id": "_rf7_T", "name": "state_province_region", "field_type": "Text" }, { "id": "_rf8_T", "name": "postal_code", "field_type": "Text" }, { "id": "_rf9_T", "name": "country", "field_type": "Text" }, { "id": "_rf10_T", "name": "phone_number", "field_type": "Text" }, { "id": "_rf11_T", "name": "whatsapp", "field_type": "Text" }, { "id": "_rf12_T", "name": "line", "field_type": "Text" }, { "id": "_rf13_T", "name": "facebook", "field_type": "Text" }, { "id": "_rf14_T", "name": "unique_name", "field_type": "Text" }, { "id": "_rf15_T", "name": "email_domains", "field_type": "Text", "read_only": true }, { "id": "_rf16_D", "name": "last_clicked", "field_type": "Date", "read_only": true }, { "id": "_rf17_D", "name": "last_opened", "field_type": "Date", "read_only": true }, { "id": "_rf18_D", "name": "last_emailed", "field_type": "Date", "read_only": true }, { "id": "_rf19_T", "name": "singlesend_id", "field_type": "Text", "read_only": true }, { "id": "_rf20_T", "name": "automation_id", "field_type": "Text", "read_only": true }, { "id": "_rf21_D", "name": "created_at", "field_type": "Date", "read_only": true }, { "id": "_rf22_D", "name": "updated_at", "field_type": "Date", "read_only": true }, { "id": "_rf23_T", "name": "contact_id", "field_type": "Text", "read_only": true } ], "_metadata": { "self": "https://example.com/marketing/field_definitions" } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/field_definitions/{custom_field_id}": { "parameters": [ { "name": "custom_field_id", "in": "path", "required": true, "type": "string" } ], "patch": { "operationId": "PATCH_mc-field_definitions-custom_field_id", "summary": "Update Custom Field Definition", "tags": [ "Custom Fields" ], "description": "**This endopoint allows you to update a defined Custom Field.**\n\nOnly your Custom fields can be modified; Reserved Fields cannot be updated.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 } }, "required": [ "name" ], "example": { "name": "new_custom_field_name" } } } ], "responses": { "200": { "description": "", "schema": { "allOf": [ { "$ref": "#/definitions/custom_field_definitions_response" }, { "type": "object", "properties": { "_metadata": { "$ref": "#/definitions/_metadata" } } } ] }, "examples": { "application/json": { "id": "a1_T", "name": "custom_field_name", "field_type": "Text", "_metadata": { "self": "https://api.sendgrid.com/v3/marketing/field_definitions/a1_B" } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/definitions/error" } } }, "required": [ "errors" ] } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/definitions/error" } } }, "required": [ "errors" ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_mc-field_definitions-custom_field_id", "summary": "Delete Custom Field Definition", "tags": [ "Custom Fields" ], "description": "**This endpoint deletes a defined Custom Field.**\n\nYou cand delete only Custom Fields; Reserved Fields cannot be deleted.", "responses": { "204": { "description": "" }, "404": { "description": "", "schema": { "type": "object", "required": [ "errors" ], "properties": { "errors": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/definitions/error" } } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/segments": { "post": { "operationId": "POST_marketing-segments", "summary": "Create Segment", "tags": [ "segmenting contacts", "Segmenting Contacts" ], "description": "**This endpoint allows you to create a segment.**", "parameters": [ { "name": "body", "in": "body", "schema": { "allOf": [ { "$ref": "#/definitions/segment_write_v2" }, { "type": "object", "properties": { "parent_list_id": { "type": "string", "minLength": 36, "maxLength": 36, "format": "uuid", "description": "The id of the list if this segment is a child of a list. This implies the query is rewritten as `(${query_dsl}) AND CONTAINS(list_ids, ${parent_list_id})`" } } } ] } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/full-segment" }, "examples": { "application/json": { "id": "864feb2e-5e93-47bf-b63e-21746c988105", "contacts_count": 0, "created_at": "mollit labore aute deserunt ad", "sample_updated_at": "enim culpa in", "updated_at": "minim", "contact_summary": { "contact_id": "1a541ca7-9fef-42c8-8947-f3f8a3b33ffe", "primary_email": "D8OsYF5ok@YtX.kcg", "first_name": "exercitation Duis nisi", "last_name": "aut", "address_line_1": "ut sunt Duis eu", "address_line_2": "in culpa esse non", "city": "ÔXƫɋƄř", "state_province_region": "consequat culpa in", "postal_code": -88086402, "country": "eiusmod", "custom_fields": { "custom_field_name2": "dolore cillum", "custom_field_name1": "est mollit officia adipisicing dolo" }, "list_ids": [ "c856a255-12f1-4b55-8564-218fd7eb34a7", "130c8813-0d6f-4b9e-b154-736bb9db2ff8", "c245021d-4444-4086-a498-3ffee7fa8cdf" ] }, "name": "aute amet deserunt adipisicing", "query_dsl": "email LIKE %twilio.com", "next_sample_update": "culpa sit occaecat fugiat quis" } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } }, "required": [ "message" ] } } }, "required": [ "errors" ] } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_marketing-segments", "summary": "Get List of Segments", "tags": [ "segmenting contacts", "Segmenting Contacts" ], "description": "**This endpoint allows you to retrieve a list of segments.**\n\nThe query param `parent_list_ids` is treated as a filter. Any match will be returned. 0 matches will return a response code of 200 with an empty `results` array.\n\n`parent_list_ids` | `no_parent_list_id` | `result`\n-----------------:|:--------------------:|:-------------\nempty | false | all segments\nvalues | false | segments filtered by list_ids\nvalues | true | segments filtered by list_ids and segments with no parent list_ids\nempty | true | segments with no parent list_ids", "parameters": [ { "name": "parent_list_ids", "in": "query", "description": "A comma separated list of list ids to be used when searching for segments with the specified parent_list_id, no more than 50 is allowed", "type": "string" }, { "name": "no_parent_list_id", "in": "query", "description": "If set to `true` segments with an empty value of `parent_list_id` will be returned in the filter. If the value is not present it defaults to 'false'.", "type": "boolean", "default": false } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "results": { "type": "array", "uniqueItems": true, "minItems": 0, "items": { "$ref": "#/definitions/segment_summary" } } }, "required": [ "results" ] }, "examples": { "application/json": { "results": [ { "id": "12099613-91e5-4d09-a900-df7626325288", "contacts_count": 78434802, "created_at": "2921-01-27T19:33:36.479Z", "sample_updated_at": "4685-11-26T07:05:04.660Z", "updated_at": "2883-07-10T13:13:37.697Z" }, { "id": "60c37015-3734-4c8e-b293-68cfa2ae4fa5", "contacts_count": 34177253, "created_at": "2575-07-26T23:17:20.984Z", "sample_updated_at": "3074-09-04T09:49:58.127Z", "updated_at": "5116-10-15T07:37:40.838Z", "parent_list_id": "fd38af3d-3f69-4947-8dca-5fa967e7be82", "name": "amet" } ] } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } }, "required": [ "message" ] } } }, "required": [ "errors" ] } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/segments/{segment_id}": { "parameters": [ { "name": "segment_id", "in": "path", "required": true, "type": "string", "minLength": 36, "maxLength": 36, "format": "uuid" } ], "get": { "operationId": "GET_marketing-segments-segment_id", "summary": "Get Segment by ID", "tags": [ "segmenting contacts", "Segmenting Contacts" ], "description": "**This endpoint allows you to retrieve a single segment by ID.**", "parameters": [ { "name": "query_json", "in": "query", "description": "Defaults to `false`. Set to `true` to return the parsed SQL AST as a JSON object in the field `query_json`", "type": "boolean" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/full-segment" }, "examples": { "application/json": { "id": "3b049926-0a54-4a91-83f0-086ace63c530", "contacts_count": -83213117, "created_at": "voluptate sunt non fugiat", "sample_updated_at": "labore occaecat sunt enim", "updated_at": "sunt aliqui", "contacts_sample": [ { "contact_id": "e70eac25-1431-4231-bccd-1cfab432301e", "primary_email": "KLTF@SurgGzlAxCPOqhOUHYNBLsfpfE.trh", "alternate_emails": [ "dTeJZgU5uN9UYSo@nfIB.ijxg" ], "first_name": "ullamco esse culpa do", "last_name": "officia laboris veniam consequat", "address_line_1": "in occaecat labore est tempor", "address_line_2": "magna adipisicing", "city": "ƞó", "state_province_region": "culpa ut", "postal_code": -75218567, "country": "voluptate in in reprehenderit aliquip", "custom_fields": { "custom_field_name1": "amet deserunt mollit", "custom_field_name2": "minim consequat id" } }, { "contact_id": "db637d33-bce1-462c-ae9c-91ec4f761de6", "primary_email": "t7N5TjDmKhC0@gfdifW.ua", "alternate_emails": [ "gQol@Xcfilli.hc", "n4K7OdaVQh@YfsnF.ie", "TdnvS3nMStREn@miFjGzNDCPZWhiswJNxrFnOYdUAZEpesQ.yxpu", "xRzGDTTzzbYK@eJ.wpgb", "iI1rOpx2ct@aZhuYGZBxJLZ.phr" ], "first_name": "ea et eu", "last_name": "velit Ut laborum ipsu", "address_line_1": "labore", "address_line_2": "non", "city": "ĔȸąŸÂ¸ȠɏbɄ", "state_province_region": "deserunt dolore", "postal_code": -95171713, "country": "do", "list_ids": [ "c712288b-2300-4069-bef4-2e05b5948ec3", "9003ef29-5eb7-4951-898b-1b102e490d6e" ] } ], "name": "enim et anim", "query_dsl": "nostrud" } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } }, "required": [ "message", "field" ] } } }, "required": [ "errors" ] } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } }, "required": [ "message" ] } } }, "required": [ "errors" ] } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_marketing-segments-segment_id", "summary": "Update Segment", "tags": [ "segmenting contacts", "Segmenting Contacts" ], "description": "**This endpoint allows you to update a segment.**\n\nSegment `name` needs to be unique. A user can not update a segment name to an existing one.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/segment_write_v2" } } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/full-segment" }, "examples": { "application/json": { "id": "5fff6250-b766-4959-a183-2e1fa565c4ce", "contacts_count": -35493018, "created_at": "2014-12-23T17:18:52.907Z", "sample_updated_at": "2146-04-13T16:46:32.328Z", "updated_at": "4389-06-21T16:59:51.403Z", "contacts_sample": [ { "contact_id": "4cff9fdf-1bee-44f7-95dc-a101f9ed3cfe", "primary_email": "exmS@KIzibBSmaUUHQa.uvv", "alternate_emails": [ "qXP-RD97fLl@oEDaUynqnNRHJHdoJAWVGXwvI.qlv", "W0ngFWmR@WcQuSbPFVPZvLrjCFadfimFi.eqf", "mYBC0ea5UxFI@qwO.jh", "Nhf1OmY@KCSjTQsXYpbKrBUsQFHrnLuY.oef" ], "first_name": "consequat nulla in", "last_name": "irure nostrud elit eu", "address_line_1": "deserunt cillum aliqua nostrud ullamco", "address_line_2": "sint", "city": "ŷ(ç", "state_province_region": "minim", "postal_code": 62721676, "country": "consectetur quis voluptate", "list_ids": [ "f9d5987d-7a01-4a66-b77e-1f08a392304b", "b4e3b028-01d4-428b-9ef5-24bcd90fa02c", "fedab84f-9aa5-449d-99e2-7b1361f8ee61" ] }, { "contact_id": "093a66b8-bca8-4d8a-b32a-091d939c1928", "primary_email": "atNeYGC4nbF42@VOCUWuGaYr.ystm", "alternate_emails": [ "Zs6vnQbMU@XTamDsXEGJWBMMEacOc.hitv", "Epl@ySBrQCFJZnjggkAYLu.ppta" ], "first_name": "est", "last_name": "in", "address_line_1": "culpa eu eiusmod sint", "address_line_2": "sed velit sint", "city": "BĊJ", "state_province_region": "Lorem Ut aliqua elit", "postal_code": 33736880, "country": "in laboris Excepteur consequat", "custom_fields": { "custom_field_name2": "culpa Excepteur", "custom_field_name1": "esse magna Ut" } }, { "contact_id": "08939f9c-2c87-4639-bd07-16d41f90a5eb", "primary_email": "Jx660QHClqRrC@SavQvcdRpJlLqepwoEUCm.ar", "alternate_emails": [ "S8u@ZVGjHsXdSWtlhhad.ximc", "GA1MN72v3uA@MPDvMUmTYjwFCsEaGnFnvVzJVqUTl.ehws" ], "first_name": "sed eu veli", "last_name": "aliqua sit culpa", "address_line_1": "occaecat aute enim", "address_line_2": "ipsum quis in", "city": "ɌſĕĝȤ¶Ǖ", "state_province_region": "ut nisi sed esse", "postal_code": -66445052, "country": "occaecat veniam" }, { "contact_id": "0667ed97-7b7b-44aa-a115-0301067660d7", "primary_email": "AnoFtJq@IolRDmfj.njt", "alternate_emails": [ "F5WhHCA3oL6Ix@wOKzwIsvHbFi.mrlc" ], "first_name": "do mollit velit", "last_name": "voluptate dolor", "address_line_1": "et incididunt", "address_line_2": "veniam quis non exercitation Duis", "city": "DzƐȹŲdž", "state_province_region": "occaecat", "postal_code": -19694583, "country": "reprehenderit", "custom_fields": { "custom_field_name1": "dolor aute irure Excepteur" }, "list_ids": [ "ffd225a8-2008-4457-87af-1cffff5b1ccb" ] }, { "contact_id": "449767ca-d446-45f1-aa9b-432f441b5ca1", "primary_email": "kF4@gYYdAxzetJrWszLAHuBUTu.rzq", "alternate_emails": [ "ksqbx6BInlB@ouWBjjxwFBwVQjdnEKXy.xi", "TAe7F2m8dFlF@SirYykzbe.aj", "T9c2Y@HjVQY.zz", "p7ShfET@vMMnTUqoqngPSEqbpyoeWN.jlqn", "0VJSIhIUT2k@mJXVtdZVKKswW.xoca" ], "first_name": "irure laboris minim", "last_name": "id nostrud aliqua sit", "address_line_1": "dolor", "address_line_2": "elit ex labore sunt aliquip", "city": "ÝǘźƝǝƉ‘Ɲ", "state_province_region": "nostrud Duis non nulla laborum", "postal_code": 60466925, "country": "id sunt nisi", "custom_fields": { "custom_field_name2": "enim quis", "custom_field_name1": "amet" }, "list_ids": [ "2870627c-b9ea-4dcf-bde0-36c3e0e3eca9", "575d86aa-4dcc-4b7d-b7de-ded856913198", "fb82a17f-5777-439d-9b8c-2c565c8ddf20" ] } ], "name": "List Name", "query_dsl": "Email LIKE %twilio.com" } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } }, "required": [ "message", "field" ] } } }, "required": [ "errors" ] } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } }, "required": [ "message" ] } } }, "required": [ "errors" ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_marketing-segments-segment_id", "summary": "Delete Segment", "tags": [ "segmenting contacts", "Segmenting Contacts" ], "description": "**This endpoint allows you to delete a segment by `segment_id`.**\n\nNote that deleting a segment does not delete the contacts associated with the segment by default. Contacts associated with a deleted segment will remain in your list of all contacts and any other segments they belong to.", "responses": { "202": { "description": "", "schema": { "type": "object" } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } }, "required": [ "message", "field" ] } } }, "required": [ "errors" ] } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } }, "required": [ "message" ] } } }, "required": [ "errors" ] } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/segments/delete": { "post": { "operationId": "POST_marketing-segments-delete", "summary": "Bulk Delete Segments", "tags": [ "Segmenting Contacts" ], "description": "This endpoint allows you to delete segments in bulk.\n\nIf the segments are used by automations or the segments do not exist in the database, the segment IDs that could not be deleted along with automation IDs that are associated to those segments will be returned.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "ids": { "type": "array", "items": { "type": "string", "format": "uuid" } } }, "example": { "ids": [ "a14dcc63-d651-4c57-9826-4a3705f5c78d", "f3de551e-dc5c-4d42-bd08-c7f87f87f0e8", "1b8107b5-adf4-401c-8865-fa84ba178fb9", "d7900715-c904-4728-acff-9ab79627579e", "16641f5b-cfa3-41b9-9626-244488ee85b1" ] } } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Segment ID" }, "error": { "type": "string", "description": "error message that indicates why segment cannot be deleted (\"in-use\", \"segment not found\", \"invalid uuid\")" }, "resources": { "type": "object", "description": "resources in which segment is being used", "properties": { "type": { "type": "string", "description": "the type of resource in use (e.g., \"automation\")" }, "ids": { "type": "array", "description": "the resource ids", "items": { "type": "string" } } } } } } } } } }, "202": { "description": "", "schema": { "type": "object" } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" } } } } } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/singlesends": { "post": { "operationId": "POST_marketing-singlesends", "summary": "Create Single Send", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to create a new Single Send.**\n\nPlease note that if you are migrating from the previous version of Single Sends, you no longer need to pass a template ID with your request to this endpoint. Instead, you will pass all template data in the `email_config` object.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/singlesend_request", "example": { "name": "Example API Created Single Send", "categories": [ "unique opens" ], "send_to": { "all": true }, "email_config": { "design_id": "", "editor": "design", "suppression_group_id": 12345, "sender_id": 1234567 } } } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/singlesend_response" }, "examples": { "application/json": { "name": "Example API Created Single Send", "id": "27c21bbf-a12c-440b-b8bf-c526975328ca", "status": "scheduled", "created_at": "2020-05-18T17:28:27.272Z", "send_at": "2020-06-16T00:19:55.106Z", "categories": [ "unique opens" ], "email_config": { "subject": "", "html_content": "", "plain_content": "", "generate_plain_content": true, "editor": "code", "suppression_group_id": null, "custom_unsubscribe_url": null, "sender_id": null, "ip_pool": null }, "send_to": { "list_ids": [ "f2fe66a1-43f3-4e3a-87b1-c6a600d805f0" ] } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_marketing-singlesends", "summary": "Get All Single Sends", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to retrieve all your Single Sends.**\n\nReturns all of your Single Sends with condensed details about each, including the Single Sends' IDs. For more details about an individual Single Send, pass the Single Send's ID to the `/marketing/singlesends/{id}` endpoint.", "parameters": [ { "name": "page_size", "in": "query", "type": "integer" }, { "name": "page_token", "in": "query", "type": "string" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/singlesend_response_short" } }, "_metadata": { "$ref": "#/definitions/_metadata" } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_marketing-singlesends", "summary": "Bulk Delete Single Sends", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to delete multiple Single Sends using an array of Single Sends IDs.**\n\nTo first retrieve all your Single Sends' IDs, you can make a GET request to the `/marketing/singlensends` endpoint.\n\nPlease note that a DELETE request is permanent, and your Single Sends will not be recoverable after deletion.", "parameters": [ { "name": "ids", "in": "query", "description": "Single Send IDs to delete", "type": "array", "minItems": 1, "maxItems": 50, "items": { "type": "string" } } ], "responses": { "204": { "description": "" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/singlesends/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "post": { "operationId": "POST_marketing-singlesends-id", "summary": "Duplicate Single Send", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to duplicate an existing Single Send using its Single Send ID.**\n\nDuplicating a Single Send is useful when you want to create a Single Send but don't want to start from scratch. Once duplicated, you can update or edit the Single Send by making a PATCH request to the `/marketing/singlesends/{id}` endpoint.\n \nIf you leave the `name` field blank, your duplicate will be assigned the name of the Single Send it was copied from with the text “Copy of ” prepended to it. The `name` field length is limited to 100 characters, so the end of the new Single Send name, including “Copy of ”, will be trimmed if the name exceeds this limit.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "The name of the duplicate Single Send. If you choose to leave the name field blank, your duplicate will be assigned the name of the Single Send it was copied from with the text 'Copy of ' prepended to it. The end of the new Single Send name, including 'Copy of ', will be trimmed if the name exceeds the character limit." } } } } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/singlesend_response" } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_marketing-singlesends-id", "summary": "Update Single Send", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to update a Single Send using a Single Send ID.**\n\nYou only need to pass the fields you want to update. Any blank/missing fields will remain unaltered.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/singlesend_request" } } ], "responses": { "202": { "description": "", "schema": { "$ref": "#/definitions/singlesend_response" } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_marketing-singlesends-id", "summary": "Get Single Send by ID", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to retrieve details about one Single Send using a Single Send ID.**\n\nYou can retrieve all of your Single Sends by making a GET request to the `/marketing/singlesends` endpoint.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/singlesend_response" }, "examples": { "application/json": { "name": "single-send-1", "id": "2f6dec81-43b9-4c67-a890-3a38cb63b54a", "status": "scheduled", "created_at": "2020-12-13T16:24:42.013Z", "send_to": { "segment_ids": [ "dad84de3-bec4-4e04-b132-2cbfd4bb3789", "7dce758d-1155-4102-88d2-ca65565ac98b" ], "all": true } } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_marketing-singlesends-id", "summary": "Delete Single Send by ID", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to delete one Single Send using a Single Send ID.**\n\nTo first retrieve all your Single Sends' IDs, you can make a GET request to the `/marketing/singlensends` endpoint.\n\nPlease note that a `DELETE` request is permanent, and your Single Send will not be recoverable after deletion.", "responses": { "204": { "description": "" }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/singlesends/search": { "post": { "operationId": "POST_marketing-singlesends-search", "summary": "Get Single Sends Search", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to search for Single Sends based on specified criteria.**\n\nYou can search for Single Sends by passing a combination of values using the `name`, `status`, and `categories` request body fields.\n\nFor example, if you want to search for all Single Sends that are \"drafts\" or \"scheduled\" and also associated with the category \"shoes,\" your request body may look like the example below.\n\n```javascript\n{\n \"status\": [\n \"draft\",\n \"scheduled\"\n ],\n \"categories\": [\n \"shoes\"\n ],\n}\n```", "parameters": [ { "name": "page_size", "in": "query", "type": "integer" }, { "name": "page_token", "in": "query", "type": "string" }, { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/singlesend_search", "example": { "name": "specific-single-send-name", "status": [ "draft", "scheduled" ], "categories": [ "shoes" ] } } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/singlesend_response_short" } }, "_metadata": { "$ref": "#/definitions/_metadata" } } }, "examples": { "application/json": { "result": [ { "id": "df25ffdf-6a96-458a-9419-6d87d3094c6b", "name": "single-send-1", "status": "triggered", "categories": [ "shoes" ], "is_abtest": true, "updated_at": "3263-04-09T09:05:08.193Z", "created_at": "4739-10-29T07:11:32.476Z", "send_at": "2471-05-31T15:46:18.797Z" } ], "_metadata": { "self": "nwNSrPSWt7d", "prev": "P0Enoayd", "next": "DYEsTUDww9-", "count": 1 } } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/singlesends/{id}/schedule": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "put": { "operationId": "PUT_marketing-singlesends-id-schedule", "summary": "Schedule Single Send", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to schedule a Single Send for future delivery using a Single Send ID.**\n\nTo schedule a Single Send, you must pass a date string in ISO 8601 time format (yyyy-MM-ddTHH:mm:ssZ) using the required `send_at` field. For example, the ISO 8601 format for 9:00 AM UTC on May 6, 2020 would be `2020-05-06T09:00:00Z`. You may also pass the string `\"now\"` to send the Single Send immediately.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "send_at": { "type": "string", "description": "This is the ISO 8601 time at which to send the Single Send; must be in future, or the string \"now\"", "enum": [ "now" ], "format": "date-time" } }, "required": [ "send_at" ], "example": { "send_at": "3752-01-28T23:21:52.575Z" } } } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "send_at": { "type": "string", "description": "", "format": "date-time" }, "status": { "type": "string", "enum": [ "scheduled" ] } } }, "examples": { "application/json": { "send_at": "3752-01-28T23:21:52.575Z", "status": "scheduled" } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_marketing-singlesends-id-schedule", "summary": "Delete Single Send Schedule", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to cancel a scheduled Single Send using a Single Send ID.**\n\nMaking a DELETE request to this endpoint will cancel the scheduled sending of a Single Send. The request will not delete the Single Send itself. Deleting a Single Send can be done by passing a DELETE request to `/marketing/singlesends/{id}`.", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/singlesend_schedule" } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/singlesends/categories": { "get": { "operationId": "GET_marketing-singlesends-categories", "summary": "Get All Categories", "tags": [ "Single Sends" ], "description": "**This endpoint allows you to retrieve all the categories associated with your Single Sends.**\n\nThis endpoint will return your latest 1,000 categories.", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "categories": { "type": "array", "uniqueItems": true, "maxItems": 1000, "description": "list of latest one thousand unique categories associated with all Single Sends in ascending order", "items": { "type": "string" } } } }, "examples": { "application/json": { "categories": [ "equipment", "shoes", "sports" ] } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/test/send_email": { "post": { "operationId": "POST_marketing-test-send_email", "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**.\n\nBefore 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://sendgrid.api-docs.io/v3.0/transactional-templates).\n\n> Please note that this endpoint works with Dynamic Transactional Templates only. Legacy Transactional Templates will not be delivered.\n\nFor 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/).\n\nYou can also test your Single Sends in the [Twilio SendGrid Marketing Campaigns UI](https://mc.sendgrid.com/single-sends).", "parameters": [ { "name": "body", "in": "body", "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": [ "janedoe@example.com", "tiramisu@example.com", "bundt@example.com" ] } } } ], "responses": { "202": { "description": "", "schema": { "type": "object" } }, "400": { "$ref": "#/responses/trait:errorResponse:400" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/stats/automations": { "get": { "operationId": "getall-automation-stats", "summary": "Get All Automation Stats", "tags": [ "Marketing Campaigns Stats" ], "description": "**This endpoint allows you to retrieve stats for all your Automations.**\n\nBy default, all of your Automations will be returned, but you can specify a selection by passing in a comma-separated list of Automation IDs as the value of the query string parameter `automation_ids`.\n\nResponses are paginated. You can limit the number of responses returned per batch using the `page_size` query string parameter. The default is 50, but you specify a value between 1 and 100.\n\nYou can retrieve a specific page of responses with the `page_token` query string parameter.", "parameters": [ { "name": "automation_ids", "in": "query", "description": "This endpoint returns all automation IDs if no `automation_ids` are specified.", "type": "array", "minItems": 1, "maxItems": 25, "items": { "type": "string" } }, { "$ref": "#/parameters/trait:pagination:page_size" }, { "$ref": "#/parameters/trait:pagination:page_token" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/automations-response" } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/stats/automations/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "get-automation-stat", "summary": "Get Automation Stats by ID", "tags": [ "Marketing Campaigns Stats" ], "description": "**This endpoint allows you to retrieve stats for a single Automation using its ID.**\n\nMultiple Automation IDs can be retrieved using the \"Get All Automation Stats\" endpoint. Once you have an ID, this endpoint will return detailed stats for the single automation specified.\n\nYou may constrain the stats returned using the `start_date` and `end_date` query string parameters. You can also use the `group_by` and `aggregated_by` query string parameters to further refine the stats returned.", "parameters": [ { "$ref": "#/parameters/trait:automationQueryParams:group_by" }, { "$ref": "#/parameters/trait:automationQueryParams:step_ids" }, { "$ref": "#/parameters/trait:baseParams:aggregated_by" }, { "$ref": "#/parameters/trait:baseParams:start_date" }, { "$ref": "#/parameters/trait:baseParams:end_date" }, { "$ref": "#/parameters/trait:baseParams:timezone" }, { "$ref": "#/parameters/trait:pagination:page_size" }, { "$ref": "#/parameters/trait:pagination:page_token" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/automations-response" } }, "400": { "$ref": "#/responses/trait:errorResponse:400" }, "404": { "description": "" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/stats/singlesends": { "get": { "operationId": "getall-singlesend-stats", "summary": "Get All Single Sends Stats", "tags": [ "Marketing Campaigns Stats" ], "description": "**This endpoint allows you to retrieve stats for all your Single Sends.**\n\nBy default, all of your Single Sends will be returned, but you can specify a selection by passing in a comma-separated list of Single Send IDs as the value of the query string parameter `singlesend_ids`.\n\nResponses are paginated. You can limit the number of responses returned per batch using the `page_size` query string parameter. The default is 50, but you specify a value between 1 and 100.\n\nYou can retrieve a specific page of responses with the `page_token` query string parameter.", "parameters": [ { "name": "singlesend_ids", "in": "query", "description": "This endpoint returns all Single Send IDs if no IDs are included in `singlesend_ids`.", "type": "array", "minItems": 1, "maxItems": 25, "items": { "type": "string" } }, { "$ref": "#/parameters/trait:pagination:page_size" }, { "$ref": "#/parameters/trait:pagination:page_token" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/singlesends-response" } }, "400": { "$ref": "#/responses/trait:errorResponse:400" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/stats/singlesends/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "get-singlesend-stat", "summary": "Get Single Send Stats by ID", "tags": [ "Marketing Campaigns Stats" ], "description": "**This endpoint allows you to retrieve stats for an individual Single Send using a Single Send ID.**\n\nMultiple Single Send IDs can be retrieved using the \"Get All Single Sends Stats\" endpoint. Once you have an ID, this endpoint will return detailed stats for the Single Send specified.\n\nYou may constrain the stats returned using the `start_date` and `end_date` query string parameters. You can also use the `group_by` and `aggregated_by` query string parameters to further refine the stats returned.", "parameters": [ { "$ref": "#/parameters/trait:baseParams:aggregated_by" }, { "$ref": "#/parameters/trait:baseParams:start_date" }, { "$ref": "#/parameters/trait:baseParams:end_date" }, { "$ref": "#/parameters/trait:baseParams:timezone" }, { "$ref": "#/parameters/trait:pagination:page_size" }, { "$ref": "#/parameters/trait:pagination:page_token" }, { "$ref": "#/parameters/trait:singlesendQueryParams:group_by" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/singlesends-response" } }, "400": { "$ref": "#/responses/trait:errorResponse:400" }, "404": { "description": "" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/stats/automations/{id}/links": { "parameters": [ { "name": "id", "in": "path", "description": "The ID of the Automation you want to get click tracking stats for. ", "required": true, "type": "string", "format": "uuid" } ], "get": { "operationId": "get-automation-link-stat", "summary": "Get Automation Click Tracking Stats by ID", "tags": [ "Marketing Campaigns Stats" ], "description": "**This endpoint lets you retrieve click-tracking stats for a single Automation**.\n\nThe stats returned list the URLs embedded in your Automation and the number of clicks each one received.\n\nResponses are paginated. You can limit the number of responses returned per batch using the `page_size` query string parameter. The default is 50, but you specify a value between 1 and 100.\n\nYou can retrieve a specific page of responses with the `page_token` query string parameter.", "parameters": [ { "$ref": "#/parameters/trait:automationQueryParams:group_by" }, { "$ref": "#/parameters/trait:automationQueryParams:step_ids" }, { "$ref": "#/parameters/trait:pagination:page_size" }, { "$ref": "#/parameters/trait:pagination:page_token" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/automations-link-stats-response" } }, "400": { "$ref": "#/responses/trait:errorResponse:400" }, "404": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/stats/singlesends/{id}/links": { "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "get-singlesend-link-stat", "summary": "Get Single Send Click Tracking Stats by ID", "tags": [ "Marketing Campaigns Stats" ], "description": "**This endpoint lets you retrieve click-tracking stats for one Single Send**.\n\nThe stats returned list the URLs embedded in the specified Single Send and the number of clicks each one received.\n\nResponses are paginated. You can limit the number of responses returned per batch using the `page_size` query string parameter. The default is 50, but you specify a value between 1 and 100.\n\nYou can retrieve a specific page of responses with the `page_token` query string parameter.", "parameters": [ { "$ref": "#/parameters/trait:pagination:page_size" }, { "$ref": "#/parameters/trait:pagination:page_token" }, { "$ref": "#/parameters/trait:singlesendQueryParams2:group_by" }, { "$ref": "#/parameters/trait:singlesendQueryParams2:ab_variation_id" }, { "$ref": "#/parameters/trait:singlesendQueryParams2:ab_phase_id" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/singlesends-link-stats-response" } }, "400": { "$ref": "#/responses/trait:errorResponse:400" }, "404": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/marketing/stats/singlesends/export": { "get": { "operationId": "get-singlesend-stats-export", "summary": "Export Single Send Stats", "tags": [ "Marketing Campaigns Stats" ], "description": "**This endpoint allows you to export Single Send stats as .CSV data**.\n\nYou can specify one Single Send or many: include as many Single Send IDs as you need, separating them with commas, as the value of the `ids` query string paramter.\n\nThe data is returned as plain text response but in .CSV format, so your application making the call can present the information in whatever way is most appropriate, or just save the data as a .csv file.", "parameters": [ { "name": "ids", "in": "query", "description": "The IDs of Single Sends for which to export stats.", "type": "array", "minItems": 1, "maxItems": 50, "items": { "type": "string" } }, { "name": "timezone", "in": "query", "description": "The [IANA Area/Region](https://en.wikipedia.org/wiki/Tz_database#Names_of_time_zones) string representing the timezone in which the stats are to be presented; i.e. `\"America/Chicago\"`. This parameter changes the timezone format only; it does not alter which stats are returned.", "type": "string", "default": "UTC" } ], "responses": { "200": { "description": "", "schema": { "type": "string", "description": "CSV data" } }, "400": { "description": "" } }, "security": [ { "Authorization": [] } ] } }, "/marketing/stats/automations/export": { "get": { "operationId": "get-automations-stats-export", "summary": "Export Automation Stats", "tags": [ "Marketing Campaigns Stats" ], "description": "**This endpoint allows you to export Automation stats as CSV data**.\n\nYou can specify one Automation or many: include as many Automation IDs as you need, separating them with commas, as the value of the `ids` query string paramter.\n\nThe data is returned as plain text response but in CSV format, so your application making the call can present the information in whatever way is most appropriate, or just save the data as a `.csv` file.", "parameters": [ { "name": "ids", "in": "query", "description": "The IDs of Automations for which to export stats.", "type": "array", "minItems": 1, "maxItems": 50, "items": { "type": "string" } }, { "name": "timezone", "in": "query", "description": "The [IANA Area/Region](https://en.wikipedia.org/wiki/Tz_database#Names_of_time_zones) string representing the timezone in which the stats are to be presented; i.e. `\"America/Chicago\"`. This parameter changes the timezone format only; it does not alter which stats are returned.", "type": "string", "default": "UTC" } ], "responses": { "200": { "description": "", "schema": { "type": "string", "description": "CSV data" } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } } }, "security": [ { "Authorization": [] } ] } }, "/senders": { "post": { "operationId": "POST_senders", "summary": "Create a Sender Identity", "tags": [ "Sender Identities API" ], "description": "**This endpoint allows you to create a new sender identity.**\n\nYou may create up to 100 unique sender identities.", "parameters": [ { "name": "body", "in": "body", "schema": { "allOf": [ { "$ref": "#/definitions/sender-id-request" }, { "type": "object", "properties": { "from": { "type": "object", "required": [ "email" ] }, "reply_to": { "type": "object", "required": [ "email" ] } }, "required": [ "nickname", "address", "city", "country" ] } ], "example": { "nickname": "My Sender ID", "from": { "email": "from@example.com", "name": "Example INC" }, "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "state": "Colorado", "zip": "80202", "country": "United States" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/senderID" }, "examples": { "application/json": { "id": 1, "nickname": "My Sender ID", "from": { "email": "from@example.com", "name": "Example INC" }, "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "state": "Colorado", "zip": "80202", "country": "United States", "verified": true, "updated_at": 1449872165, "created_at": 1449872165, "locked": false } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "The JSON you have submitted cannot be parsed.", "field": "" }, { "message": "You've reached your limit of 100 sender identities. Please delete one or more and try again.", "field": "" }, { "message": "nickname is required.", "field": "nickname" }, { "message": "You already have a sender identity with the same nickname.", "field": "nickname" }, { "message": "from_name is required.", "field": "from_name" }, { "message": "from_email is required.", "field": "from_email" }, { "message": "From email is not a valid email address.", "field": "from_email" }, { "message": "reply_to is required.", "field": "reply_to" }, { "message": "Reply to email is not a valid email address.", "field": "reply_to" }, { "message": "address is required.", "field": "address" }, { "message": "city is required.", "field": "city" }, { "message": "country is required.", "field": "country" } ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_v3-senders", "summary": "Get all Sender Identities", "tags": [ "Sender Identities API" ], "description": "**This endpoint allows you to retrieve a list of all sender identities that have been created for your account.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/senderID" } } } }, "examples": { "application/json": { "result": [ { "id": 1, "nickname": "My Sender ID", "from": { "email": "from@example.com", "name": "Example INC" }, "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "state": "Colorado", "zip": "80202", "country": "United States", "verified": true, "updated_at": 1449872165, "created_at": 1449872165, "locked": false } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/senders/{sender_id}": { "parameters": [ { "name": "sender_id", "in": "path", "description": "The ID of the sender identity that you want to retrieve.", "required": true, "type": "integer" } ], "get": { "operationId": "GET_v3-senders-sender_id", "summary": "View a Sender Identity", "tags": [ "Sender Identities API" ], "description": "**This endpoint allows you to retrieve a specific sender identity.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/senderID" }, "examples": { "application/json": { "id": 1, "nickname": "My Sender ID", "from": { "email": "from@example.com", "name": "Example INC" }, "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "state": "Colorado", "zip": "80202", "country": "United States", "verified": true, "updated_at": 1449872165, "created_at": 1449872165, "locked": false } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "resource not found", "field": "id" } ] } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_v3-senders-sender_id", "summary": "Update a Sender Identity", "tags": [ "Sender Identities API" ], "description": "**This endpoint allows you to update a sender identity.**\n\nUpdates to `from.email` require re-verification.\n\nPartial updates are allowed, but fields that are marked as \"required\" in the POST (create) endpoint must not be nil if that field is included in the PATCH request.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/sender-id-request", "example": { "nickname": "My Sender ID", "from": { "email": "from@example.com", "name": "Example INC" }, "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "state": "Colorado", "zip": "80202", "country": "United States" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/senderID" }, "examples": { "application/json": { "id": 1, "nickname": "My Sender ID", "from": { "email": "from@example.com", "name": "Example INC" }, "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "state": "Colorado", "zip": "80202", "country": "United States", "verified": true, "updated_at": 1449872165, "created_at": 1449872165, "locked": false } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "The JSON you have submitted cannot be parsed.", "field": "" }, { "message": "nickname is required.", "field": "nickname" }, { "message": "You already have a sender identity with the same nickname.", "field": "nickname" }, { "message": "from_name is required.", "field": "from_name" }, { "message": "from_email is required.", "field": "from_email" }, { "message": "From email is not a valid email address.", "field": "from_email" }, { "message": "reply_to is required.", "field": "reply_to" }, { "message": "Reply to email is not a valid email address.", "field": "reply_to" }, { "message": "address is required.", "field": "address" }, { "message": "city is required.", "field": "city" }, { "message": "country is required.", "field": "country" } ] } } }, "403": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "You may only update a sender identity when it is unlocked.", "field": "locked" } ] } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "resource not found", "field": "id" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_v3-senders-sender_id", "summary": "Delete a Sender Identity", "tags": [ "Sender Identities API" ], "description": "**This endoint allows you to delete one of your sender identities.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } }, "403": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "You may only delete a sender identity when it is unlocked.", "field": "locked" } ] } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "resource not found", "field": "id" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/senders/{sender_id}/resend_verification": { "parameters": [ { "name": "sender_id", "in": "path", "description": "The ID of the sender identity for which you would like to resend a verification email.", "required": true, "type": "integer" } ], "post": { "operationId": "POST_v3-senders-sender_id-resend_verification", "summary": "Resend Sender Identity Verification", "tags": [ "Sender Identities API" ], "description": "**This enpdoint allows you to resend a sender identity verification email.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "The Sender Identity is already verified. No email sent.", "field": "" } ] } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "resource not found", "field": "id" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/lists": { "post": { "operationId": "POST_contactdb-lists", "summary": "Create a List", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to create a list for your recipients.**", "parameters": [ { "name": "body", "in": "body", "schema": { "title": "Create a List request", "type": "object", "properties": { "name": { "type": "string" } }, "required": [ "name" ], "example": { "name": "your list name" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/contactdb_list" }, "examples": { "application/json": { "id": 1, "name": "your list name", "recipient_count": 0 } } }, "400": { "description": "\"name\" : \"Returned if list name is a duplicate of an existing list or segment\"\n\"name\" : \"Returned if list name is not a string\"\n\"\" : \"Returned if request body is invalid JSON\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "Returned if request body is invalid JSON" }, { "field": "name", "message": "Returned if list name is not a string" }, { "field": "name", "message": "Returned if list name is a duplicate of an existing list or segment" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_contactdb-lists", "summary": "Retrieve all lists", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to retrieve all of your recipient lists. If you don't have any lists, an empty array will be returned.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "List All Lists response", "type": "object", "properties": { "lists": { "type": "array", "items": { "$ref": "#/definitions/contactdb_list" } } }, "required": [ "lists" ] }, "examples": { "application/json": { "lists": [ { "id": 1, "name": "the jones", "recipient_count": 1 } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_contactdb-lists", "summary": "Delete Multiple lists", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to delete multiple recipient lists.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "array", "items": { "type": "integer" }, "example": [ 1, 2, 3, 4 ] } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "null" } }, "400": { "description": "\"id\" : \"Returned if all list ids are not valid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "list id was invalid" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/lists/{list_id}": { "parameters": [ { "name": "list_id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_contactdb-lists-list_id", "summary": "Retrieve a single list", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to retrieve a single recipient list.**", "parameters": [ { "name": "list_id", "in": "query", "description": "The ID of the list to retrieve.", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contactdb_list" }, "examples": { "application/json": { "id": 1, "name": "listname", "recipient_count": 0 } } }, "400": { "description": "\"list_id\" : \"Returned if list_id is not valid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "invalid id" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"list_id\" : \"Returned if list_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "List ID does not exist" } ] } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_contactdb-lists-list_id", "summary": "Update a List", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to update the name of one of your recipient lists.**", "parameters": [ { "name": "list_id", "in": "query", "description": "The ID of the list you are updating.", "required": true, "type": "integer" }, { "name": "body", "in": "body", "schema": { "title": "Update a List request", "type": "object", "properties": { "name": { "type": "string", "description": "The new name for your list. " } }, "required": [ "name" ], "example": { "name": "newlistname" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the list" }, "name": { "type": "string", "description": "The new name for the list" }, "recipient_count": { "type": "integer", "description": "The number of recipients on the list" } } }, "examples": { "application/json": { "id": 1234, "name": "2016 iPhone Users", "recipient_count": 0 } } }, "400": { "description": "\"name\" : \"Returned if list name is a duplicate of existing list or segment\"\n\"name\" : \"Returned if list name is invalid or not provided\"\n\"list_id\" : \"Returned if list_id is not valid\"\n\"\" : \"Returned if request body is invalid JSON\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "invalid id" } ] } } }, "404": { "description": "\"list_id\" : \"Returned if list_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "List ID does not exist" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_contactdb-lists-list_id", "summary": "Delete a List", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to delete a specific recipient list with the given ID.**", "parameters": [ { "name": "delete_contacts", "in": "query", "description": "Adds the ability to delete all contacts on the list in addition to deleting the list.", "type": "boolean", "enum": [ true, false ] }, { "name": "body", "in": "body", "schema": { "type": "null" } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "202": { "description": "", "schema": { "type": "null" } }, "400": { "description": "\"list_id\" : \"Returned if list_id is not valid\"\n\"delete_contacts\" : \"Returned if delete_contacts is not valid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "delete_contacts", "message": "delete_contacts not a bool" }, { "field": "list_id", "message": "Returned if list_id is not valid" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"list_id\" : \"Returned if list_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "List not found: 5" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/lists/{list_id}/recipients": { "parameters": [ { "name": "list_id", "in": "path", "description": "The id of the list of recipients you want to retrieve.", "required": true, "type": "integer" } ], "get": { "operationId": "GET_contactdb-lists-list_id-recipients", "summary": "Retrieve all recipients on a List", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to retrieve all recipients on the list with the given ID.**", "parameters": [ { "name": "page", "in": "query", "description": "Page index of first recipient to return (must be a positive integer)", "required": false, "type": "integer" }, { "name": "page_size", "in": "query", "description": "Number of recipients to return at a time (must be a positive integer between 1 and 1000)", "required": false, "type": "integer" }, { "name": "list_id", "in": "query", "description": "The ID of the list whose recipients you are requesting.", "required": true, "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "recipients": { "type": "array", "items": { "$ref": "#/definitions/contactdb_recipient" } } } }, "examples": { "application/json": { "recipients": [ { "created_at": 1433348344, "custom_fields": [ { "id": 6234, "name": "age", "type": "number", "value": null }, { "id": 6233, "name": "country", "type": "text", "value": null }, { "id": 6235, "name": "fname", "type": "text", "value": "Example" }, { "id": 6239, "name": "lname", "type": "text", "value": "User" }, { "id": 6240, "name": "lname", "type": "text", "value": null } ], "email": "example@example.com", "first_name": "Example", "id": "ZGVWfyZWsuYmFpbmVzQHNlbmRmCmLkLmNv==", "last_clicked": 1438616117, "last_emailed": 1438613272, "last_name": "User", "last_opened": 1438616109, "updated_at": 1438616119 } ] } } }, "400": { "description": "\"list_id\" : \"Returned if list_id is not a valid integer\"\n\"page\" : \"Returned if page is not a valid integer\"\n\"page\" : \"Returned if page is less than 1\"\n\"page_size\" : \"Returned if page_size is not a valid integer\"\n\"page_size\" : \"Returned if page_size is less than 1 or greater than 1000\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "list_id", "message": "Returned if list_id is not a valid integer" }, { "field": "page", "message": "Returned if page is not a valid integer" }, { "field": "page", "message": "Returned if page is less than 1" }, { "field": "page_size", "message": "Returned if page_size is not a valid integer" }, { "field": "page_size", "message": "Returned if page_size is less than 1 or greater than 1000" } ] } } }, "404": { "description": "\"list_id\" : \"Returned if list_id does not exist\"", "schema": { "type": "object" }, "examples": { "application/json": { "errors": [ { "field": "list_id", "message": "Returned if list_id is invalid" } ] } } } }, "security": [ { "Authorization": [] } ] }, "post": { "operationId": "POST_contactdb-lists-list_id-recipients", "summary": "Add Multiple Recipients to a List", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to add multiple recipients to a list.**\n\nAdds existing recipients to a list, passing in the recipient IDs to add. Recipient IDs should be passed exactly as they are returned from recipient endpoints.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "array", "items": { "type": "integer" }, "example": [ "recipient_id1", "recipient_id2" ] } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "type": "null" } }, "400": { "description": "\"list_id\" : \"Returned if list_id is not a valid integer\"\n\"\" : \"Returned if no valid recipient ids were passed\"\n\"\" : \"Returned if no recipients were added\"\n\"\" : \"Returned if request body is invalid JSON\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "list_id", "message": "list_id is invalid" }, { "field": "recipient_id", "message": "no valid recipients were provided" }, { "field": null, "message": "no recipients were added" }, { "field": null, "message": "request body is invalid JSON" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"list_id\": \"Returned if list_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "list_id", "message": "list_id does not exist" }, { "field": "recipient_id", "message": "recipient_id does not exist" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/lists/{list_id}/recipients/{recipient_id}": { "parameters": [ { "name": "list_id", "in": "path", "description": "The ID of the list that you want to add the recipient to.", "required": true, "type": "integer" }, { "name": "recipient_id", "in": "path", "description": "The ID of the recipient you are adding to the list.", "required": true, "type": "string" } ], "post": { "operationId": "POST_contactdb-lists-list_id-recipients-recipient_id", "summary": "Add a Single Recipient to a List", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to add a single recipient to a list.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "type": "null" } }, "400": { "description": "\"list_id\" : \"Returned if list_id is invalid\"\n\"recipient_id\" : \"Returned if recipient_id is invalid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "list_id", "message": "Returned if list_id is invalid" }, { "field": "recipient_id", "message": "Returned if recipient_id is invalid" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"list_id\" : \"Returned if list_id does not exist\"\n\"recipient_id\" : \"Returned if recipient_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "list_id", "message": "Returned if list_id does not exist" }, { "field": "recipient_id", "message": "Returned if recipient_id does not exist" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_contactdb-lists-list_id-recipients-recipient_id", "summary": "Delete a Single Recipient from a Single List", "tags": [ "Contacts API - Lists" ], "description": "**This endpoint allows you to delete a single recipient from a list.**", "parameters": [ { "name": "list_id", "in": "query", "description": "The ID of the list you are taking this recipient away from.", "required": true, "type": "integer" }, { "name": "recipient_id", "in": "query", "description": "The ID of the recipient to take off the list.", "required": true, "type": "integer" }, { "name": "body", "in": "body", "schema": { "type": "null" } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "null" } }, "400": { "description": "\"list_id\" : \"Returned if list_id is not valid\"\n\"recipient_id\" : \"Returned if recipient_id is not valid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "list_id", "message": "Returned if list_id is invalid" }, { "field": "recipient_id", "message": "no valid recipients were provided" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"list_id\" : \"Returned if list_id does not exist\"\n\"recipient_id\" : \"Returned if recipient_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "list_id", "message": "Returned if list_id does not exist" }, { "field": "recipient_id", "message": "Returned if recipient_id does not exist" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/recipients": { "post": { "operationId": "POST_contactdb-recipients", "summary": "Add recipients", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to add a Marketing Campaigns recipient.**\n\nYou can add custom field data as a parameter on this endpoint. We have provided an example using some of the default custom fields SendGrid provides.\n\nThe rate limit is three requests every 2 seconds. You can upload 1000 contacts per request. So the maximum upload rate is 1500 recipients per second.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "array", "items": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address of the recipient.", "format": "email" }, "first_name": { "type": "string", "description": "The first name of the recipient." }, "last_name": { "type": "string", "description": "The last name of the recipient." }, "age": { "type": "integer" } }, "required": [ "email" ] }, "example": [ { "email": "example@example.com", "first_name": "", "last_name": "User", "age": 25 }, { "email": "example2@example.com", "first_name": "Example", "last_name": "User", "age": 25 } ] } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/contactdb_recipient_response" }, "examples": { "application/json": { "error_count": 1, "error_indices": [ 2 ], "new_count": 2, "persisted_recipients": [ "YUBh", "bWlsbGVyQG1pbGxlci50ZXN0" ], "updated_count": 0, "errors": [ { "message": "Invalid email.", "error_indices": [ 2 ] } ] } } }, "400": { "description": "\"\" : \"Returned if request body is not valid json\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "Request body is not valid json" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_contactdb-recipients", "summary": "Update Recipient", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to update one or more recipients.**\n\nThe body of an API call to this endpoint must include an array of one or more recipient objects.\n\nIt is of note that you can add custom field data as parameters on recipient objects. We have provided an example using some of the default custom fields SendGrid provides.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "array", "items": { "type": "object", "properties": { "email": { "type": "string", "format": "email" }, "last_name": { "type": "string", "description": "The last name of the recipient. This is one of the default custom fields." }, "first_name": { "type": "string", "description": "The first name of the recipient. This is one of the default custom fields." } }, "required": [ "email" ] }, "example": [ { "email": "jones@example.com", "last_name": "Jones", "first_name": "Guy" } ] } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/contactdb_recipient_response" } }, "400": { "description": "\"\" : \"Returned if request body is not valid json\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "Request body is not valid json" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_contactdb-recipients", "summary": "Delete Recipients", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to deletes one or more recipients.**\n\nThe body of an API call to this endpoint must include an array of recipient IDs of the recipients you want to delete.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "array", "items": { "type": "string" }, "example": [ "recipient_id1", "recipient_id2" ] } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object" } }, "400": { "description": "\"\" : \"Returned if no recipients are deleted\"\n\"\" : \"Returned if all of the provided recipient ids are invalid\"\n\"\" : \"Returned if request body is not valid json\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "No recipient ids provided" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_contactdb-recipients", "summary": "Retrieve recipients", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to retrieve all of your Marketing Campaigns recipients.**\n\nBatch deletion of a page makes it possible to receive an empty page of recipients before reaching the end of\nthe list of recipients. To avoid this issue; iterate over pages until a 404 is retrieved.", "parameters": [ { "name": "page", "in": "query", "description": "Page index of first recipients to return (must be a positive integer)", "type": "integer" }, { "name": "page_size", "in": "query", "description": "Number of recipients to return at a time (must be a positive integer between 1 and 1000)", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "List Recipients response", "type": "object", "properties": { "recipients": { "type": "array", "items": { "type": "object" } } }, "required": [ "recipients" ] } }, "400": { "description": "\"page\" : \"Returned if page is not a valid integer\"\n\"page\" : \"Returned if page is less than 1\"\n\"page_size\" : \"Returned if page_size is not a valid integer\"\n\"page_size\" : \"Returned if page_size is less than 1 or greater than 1000\"", "schema": { "type": "object" } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/status": { "get": { "operationId": "GET_contactdb-status", "summary": "Get Recipient Upload Status", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to check the upload status of a Marketing Campaigns recipient.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "status": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "default": "", "description": "Valid values are \"worker_delay\" and \"worker_delay_seconds\" (the second value appears only if \"worker_delay\" has a value of \"delayed\")." }, "value": { "type": "string", "default": "", "description": "Valid values for the ID \"worker_delay\" are \"OK\" or \"Delayed\". Valid values for the ID \"worker_delay_seconds\" is the time of delay to upload." }, "": { "type": "string" } } } } } }, "examples": { "application/json": { "status": [ { "id": "worker_delay", "value": "delayed" }, { "id": "worker_delay_seconds", "value": "75.0" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/recipients/{recipient_id}": { "parameters": [ { "name": "recipient_id", "in": "path", "description": "The ID of the recipient that you want to retrieve.", "required": true, "type": "string" } ], "get": { "operationId": "GET_contactdb-recipients-recipient_id", "summary": "Retrieve a single recipient", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to retrieve a single recipient by ID from your contact database.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contactdb_recipient" } }, "400": { "description": "\"recipient_id\" : \"Returned if recipient_id is not valid\"", "schema": { "type": "object" } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"recipient_id\" : \"Returned if record for recipient id does not exist\"", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_contactdb-recipients-recipient_id", "summary": "Delete a Recipient", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to delete a single recipient with the given ID from your contact database.**\n\n> Use this to permanently delete your recipients from all of your contact lists and all segments if required by applicable law.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } }, "400": { "description": "\"recipient_id\" : \"Returned if recipient_id is not valid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "recipient not found" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"recipient_id\" : \"Returned if record for recipient id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "recipient_id is not valid" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/recipients/{recipient_id}/lists": { "parameters": [ { "name": "recipient_id", "in": "path", "description": "The ID of the recipient for whom you are retrieving lists.", "required": true, "type": "string" } ], "get": { "operationId": "GET_contactdb-recipients-recipient_id-lists", "summary": "Retrieve the lists that a recipient is on", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to retrieve the lists that a given recipient belongs to.**\n\nEach recipient can be on many lists. This endpoint gives you all of the lists that any one recipient has been added to.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "lists": { "type": "array", "items": { "$ref": "#/definitions/contactdb_list" } } } }, "examples": { "application/json": { "lists": [ { "id": 1234, "name": "Example list", "recipient_count": 42 } ] } } }, "400": { "description": "\"recipient_id\" : \"Returned if recipient_id is not valid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "recipient ID is invalid" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"recipient_id\" : \"Returned if record for the recipient id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "recipient id not found" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/recipients/billable_count": { "get": { "operationId": "GET_contactdb-recipients-billable_count", "summary": "Retrieve the count of billable recipients", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to retrieve the number of Marketing Campaigns recipients that you will be billed for.**\n\nYou are billed for marketing campaigns based on the highest number of recipients you have had in your account at one time. This endpoint will allow you to know the current billable count value.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contactdb_recipient_count" }, "examples": { "application/json": { "recipient_count": 1234 } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/recipients/count": { "get": { "operationId": "GET_contactdb-recipients-count", "summary": "Retrieve a Count of Recipients", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to retrieve the total number of Marketing Campaigns recipients.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contactdb_recipient_count" }, "examples": { "application/json": { "recipient_count": 1234 } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/recipients/search": { "get": { "operationId": "GET_contactdb-recipients-search", "summary": "Search recipients", "tags": [ "Contacts API - Recipients" ], "description": "**This endpoint allows you to perform a search on all of your Marketing Campaigns recipients.**\n\nfield_name:\n\n* is a variable that is substituted for your actual custom field name from your recipient.\n* Text fields must be url-encoded. Date fields are searchable only by unix timestamp (e.g. 2/2/2015 becomes 1422835200)\n* If field_name is a 'reserved' date field, such as created_at or updated_at, the system will internally convert\nyour epoch time to a date range encompassing the entire day. For example, an epoch time of 1422835600 converts to\nMon, 02 Feb 2015 00:06:40 GMT, but internally the system will search from Mon, 02 Feb 2015 00:00:00 GMT through\nMon, 02 Feb 2015 23:59:59 GMT.", "parameters": [ { "name": "{field_name}", "in": "query", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "recipients": { "type": "array", "items": { "$ref": "#/definitions/contactdb_recipient" } } } }, "examples": { "application/json": { "recipients": [ { "created_at": 1422313607, "email": "jones@example.com", "first_name": null, "id": "YUBh", "last_clicked": null, "last_emailed": null, "last_name": "Jones", "last_opened": null, "updated_at": 1422313790, "custom_fields": [ { "id": 23, "name": "pet", "value": "Fluffy", "type": "text" } ] } ] } } }, "400": { "description": "\"\" : \"Returned if no search params are specified\"\n\"field\" : \"Returned if the provided field is invalid or does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "The following parameters are not custom fields or reserved fields: [{field_name}]" }, { "message": "No search params are specified" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "post": { "operationId": "POST_contactdb-recipients-search", "summary": "Search recipients", "tags": [ "Contacts API - Recipients" ], "description": "

\n Search using segment conditions without actually creating a segment.\n Body contains a JSON object with conditions, a list of conditions as described below, and an optional list_id, which is a valid list ID for a list to limit the search on.\n

\n\n

\n Valid operators for create and update depend on the type of the field for which you are searching.\n

\n\n
    \n
  • Dates:\n
      \n
    • \"eq\", \"ne\", \"lt\" (before), \"gt\" (after)\n
        \n
      • You may use MM/DD/YYYY for day granularity or an epoch for second granularity.
      • \n
      \n
    • \n
    • \"empty\", \"not_empty\"
    • \n
    • \"is within\"\n \n
    • \n
    \n
  • \n
  • Text: \"contains\", \"eq\" (is - matches the full field), \"ne\" (is not - matches any field where the entire field is not the condition value), \"empty\", \"not_empty\"
  • \n
  • Numbers: \"eq\", \"lt\", \"gt\", \"empty\", \"not_empty\"
  • \n
  • Email Clicks and Opens: \"eq\" (opened), \"ne\" (not opened)
  • \n
\n\n

\n Field values must all be a string.\n

\n\n

\n Search conditions using \"eq\" or \"ne\" for email clicks and opens should provide a \"field\" of either clicks.campaign_identifier or opens.campaign_identifier.\n The condition value should be a string containing the id of a completed campaign.\n

\n\n

\n Search conditions list may contain multiple conditions, joined by an \"and\" or \"or\" in the \"and_or\" field.\n The first condition in the conditions list must have an empty \"and_or\", and subsequent conditions must all specify an \"and_or\".\n

", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "list_id": { "type": "integer", "format": "int32" }, "conditions": { "type": "array", "items": { "and_or": "", "field": "birthday", "value": "01/12/1985", "operator": "eq" } } }, "required": [ "list_id", "conditions" ], "example": { "list_id": -27497588, "conditions": [ { "and_or": "", "field": "birthday", "value": "01/12/1985", "operator": "eq" }, { "and_or": "", "field": "birthday", "value": "01/12/1985", "operator": "eq" }, { "and_or": "", "field": "birthday", "value": "01/12/1985", "operator": "eq" }, { "and_or": "", "field": "birthday", "value": "01/12/1985", "operator": "eq" } ] } } } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "recipients": { "type": "array", "items": { "type": "object", "properties": { "created_at": { "type": "integer" }, "email": { "type": "string" }, "id": { "type": "string" }, "last_emailed": { "type": "integer" }, "last_clicked": { "type": "integer" }, "last_opened": { "type": "integer" }, "custom_fields": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "value": { "anyOf": [ { "type": "integer" }, { "type": "string" } ] }, "type": { "type": "string" } } } }, "updated_at": { "type": "integer" }, "first_name": { "type": "string" } } } }, "recipient_count": { "type": "integer" } } }, "examples": { "application/json": { "recipients": [ { "created_at": -27901208, "email": "ut magna quis ipsum", "id": "fugiat ad adipisicing ullamco", "last_emailed": 21626657 }, { "created_at": 17466400, "email": "sunt irure", "id": "et", "last_clicked": -23135244, "last_opened": -44593357, "first_name": "est" }, { "created_at": -34495329, "email": "reprehenderit incididunt velit Lorem esse", "id": "esse Ut ad dolore", "last_clicked": 10164083, "last_opened": 34443062 }, { "created_at": -37030673, "email": "amet deserunt fugiat voluptate", "id": "et exercitation commodo id laborum", "last_clicked": -10497425 }, { "created_at": 3658435, "email": "labore veniam", "id": "ad pariatur esse", "last_opened": -84227501, "custom_fields": [ { "id": -5765608, "name": "proident pariatur", "value": "do in magna mollit", "type": "dolore ut" }, { "id": -31131201, "name": "laborum mollit", "value": 84434696, "type": "veniam" } ], "updated_at": -56455352, "first_name": "Ut cupidatat nulla deserunt adipisicing", "last_clicked": -52862671 } ], "recipient_count": 65190677 } } }, "400": { "description": "" } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/custom_fields": { "post": { "operationId": "POST_contactdb-custom_fields", "summary": "Create a Custom Field", "tags": [ "Contacts API - Custom Fields" ], "description": "**This endpoint allows you to create a custom field.**\n\n**You can create up to 120 custom fields.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string" }, "type": { "type": "string" } }, "example": { "name": "pet", "type": "text" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/contactdb_custom_field_with_id" }, "examples": { "application/json": { "id": 1, "name": "pet", "type": "text" } } }, "400": { "description": "\"\" : \"Returned if request body is invalid JSON\"\n\"type\" : \"Returned if custom field type is invalid or not provided\"\n\"name\" : \"Returned if custom field name is not provided\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "Returned if request body is invalid JSON" }, { "field": "type", "message": "Returned if custom field type is invalid or not provided" }, { "field": "name", "message": "Returned if custom field name is not provided" } ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_contactdb-custom_fields", "summary": "Retrieve all custom fields", "tags": [ "Contacts API - Custom Fields" ], "description": "**This endpoint allows you to retrieve all custom fields.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "List All Custom Fields response", "type": "object", "properties": { "custom_fields": { "type": "array", "items": { "$ref": "#/definitions/contactdb_custom_field_with_id" } } }, "required": [ "custom_fields" ] }, "examples": { "application/json": { "custom_fields": [ { "id": 6234, "name": "age", "type": "number" }, { "id": 6233, "name": "country", "type": "text" }, { "id": 6235, "name": "favorite_color", "type": "text" }, { "id": 6239, "name": "fname", "type": "text" }, { "id": 6240, "name": "lname", "type": "text" }, { "id": 49439, "name": "pet", "type": "text" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/custom_fields/{custom_field_id}": { "parameters": [ { "name": "custom_field_id", "in": "path", "description": "The ID of the custom field that you want to retrieve.", "required": true, "type": "integer" } ], "get": { "operationId": "GET_contactdb-custom_fields-custom_field_id", "summary": "Retrieve a Custom Field", "tags": [ "Contacts API - Custom Fields" ], "description": "**This endpoint allows you to retrieve a custom field by ID.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contactdb_custom_field_with_id" }, "examples": { "application/json": { "id": 1, "name": "pet", "type": "text" } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "invalid id" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"custom_field_id\" : \"Returned if custom_field_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "Custom field ID does not exist" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_contactdb-custom_fields-custom_field_id", "summary": "Delete a Custom Field", "tags": [ "Contacts API - Custom Fields" ], "description": "**This endpoint allows you to delete a custom field by ID.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "202": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "message": "Custom Field delete is processing." } } }, "400": { "description": "\"id\" : \"Returned if custom_field_id is not valid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "Custom field in use by one or more segment conditions" }, { "message": "Custom field ID does not exist" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"custom_field_id\" : \"Returned if custom_field_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "Custom field ID does not exist" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/reserved_fields": { "get": { "operationId": "GET_contactdb-reserved_fields", "summary": "Retrieve reserved fields", "tags": [ "Contacts API - Custom Fields" ], "description": "**This endpoint allows you to list all fields that are reserved and can't be used for custom field names.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "reserved_fields": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "type": { "type": "string" } } } } } }, "examples": { "application/json": { "reserved_fields": [ { "name": "first_name", "type": "text" }, { "name": "last_name", "type": "text" }, { "name": "email", "type": "text" }, { "name": "created_at", "type": "date" }, { "name": "updated_at", "type": "date" }, { "name": "last_emailed", "type": "date" }, { "name": "last_clicked", "type": "date" }, { "name": "last_opened", "type": "date" }, { "name": "lists", "type": "set" }, { "name": "campaigns", "type": "set" }, { "name": "my_custom_field", "type": "text" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/segments": { "post": { "operationId": "POST_contactdb-segments", "summary": "Create a Segment", "tags": [ "Contacts API - Segments" ], "description": "**This endpoint allows you to create a new segment.**\n\n\n Valid operators for create and update depend on the type of the field for which you are searching.\n\n**Dates**\n- \"eq\", \"ne\", \"lt\" (before), \"gt\" (after)\n - You may use MM/DD/YYYY for day granularity or an epoch for second granularity.\n- \"empty\", \"not_empty\"\n- \"is within\"\n - You may use an [ISO 8601 date format](https://en.wikipedia.org/wiki/ISO_8601) or the # of days.\n\n**Text**\n- \"contains\"\n- \"eq\" (is/equals - matches the full field)\n- \"ne\" (is not/not equals - matches any field where the entire field is not the condition value)\n- \"empty\"\n- \"not_empty\"\n\n**Numbers**\n- \"eq\" (is/equals)\n- \"lt\" (is less than)\n- \"gt\" (is greater than)\n- \"empty\"\n- \"not_empty\"\n\n**Email Clicks and Opens**\n- \"eq\" (opened)\n- \"ne\" (not opened)\n\nAll field values must be a string.\n\n\nConditions using \"eq\" or \"ne\" for email clicks and opens should provide a \"field\" of either `clicks.campaign_identifier` or `opens.campaign_identifier`.\nThe condition value should be a string containing the id of a completed campaign.\n\n\nThe conditions list may contain multiple conditions, joined by an \"and\" or \"or\" in the \"and_or\" field.\n\nThe first condition in the conditions list must have an empty \"and_or\", and subsequent conditions must all specify an \"and_or\".", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/contactdb_segments", "example": { "name": "Last Name Miller", "list_id": 4, "conditions": [ { "field": "last_name", "value": "Miller", "operator": "eq", "and_or": "" }, { "field": "last_clicked", "value": "01/02/2015", "operator": "gt", "and_or": "and" }, { "field": "clicks.campaign_identifier", "value": "513", "operator": "eq", "and_or": "or" } ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contactdb_segments_with_id" }, "examples": { "application/json": { "id": 1, "name": "Last Name Miller", "list_id": 4, "conditions": [ { "field": "last_name", "value": "Miller", "operator": "eq", "and_or": "" }, { "field": "last_clicked", "value": "01/02/2015", "operator": "gt", "and_or": "and" }, { "field": "clicks.campaign_identifier", "value": "513", "operator": "eq", "and_or": "or" } ], "recipient_count": 0 } } }, "400": { "description": "\"name\" : \"Returned if the name is not valid\"\n\"list_id\" : \"Returned if the list_id is not valid\"\n\"and_or\" : \"Returned if and_or and set value is not passed into the request body\"\n\"and_or\" : \"Returned if and_or is set on the only condition passed\"\n\"and_or\" : \"Returned if and_or is set on all conditions\"\n\"and_or\" : \"Returned if and_or is not set on more than one condition and less than all conditions\"\n\"operator\" : \"Returned if operator and set value is not passed into the request body\"\n\"value\" : \"Returned if value and set value is not passed into the request body\"\n\"field\" : \"Returned if field and set value is not passed into the request body\"\n\"\" : \"Returned if request body is not valid json\"\n\"\" : \"Returned if invalid value is passed into one of the request body parameters\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "request body is not valid json" }, { "message": "invalid value is passed into one of the request body parameters" }, { "field": "field", "message": "field and set value is not passed into the request body" }, { "field": "value", "message": "value and set value is not passed into the request body" }, { "field": "operator", "message": "operator and set value is not passed into the request body" }, { "field": "and_or", "message": "and_or is not set on more than one condition and less than all conditions" }, { "field": "and_or", "message": "and_or is set on all conditions" }, { "field": "and_or", "message": "and_or is set on the only condition passed" }, { "field": "and_or", "message": "and_or and set value is not passed into the request body" }, { "field": "list_id", "message": "the list_id is not valid" }, { "field": "name", "message": "the name is not valid" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_contactdb-segments", "summary": "Retrieve all segments", "tags": [ "Contacts API - Segments" ], "description": "**This endpoint allows you to retrieve all of your segments.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "List All Segments response", "type": "object", "properties": { "segments": { "type": "array", "items": { "$ref": "#/definitions/contactdb_segments" } } }, "required": [ "segments" ] }, "examples": { "application/json": { "segments": [ { "id": 1234, "name": "Age segments < 25", "conditions": [ { "field": "age", "value": "25", "operator": "lt" } ], "recipient_count": 8 }, { "id": 2345, "name": "email address - gmail", "conditions": [ { "field": "email", "value": "@gmail.com", "operator": "contains" } ], "recipient_count": 0 } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/segments/{segment_id}": { "parameters": [ { "name": "segment_id", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_contactdb-segments-segment_id", "summary": "Retrieve a segment", "tags": [ "Contacts API - Segments" ], "description": "**This endpoint allows you to retrieve a single segment with the given ID.**", "parameters": [ { "name": "segment_id", "in": "query", "description": "The ID of the segment you want to request.", "required": true, "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contactdb_segments" }, "examples": { "application/json": { "id": 1, "name": "Last Name Miller", "list_id": 4, "conditions": [ { "field": "last_name", "value": "Miller", "operator": "eq", "and_or": "" } ], "recipient_count": 1 } } }, "400": { "description": "\"segment_id\" : \"Returned if segment_id is not valid\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "if segment_id is not valid" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"segment_id\" : \"Returned if segment_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "segment_id not found" } ] } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_contactdb-segments-segment_id", "summary": "Update a segment", "tags": [ "Contacts API - Segments" ], "description": "**This endpoint allows you to update a segment.**", "parameters": [ { "name": "segment_id", "in": "query", "description": "The ID of the segment you are updating.", "type": "string" }, { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string" }, "list_id": { "type": "number", "description": "The list ID you would like this segment to be built from." }, "conditions": { "type": "array", "description": "The conditions by which this segment should be created.", "items": { "$ref": "#/definitions/contactdb_segments_conditions" } } }, "required": [ "name" ], "example": { "name": "The Millers", "list_id": 5, "conditions": [ { "field": "last_name", "value": "Miller", "operator": "eq", "and_or": "" } ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/contactdb_segments" }, "examples": { "application/json": { "id": 5, "name": "The Millers", "list_id": 5, "conditions": [ { "field": "last_name", "value": "Miller", "operator": "eq", "and_or": "" } ], "recipient_count": 1 } } }, "400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "message": "request body is not valid json" }, { "message": "invalid value is passed into one of the request body parameters" }, { "segment_id": "segment_id", "message": "segment id is not valid" }, { "field": "field", "message": "field and set value is not passed into the request body" }, { "field": "value", "message": "value and set value is not passed into the request body" }, { "field": "operator", "message": "operator and set value is not passed into the request body" }, { "field": "and_or", "message": "and_or is not set on more than one condition and less than all conditions" }, { "field": "and_or", "message": "and_or is set on all conditions" }, { "field": "and_or", "message": "and_or is set on the only condition passed" }, { "field": "and_or", "message": "and_or and set value is not passed into the request body" }, { "field": "list_id", "message": "the list_id is not valid" }, { "field": "name", "message": "the name is not valid" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_contactdb-segments-segment_id", "summary": "Delete a segment", "tags": [ "Contacts API - Segments" ], "description": "**This endpoint allows you to delete a segment from your recipients database.**\n\nYou also have the option to delete all the contacts from your Marketing Campaigns recipient database who were in this segment.", "parameters": [ { "name": "delete_contacts", "in": "query", "description": "True to delete all contacts matching the segment in addition to deleting the segment", "type": "boolean" }, { "name": "body", "in": "body", "schema": { "type": "null" } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "null" } }, "400": { "description": "\"segment_id\" : \"Returned if segment_id is not valid\"\n\"delete_contacts\" : \"Returned if delete_contacts is not a valid boolean\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "segment_id", "message": "Returned if segment_id is not valid" }, { "field": "delete_contacts", "message": "Returned if delete_contacts is not a valid boolean" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"segment_id\" : \"Returned if segment_id does not exist\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "segment_id", "message": "segment_id does not exist" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/contactdb/segments/{segment_id}/recipients": { "parameters": [ { "name": "segment_id", "in": "path", "description": "The ID of the segment from which you want to retrieve recipients.", "required": true, "type": "integer" } ], "get": { "operationId": "GET_contactdb-segments-segment_id-recipients", "summary": "Retrieve recipients on a segment", "tags": [ "Contacts API - Segments" ], "description": "**This endpoint allows you to retrieve all of the recipients in a segment with the given ID.**", "parameters": [ { "name": "page", "in": "query", "type": "integer" }, { "name": "page_size", "in": "query", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "List Recipients On a Segment response", "type": "object", "properties": { "recipients": { "type": "array", "items": { "$ref": "#/definitions/contactdb_recipient" } } }, "required": [ "recipients" ] }, "examples": { "application/json": { "recipients": [ { "created_at": 1422313607, "email": "jones@example.com", "first_name": null, "id": "YUBh", "last_clicked": null, "last_emailed": null, "last_name": "Jones", "last_opened": null, "updated_at": 1422313790, "custom_fields": [ { "id": 23, "name": "pet", "value": "Indiana", "type": "text" } ] } ] } } }, "400": { "description": "\"page\" : \"Returned if page is not a valid integer\"\n\"page\" : \"Returned if page is less than 1\"\n\"page_size\" : \"Returned if page_size is not a valid integer\"", "schema": { "type": "object" } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"segment_id\" : \"Returned if segment_id is not valid\"\n\"segment_id\" : \"Returned if segment_id does not exist\"", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/categories": { "get": { "operationId": "GET_categories", "summary": "Retrieve all categories", "tags": [ "Categories" ], "description": "**This endpoint allows you to retrieve a list of all of your categories.**", "parameters": [ { "name": "limit", "in": "query", "description": "The number of categories to display per page.", "type": "integer", "default": 50 }, { "name": "category", "in": "query", "description": "Allows you to perform a prefix search on this particular category.", "type": "string" }, { "name": "offset", "in": "query", "description": "The point in the list that you would like to begin displaying results.", "type": "integer", "default": 0 }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "category": { "type": "string", "description": "A category used to group emails by broad topic." } }, "required": [ "category" ] } }, "examples": { "application/json": [ { "category": "category 1" }, { "category": "category 2" } ] } }, "400": { "description": "", "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": { "application/json": { "errors": [ { "field": "sort_by", "message": "invalid sort value" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/categories/stats/sums": { "get": { "operationId": "GET_categories-stats-sums", "summary": "Retrieve sums of email stats for each category [Needs: Stats object defined, has category ID?]", "tags": [ "Categories" ], "description": "**This endpoint allows you to retrieve the total sum of each email statistic for every category over the given date range.**\n\nIf 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, "type": "string", "default": "delivered" }, { "name": "sort_by_direction", "in": "query", "description": "The direction you want to sort.", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "start_date", "in": "query", "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", "required": true, "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, "type": "string" }, { "name": "limit", "in": "query", "description": "Limits the number of results returned.", "required": false, "type": "integer", "default": 5 }, { "name": "offset", "in": "query", "description": "The point in the list to begin retrieving results.", "required": false, "type": "integer", "default": 0 }, { "name": "aggregated_by", "in": "query", "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", "required": false, "type": "string", "enum": [ "day", "week", "month" ] }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/category_stats" }, "examples": { "application/json": { "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" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/categories/stats": { "get": { "operationId": "GET_categories-stats", "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.**\n\nIf 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, "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, "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, "type": "string" }, { "name": "limit", "in": "query", "description": "The number of results to include.", "required": false, "type": "integer", "default": 500, "maximum": 500 }, { "name": "offset", "in": "query", "description": "The number of results to skip.", "required": false, "type": "integer" }, { "name": "aggregated_by", "in": "query", "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", "required": false, "type": "string", "enum": [ "day", "week", "month" ] }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/category_stats" } }, "examples": { "application/json": [ { "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 } } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/campaigns": { "post": { "operationId": "POST_campaigns", "summary": "Create a Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to create a campaign.**\n\nIn order to send or schedule the campaign, you will be required to provide a subject, sender ID, content (we suggest both html and plain text), and at least one list or segment ID. This information is not required when you create a campaign.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/campaign_request", "example": { "title": "March Newsletter", "subject": "New Products for Spring!", "sender_id": 124451, "list_ids": [ 110, 124 ], "segment_ids": [ 110 ], "categories": [ "spring line" ], "suppression_group_id": 42, "custom_unsubscribe_url": "", "ip_pool": "marketing", "html_content": "

Check out our spring line!

", "plain_content": "Check out our spring line!" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/campaign_response" }, "examples": { "application/json": { "id": 986724, "title": "March Newsletter", "subject": "New Products for Spring!", "sender_id": 124451, "list_ids": [ 110, 124 ], "segment_ids": [ 110 ], "categories": [ "spring line" ], "suppression_group_id": 42, "custom_unsubscribe_url": "", "ip_pool": "marketing", "html_content": "

Check out our spring line!

", "plain_content": "Check out our spring line!", "status": "Draft" } } }, "400": { "description": "\"title\": \"title can't be blank\"\n\"title\": \"title is too long (maximum is 100 characters)\"\n\"categories\": \"categories exceeds 10 category limit\"\n\"html_content\": \"html_content exceeds the 1MB limit\"\n\"plain_content\": \"plain_content exceeds the 1MB limit\"\n\"sender_id\": \"sender_id does not exist\"\n\"sender_id\": \"sender_id is not a verified sender identity\"\n\"list_ids\": \"list_ids do not all exist\"\n\"segment_ids\": \"segment_ids do not all exist\"\n\"ip_pool\": \"The ip pool you provided is invalid\"\n\"suppression_group_id\": \"suppression_group_id does not exist\"\n\"unsubscribes\": \"Either suppression_group_id or custom_unsubscribe_url may be set/used, but not both. Please remove one before setting the other.\"\n\"\": \"The JSON you have submitted cannot be parsed.\"\n\"\": \"You've reached your limit of 250 campaigns. Please delete one or more and try again.\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "title", "message": "title can't be blank" }, { "field": "title", "message": "title is too long (maximum is 100 characters)" }, { "field": "categories", "message": "categories exceeds 10 category limit" }, { "field": "html_content", "message": "html_content exceeds the 1MB limit" }, { "field": "plain_content", "message": "plain_content exceeds the 1MB limit" }, { "field": "sender_id", "message": "sender_id does not exist" }, { "field": "sender_id", "message": "sender_id is not a verified sender identity" }, { "field": "list_ids", "message": "list_ids do not all exist" }, { "field": "segment_ids", "message": "segment_ids do not all exist" }, { "field": "ip_pool", "message": "The ip pool you provided is invalid" }, { "field": "suppression_group_id", "message": "suppression_group_id does not exist" }, { "field": "unsubscribes", "message": "Either suppression_group_id or custom_unsubscribe_url may be set/used, but not both. Please remove one before setting the other." }, { "field": null, "message": "The JSON you have submitted cannot be parsed." }, { "field": null, "message": "You've reached your limit of 250 campaigns. Please delete one or more and try again." } ] } } }, "401": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_campaigns", "summary": "Retrieve all Campaigns", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to retrieve a list of all of your campaigns.**\n\nReturns campaigns in reverse order they were created (newest first).\n\nReturns an empty array if no campaigns exist.", "parameters": [ { "name": "limit", "in": "query", "description": "The number of results you would like to receive at a time.", "type": "integer", "default": 10 }, { "name": "offset", "in": "query", "description": "The index of the first campaign to return, where 0 is the first campaign.", "type": "integer", "default": 0 }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "items": { "$ref": "#/definitions/campaign_response" } } } }, "examples": { "application/json": { "result": [ { "id": 986724, "title": "March Newsletter", "subject": "New Products for Spring!", "sender_id": 124451, "list_ids": [ 110, 124 ], "segment_ids": [ 110 ], "categories": [ "spring line" ], "suppression_group_id": 42, "custom_unsubscribe_url": "", "ip_pool": "marketing", "html_content": "

Check out our spring line!

", "plain_content": "Check out our spring line!", "status": "Draft" }, { "id": 986723, "title": "February Newsletter", "subject": "Final Winter Product Sale!", "sender_id": 124451, "list_ids": [ 110, 124 ], "segment_ids": [ 110 ], "categories": [ "winter line" ], "suppression_group_id": 42, "custom_unsubscribe_url": "", "ip_pool": "marketing", "html_content": "

Last call for winter clothes!

", "plain_content": "Last call for winter clothes!", "status": "Sent" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/campaigns/{campaign_id}": { "parameters": [ { "name": "campaign_id", "in": "path", "description": "The id of the campaign you would like to retrieve.", "required": true, "type": "integer" } ], "get": { "operationId": "GET_campaigns-campaign_id", "summary": "Retrieve a single campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to retrieve a specific campaign.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "categories": { "type": "array", "items": { "type": "string" } }, "custom_unsubscribe_url": { "type": "string" }, "html_content": { "type": "string" }, "id": { "type": "integer" }, "ip_pool": { "type": "string" }, "list_ids": { "type": "array", "items": { "type": "integer" } }, "plain_content": { "type": "string" }, "segment_ids": { "type": "array", "items": { "type": "integer" } }, "sender_id": { "type": "integer" }, "status": { "type": "string" }, "subject": { "type": "string" }, "suppression_group_id": { "type": "integer" }, "title": { "type": "string" } } }, "examples": { "application/json": { "categories": [ "spring line" ], "custom_unsubscribe_url": "", "html_content": "

Check out our spring line!

", "id": 986724, "ip_pool": "marketing", "list_ids": [ 110 ], "plain_content": "Check out our spring line!", "segment_ids": [ 110 ], "sender_id": 124451, "status": "Draft", "subject": "New Products for Spring!", "suppression_group_id": 42, "title": "March Newsletter" } } }, "401": { "description": "", "schema": { "type": "object" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"\": \"not found\"", "schema": { "type": "object" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "not found" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_campaigns-campaign_id", "summary": "Delete a Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to delete a specific campaign.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "null" } }, "401": { "description": "", "schema": { "type": "object" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "404": { "description": "\"\": \"not found\"", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_campaigns-campaign_id", "summary": "Update a Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to update a specific campaign.**\n\nThis is especially useful if you only set up the campaign using POST /campaigns, but didn't set many of the parameters.", "parameters": [ { "name": "body", "in": "body", "schema": { "title": "Update a Campaign request", "type": "object", "properties": { "title": { "type": "string", "description": "The title of the campaign." }, "subject": { "type": "string", "description": "The subject line for your campaign." }, "categories": { "type": "array", "description": "The categories you want to tag on this campaign.", "items": { "type": "string" } }, "html_content": { "type": "string", "description": "The HTML content of this campaign." }, "plain_content": { "type": "string", "description": "The plain content of this campaign." } }, "required": [ "title", "subject", "categories", "html_content", "plain_content" ], "example": { "title": "May Newsletter", "subject": "New Products for Summer!", "categories": [ "summer line" ], "html_content": "

Check out our summer line!

", "plain_content": "Check out our summer line!" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/campaign_response" }, "examples": { "application/json": { "id": 986724, "title": "May Newsletter", "subject": "New Products for Summer!", "sender_id": 124451, "list_ids": [ 110, 124 ], "segment_ids": [ 110 ], "categories": [ "summer line" ], "suppression_group_id": 42, "custom_unsubscribe_url": "", "ip_pool": "marketing", "html_content": "

Check out our summer line!

", "plain_content": "Check out our summer line!", "status": "Draft" } } }, "400": { "description": "\"title\": \"title can't be blank\"\n\"title\": \"title is too long (maximum is 100 characters)\"\n\"categories\": \"categories exceeds 10 category limit\"\n\"html_content\": \"html_content exceeds the 1MB limit\"\n\"plain_content\": \"plain_content exceeds the 1MB limit\"\n\"sender_id\": \"sender_id does not exist\"\n\"sender_id\": \"sender_id is not a verified sender identity\"\n\"list_ids\": \"list_ids do not all exist\"\n\"segment_ids\": \"segment_ids do not all exist\"\n\"ip_pool\": \"The ip pool you provided is invalid\"\n\"suppression_group_id\": \"suppression_group_id does not exist\"\n\"unsubscribes\": \"Either suppression_group_id or custom_unsubscribe_url may be set/used, but not both. Please remove one before setting the other.\"\n\"\": \"The JSON you have submitted cannot be parsed.\"", "schema": { "type": "object" }, "examples": { "application/json": { "errors": [ { "field": "title", "message": "title can't be blank" }, { "field": "title", "message": "title is too long (maximum is 100 characters)" }, { "field": "categories", "message": "categories exceeds 10 category limit" }, { "field": "html_content", "message": "html_content exceeds the 1MB limit" }, { "field": "plain_content", "message": "plain_content exceeds the 1MB limit" }, { "field": "sender_id", "message": "sender_id does not exist" }, { "field": "sender_id", "message": "sender_id is not a verified sender identity" }, { "field": "list_ids", "message": "list_ids do not all exist" }, { "field": "segment_ids", "message": "segment_ids do not all exist" }, { "field": "ip_pool", "message": "The ip pool you provided is invalid" }, { "field": "suppression_group_id", "message": "suppression_group_id does not exist" }, { "field": "unsubscribes", "message": "Either suppression_group_id or custom_unsubscribe_url may be set/used, but not both. Please remove one before setting the other." }, { "field": null, "message": "The JSON you have submitted cannot be parsed." } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "403": { "description": "\"\": \"You may only update a campaign when it is in draft mode.\"", "schema": { "type": "object" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "You may only update a campaign when it is in draft mode." } ] } } }, "404": { "description": "\"\": \"not found\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "not found" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/campaigns/{campaign_id}/schedules/now": { "parameters": [ { "name": "campaign_id", "in": "path", "required": true, "type": "integer" } ], "post": { "operationId": "POST_campaigns-campaign_id-schedules-now", "summary": "Send a Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to immediately send an existing campaign.**\n\nNormally a POST request would have a body, but since this endpoint is telling us to send a resource that is already created, a request body is not needed.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "title": "Send a Campaign response", "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "status": { "type": "string" } }, "required": [ "id", "status" ] }, "examples": { "application/json": { "id": 1234, "status": "Scheduled" } } }, "400": { "description": "\"subject\": \"subject can't be blank\"\n\"sender_id\": \"sender_id can't be blank\"\n\"plain_content\": \"plain_content can't be blank, please provide plain text or html content\"\n\"list_ids\": \"You must select at least 1 segment or 1 list to send to.\"\n\"unsubscribe_tag\": \"An [unsubscribe] tag in both your html and plain content is required to send a campaign.\"\n\"suppression_group_id\": \"Either a suppression_group_id or custom_unsubscribe_url is required to send a campaign.\"\n\"\": \"You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "subject", "message": "subject can't be blank" }, { "field": "sender_id", "message": "sender_id can't be blank" }, { "field": "plain_content", "message": "plain_content can't be blank, please provide plain text or html content" }, { "field": "list_id", "message": "You must select at least 1 segment or 1 list to send to." }, { "field": "unsubscribe_tag", "message": "An [unsubscribe] tag in both your html and plain content is required to send a campaign." }, { "field": "suppression_group_id", "message": "Either a suppression_group_id or custom_unsubscribe_url is required to send a campaign." }, { "field": null, "message": "You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "403": { "description": "\"\": \"You may only send a campaign when it is in draft mode.\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "You may only send a campaign when it is in draft mode." } ] } } }, "404": { "description": "\"\": \"not found\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "not found" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/campaigns/{campaign_id}/schedules": { "parameters": [ { "name": "campaign_id", "in": "path", "required": true, "type": "integer" } ], "post": { "operationId": "POST_campaigns-campaign_id-schedules", "summary": "Schedule a Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to schedule a specific date and time for your campaign to be sent.**\n\nIf you have the flexibility, it's better to schedule mail for off-peak times. Most emails are scheduled and sent at the top of the hour or half hour. Scheduling email to avoid those times (for example, scheduling at 10:53) can result in lower deferral rates because it won't be going through our servers at the same times as everyone else's mail.", "parameters": [ { "name": "body", "in": "body", "schema": { "title": "Schedule a Campaign request", "type": "object", "properties": { "send_at": { "type": "integer", "description": "The unix timestamp for the date and time you would like your campaign to be sent out." } }, "required": [ "send_at" ], "example": { "send_at": 1489771528 } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "title": "Schedule a Campaign response", "type": "object", "properties": { "id": { "type": "integer", "description": "The campaign ID." }, "send_at": { "type": "integer", "description": "The date time you scheduled your campaign to be sent." }, "status": { "type": "string", "description": "The status of your campaign.", "enum": [ "Scheduled" ] } }, "required": [ "id", "send_at", "status" ] }, "examples": { "application/json": { "id": 1234, "send_at": 1489771528, "status": "Scheduled" } } }, "400": { "description": "\"subject\": \"subject can't be blank\"\n\"sender_id\": \"sender_id can't be blank\"\n\"plain_content\": \"plain_content can't be blank, please provide plain text or html content\"\n\"list_ids\": \"You must select at least 1 segment or 1 list to send to.\"\n\"send_at\": \"Please choose a future time for sending your campaign.\"\n\"unsubscribe_tag\": \"An [unsubscribe] tag in both your html and plain content is required to send a campaign.\"\n\"suppression_group_id\": \"Either a suppression_group_id or custom_unsubscribe_url is required to send a campaign.\"\n\"\": \"The JSON you have submitted cannot be parsed.\"\n\"\":\"You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "subject", "message": "subject can't be blank" }, { "field": "sender_id", "message": "sender_id can't be blank" }, { "field": "plain_content", "message": "plain_content can't be blank, please provide plain text or html content" }, { "field": "list_id", "message": "You must select at least 1 segment or 1 list to send to." }, { "field": "unsubscribe_tag", "message": "An [unsubscribe] tag in both your html and plain content is required to send a campaign." }, { "field": "suppression_group_id", "message": "Either a suppression_group_id or custom_unsubscribe_url is required to send a campaign." }, { "field": null, "message": "You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing" } ] } } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } }, "403": { "description": "\"\": \"You cannot POST to a campaign that has already sent or scheduled. However you can update a scheduled campaign with a PATCH.\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "You cannot POST to a campaign that has already sent or scheduled. However you can update a scheduled campaign with a PATCH." } ] } } }, "404": { "description": "\"\": \"not found\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "not found" } ] } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_campaigns-campaign_id-schedules", "summary": "Update a Scheduled Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows to you change the scheduled time and date for a campaign to be sent.**", "parameters": [ { "name": "body", "in": "body", "schema": { "title": "Update a Scheduled Campaign request", "type": "object", "properties": { "send_at": { "type": "integer", "format": "int64" } }, "required": [ "send_at" ], "example": { "send_at": 1489451436 } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "Update a Scheduled Campaign response", "type": "object", "properties": { "id": { "type": "integer", "description": "The campaign ID" }, "send_at": { "type": "integer", "description": "The unix timestamp to send the campaign." }, "status": { "type": "string", "description": "The status of the schedule." } }, "required": [ "id", "send_at", "status" ] } }, "400": { "description": "\"\": \"The JSON you have submitted cannot be parsed.\"\n\"send_at\": \"Please choose a future time for sending your campaign.\"\n\"\":\"You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "send_at", "message": "Please choose a future time for sending your campaign." }, { "field": null, "message": "The JSON you have submitted cannot be parsed." }, { "field": null, "message": "You do not have enough credits to send this campaign. Upgrade your plan to send https://app.sendgrid.com/settings/billing" } ] } } }, "403": { "description": "\"send_at\": \"You cannot update the send_at value of non-scheduled campaign.\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "send_at", "message": "You cannot update the send_at value of non-scheduled campaign." } ] } } }, "404": { "description": "\"\": \"not found\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "not found" } ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_campaigns-campaign_id-schedules", "summary": "View Scheduled Time of a Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to retrieve the date and time that a campaign has been scheduled to be sent.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "View Scheduled Time of a Campaign response", "type": "object", "properties": { "send_at": { "type": "integer", "format": "int64" } }, "required": [ "send_at" ] }, "examples": { "application/json": { "send_at": 1490778528 } } }, "404": { "description": "\"\": \"not found\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "not found" } ] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_campaigns-campaign_id-schedules", "summary": "Unschedule a Scheduled Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to unschedule a campaign that has already been scheduled to be sent.**\n\nA successful unschedule will return a 204.\nIf the specified campaign is in the process of being sent, the only option is to cancel (a different method).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "null" } }, "403": { "description": "\"\": \"This campaign is already In Progress.\"\n\"\": \"This campaign is already Sent.\"\n\"\": \"This campaign is already Paused.\"\n\"\": \"This campaign is already Canceled.\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "This campaign is already In Progress." }, { "field": null, "message": "This campaign is already Sent." }, { "field": null, "message": "This campaign is already Paused." }, { "field": null, "message": "This campaign is already Canceled." } ] } } }, "404": { "description": "\"\": \"not found\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "not found" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/campaigns/{campaign_id}/schedules/test": { "parameters": [ { "name": "campaign_id", "in": "path", "required": true, "type": "integer" } ], "post": { "operationId": "POST_campaigns-campaign_id-schedules-test", "summary": "Send a Test Campaign", "tags": [ "Campaigns API" ], "description": "**This endpoint allows you to send a test campaign.**\n\nTo send to multiple addresses, use an array for the JSON \"to\" value [\"one@address\",\"two@address\"]", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "to": { "type": "string", "description": "The email address that should receive the test campaign.", "format": "email" } }, "required": [ "to" ], "example": { "to": "your.email@example.com" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "title": "Send a Test Campaign request", "type": "object", "properties": { "to": { "type": "string" } }, "required": [ "to" ] } }, "400": { "description": "\"\": \"The JSON you have submitted cannot be parsed.\"\n\"to\": \"Please provide an email address to which the test should be sent.\"\n\"to\": \"You can only send tests to 10 addresses at a time.\"\n\"subject\": \"Please add a subject to your campaign before sending a test.\"\n\"plain_content\": \"Plain content and html content can't both be blank. Please set one of these values before sending a test.\"\n\"sender_id\": \"Please assign a sender identity to your campaign before sending a test.\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": "send_at", "message": "Please choose a future time for sending your campaign." }, { "field": null, "message": "The JSON you have submitted cannot be parsed." }, { "field": null, "message": "You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing" } ] } } }, "404": { "description": "\"\": \"not found\"", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "not found" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/templates": { "post": { "operationId": "POST_templates", "summary": "Create a transactional template.", "tags": [ "Transactional Templates" ], "description": "**This endpoint allows you to create a transactional template.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "The name for the new transactional template.", "maxLength": 100 }, "generation": { "type": "string", "description": "Defines whether the template supports dynamic replacement.", "enum": [ "legacy", "dynamic" ], "default": "legacy" } }, "required": [ "name" ], "example": { "name": "example_name", "generation": "dynamic" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/transactional_template" }, "examples": { "application/json": { "id": "733ba07f-ead1-41fc-933a-3976baa23716", "name": "example_name", "generation": "legacy", "versions": [] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_templates", "summary": "Retrieve paged transactional templates.", "tags": [ "Transactional Templates" ], "description": "**This endpoint allows you to retrieve all transactional templates.**", "parameters": [ { "name": "generations", "in": "query", "description": "Comma-delimited list specifying which generations of templates to return. Options are `legacy`, `dynamic` or `legacy,dynamic`.", "required": false, "type": "string", "default": "legacy", "enum": [ "legacy", "dynamic", "legacy,dynamic" ] }, { "name": "page_size", "in": "query", "description": "The number of templates to be returned in each page of results", "required": true, "type": "number", "minimum": 1, "maximum": 200 }, { "name": "page_token", "in": "query", "description": "A token corresponding to a specific page of results, as provided by metadata", "required": false, "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "description": "", "items": { "$ref": "#/definitions/transactional-templates-template-lean" } }, "_metadata": { "$ref": "#/definitions/_metadata" } } }, "examples": { "application/json": { "result": [ { "id": "fae7c985-eb92-4b47-9987-28ec29dbc698", "name": "example_name", "generation": "legacy", "updated_at ": "2020-11-12 12:00:09", "versions": [] } ], "_metadata": { "self": "https://api.sendgrid.com/v3/templates", "count": 1 } } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "": { "type": "string" }, "message": { "type": "string" }, "error_id": { "type": "string" } } } } } } } }, "security": [ { "Authorization": [] } ] } }, "/templates/{template_id}": { "parameters": [ { "name": "template_id", "in": "path", "required": true, "type": "string" } ], "post": { "operationId": "POST_templates-template_id", "summary": "Duplicate a transactional template.", "tags": [ "Transactional Templates" ], "description": "**This endpoint allows you to duplicate a transactional template.**", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "The name for the new transactional template.", "maxLength": 100 } }, "example": { "name": "example_name" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/transactional_template" }, "examples": { "application/json": { "id": "733ba07f-ead1-41fc-933a-3976baa2371", "name": "example_name", "generation": "dynamic", "updated_at ": "2019-03-13T11:52:41.009Z", "versions": [] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_templates-template_id", "summary": "Retrieve a single transactional template.", "tags": [ "Transactional Templates" ], "description": "**This endpoint allows you to retrieve a single transactional template.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/transactional_template" }, "examples": { "application/json": { "id": "40da60e6-66f3-4223-9406-ba58b7f55a62", "name": "Duis in dolor", "generation": "legacy", "updated_at ": "2020-12-12 58:26:65", "versions": [] } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_templates-template_id", "summary": "Edit a transactional template.", "tags": [ "Transactional Templates" ], "description": "**This endpoint allows you to edit the name of a transactional template.**\n\nTo edit the template itself, [create a new transactional template version](https://sendgrid.api-docs.io/v3.0/transactional-templates-versions/create-a-new-transactional-template-version).", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "The name of the transactional template.", "maxLength": 100 } }, "example": { "name": "new_example_name" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/transactional_template" }, "examples": { "application/json": { "id": "733ba07f-ead1-41fc-933a-3976baa23716", "name": "new_example_name", "versions": [] } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_templates-template_id", "summary": "Delete a template.", "tags": [ "Transactional Templates" ], "description": "**This endpoint allows you to delete a transactional template.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/templates/{template_id}/versions": { "parameters": [ { "name": "template_id", "in": "path", "required": true, "type": "string", "format": "uuid" } ], "post": { "operationId": "POST_templates-template_id-versions", "summary": "Create a new transactional template version.", "tags": [ "Transactional Templates Versions" ], "description": "**This endpoint allows you to create a new version of a template.**", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/transactional_template_version_create", "example": { "active": 1, "name": "example_version_name", "html_content": "", "plain_content": "Plain text content", "generate_plain_content": false, "subject": "", "editor": "design" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/transactional_template_version_output" }, "examples": { "application/json": { "id": "8aefe0ee-f12b-4575-b5b7-c97e21cb36f3", "template_id": "ddb96bbc-9b92-425e-8979-99464621b543", "active": 1, "name": "example_version_name", "html_content": "<%body%>", "plain_content": "<%body%>", "generate_plain_content": true, "subject": "<%subject%>", "updated_at": "2019-03-13 18:56:33", "editor": "code" } } } }, "security": [ { "Authorization": [] } ] } }, "/templates/{template_id}/versions/{version_id}/activate": { "parameters": [ { "name": "template_id", "in": "path", "description": "The ID of the original template", "required": true, "type": "string", "format": "uuid" }, { "name": "version_id", "in": "path", "description": "The ID of the template version", "required": true, "type": "string", "format": "uuid" } ], "post": { "operationId": "POST_templates-template_id-versions-version_id-activate", "summary": "Activate a transactional template version.", "tags": [ "Transactional Templates Versions" ], "description": "**This endpoint allows you to activate a version of one of your templates.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/transactional_template_version_output" }, "examples": { "application/json": { "id": "8aefe0ee-f12b-4575-b5b7-c97e21cb36f3", "template_id": "ddb96bbc-9b92-425e-8979-99464621b543", "active": 1, "name": "example_version_name", "html_content": "<%body%>", "plain_content": "<%body%>", "generate_plain_content": true, "subject": "<%subject%>", "updated_at": "2019-03-13 18:56:33", "editor": "code" } } } }, "security": [ { "Authorization": [] } ] } }, "/templates/{template_id}/versions/{version_id}": { "parameters": [ { "name": "template_id", "in": "path", "description": " The ID of the original template", "required": true, "type": "string", "format": "uuid" }, { "name": "version_id", "in": "path", "description": "The ID of the template version", "required": true, "type": "string", "format": "uuid" } ], "get": { "operationId": "GET_templates-template_id-versions-version_id", "summary": "Retrieve a specific transactional template version.", "tags": [ "Transactional Templates Versions" ], "description": "**This endpoint allows you to retrieve a specific version of a template.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/transactional_template_version_output" }, "examples": { "application/json": { "id": "8aefe0ee-f12b-4575-b5b7-c97e21cb36f3", "template_id": "ddb96bbc-9b92-425e-8979-99464621b543", "active": 1, "name": "example_version_name", "html_content": "<%body%>", "plain_content": "<%body%>", "generate_plain_content": true, "subject": "<%subject%>", "updated_at": "2019-03-13 18:56:33", "editor": "code" } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_templates-template_id-versions-version_id", "summary": "Edit a transactional template version.", "tags": [ "Transactional Templates Versions" ], "description": "**This endpoint allows you to edit the content of your template version.**", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/transactional_template_version_create", "example": { "active": 1, "name": "updated_example_name", "html_content": "<%body%>", "plain_content": "<%body%>", "subject": "<%subject%>" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/transactional_template_version_output" }, "examples": { "application/json": { "id": "8aefe0ee-f12b-4575-b5b7-c97e21cb36f3", "template_id": "ddb96bbc-9b92-425e-8979-99464621b543", "active": 1, "name": "example_version_name", "html_content": "<%body%>", "plain_content": "<%body%>", "generate_plain_content": true, "subject": "<%subject%>", "updated_at": "2019-03-13 18:56:33", "editor": "code" } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_templates-template_id-versions-version_id", "summary": "Delete a transactional template version.", "tags": [ "Transactional Templates Versions" ], "description": "**This endpoint allows you to delete a transactional template version.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "" } }, "security": [ { "Authorization": [] } ] } }, "/user/webhooks/event/settings": { "get": { "operationId": "GET_user-webhooks-event-settings", "summary": "Retrieve Event Webhook settings", "tags": [ "Webhooks" ], "description": "**This endpoint allows you to retrieve your current event webhook settings.**\n\nIf an event type is marked as `true`, then the event webhook will include information about that event.\n\nSendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.\n\nCommon uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/event-webhook-response" }, "examples": { "application/json": { "enabled": false, "url": "incididunt reprehenderit", "group_resubscribe": false, "delivered": false, "group_unsubscribe": false, "spam_report": false, "bounce": false, "deferred": false, "unsubscribe": true, "processed": false, "open": true, "click": true, "dropped": true, "oauth_client_id": "est fugiat", "oauth_token_url": "Duis in laborum sunt" } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_user-webhooks-event-settings", "summary": "Update Event Notification Settings", "tags": [ "Webhooks" ], "description": "**This endpoint allows you to update your current event webhook settings.**\n\nIf an event type is marked as `true`, then the event webhook will include information about that event.\n\nSendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.\n\nCommon uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/event-webhook-update-oauth-request", "example": { "enabled": false, "url": "id aliqua", "group_resubscribe": true, "delivered": false, "group_unsubscribe": true, "spam_report": true, "bounce": false, "deferred": false, "unsubscribe": true, "processed": false, "open": false, "click": false, "dropped": false, "oauth_client_id": "reprehenderit in null", "oauth_client_secret": "ea in nostrud", "oauth_token_url": "cupidatat ad Ut" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/event-webhook-response" }, "examples": { "application/json": { "enabled": true, "url": "mollit laborum", "group_resubscribe": false, "delivered": true, "group_unsubscribe": true, "spam_report": true, "bounce": true, "deferred": true, "unsubscribe": true, "processed": true, "open": true, "click": false, "dropped": true, "oauth_client_id": "anim sunt", "oauth_token_url": "ex" } } } }, "security": [ { "Authorization": [] } ] } }, "/user/webhooks/parse/settings": { "get": { "operationId": "GET_user-webhooks-parse-settings", "summary": "Retrieve all parse settings", "tags": [ "Webhooks" ], "description": "**This endpoint allows you to retrieve all of your current inbound parse settings.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "result": { "type": "array", "description": "The list of your current inbound parse settings.", "items": { "$ref": "#/definitions/parse-setting" } } } }, "examples": { "application/json": { "result": [ { "url": "http://mydomain.com/parse", "hostname": "mail.mydomain.com", "spam_check": true, "send_raw": true } ] } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "post": { "operationId": "POST_user-webhooks-parse-settings", "summary": "Create a parse setting", "tags": [ "Settings - Inbound Parse" ], "description": "**This endpoint allows you to create a new inbound parse setting.**\n\nCreating an Inbound Parse setting requires two pieces of information: a `url` and a `hostname`.\n\nThe `hostname` must correspond to a domain authenticated by Twilio SendGrid on your account. If you need to complete domain authentication, you can use the [Twilio SendGrid App](https://app.sendgrid.com/settings/sender_auth) or the \"Authenticate a domain\" endpoint. See \"[How to Set Up Domain Authentication](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/)\" for instructions.\n\nAny email received by the `hostname` will be parsed when you complete this setup. You must also add a Twilio SendGrid MX record to this domain's DNS records. See \"[Setting up the Inbound Parse Webhook](https://sendgrid.com/docs/for-developers/parsing-email/setting-up-the-inbound-parse-webhook/)\" for full instructions.\n\nThe `url` represents a location where the parsed message data will be delivered. Twilio SendGrid will make an HTTP POST request to this `url` with the message data. The `url` must be publicly reachable, and your application must return a `200` status code to signal that the message data has been received.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/parse-setting", "example": { "hostname": "myhostname.com", "url": "http://email.myhosthame.com", "spam_check": true, "send_raw": false } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/parse-setting" }, "examples": { "application/json": { "url": "http://email.myhostname.com", "hostname": "myhostname.com", "spam_check": false, "send_raw": true } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } }, "/user/webhooks/parse/stats": { "get": { "operationId": "GET_user-webhooks-parse-stats", "summary": "Retrieves Inbound Parse Webhook statistics.", "tags": [ "Webhooks" ], "description": "**This endpoint allows you to retrieve the statistics for your Parse Webhook useage.**\n\nSendGrid's Inbound Parse Webhook allows you to parse the contents and attachments of incomming emails. The Parse API can then POST the parsed emails to a URL that you specify. The Inbound Parse Webhook cannot parse messages greater than 30MB in size, including all attachments.\n\nThere are a number of pre-made integrations for the SendGrid Parse Webhook which make processing events easy. You can find these integrations in the [Library Index](https://sendgrid.com/docs/Integrate/libraries.html#-Webhook-Libraries).", "parameters": [ { "name": "limit", "in": "query", "description": "The number of statistics to return on each page.", "required": false, "type": "string" }, { "name": "offset", "in": "query", "description": "The number of statistics to skip.", "required": false, "type": "string" }, { "name": "aggregated_by", "in": "query", "description": "How you would like the statistics to by grouped. ", "required": false, "type": "string", "enum": [ "day", "week", "month" ] }, { "name": "start_date", "in": "query", "description": "The starting date of the statistics you want to retrieve. Must be in the format YYYY-MM-DD", "required": true, "type": "string" }, { "name": "end_date", "in": "query", "description": "The end date of the statistics you want to retrieve. Must be in the format YYYY-MM-DD", "required": false, "type": "string", "default": "The day the request is made." }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date that the stats were collected." }, "stats": { "type": "array", "description": "The Parse Webhook usage statistics.", "items": { "type": "object", "properties": { "metrics": { "type": "object", "properties": { "received": { "type": "number", "description": "The number of emails received and parsed by the Parse Webhook." } }, "required": [ "received" ] } } } } }, "required": [ "date", "stats" ] } }, "examples": { "application/json": [ { "date": "2015-10-11", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-12", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-13", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-14", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-15", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-16", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-17", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-18", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-19", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-20", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-21", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-22", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-23", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-24", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-25", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-26", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-27", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-28", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-29", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-30", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-10-31", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-01", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-02", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-03", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-04", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-05", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-06", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-07", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-08", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-09", "stats": [ { "metrics": { "received": 0 } } ] }, { "date": "2015-11-10", "stats": [ { "metrics": { "received": 0 } } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/user/webhooks/event/settings/signed": { "get": { "operationId": "GET_user-webhooks-event-settings-signed", "summary": "Retrieve Signed Webhook Public Key", "tags": [ "Webhooks" ], "description": "**This endpoint allows you to retrieve your signed webhook's public key.**\n\nOnce you have enabled signing of the Event Webhook, you will need the public key provided to verify the signatures on requests coming from Twilio SendGrid. You can retrieve the public key from this endpoint at any time.\n\nFor more information about cryptographically signing the Event Webhook, see [Getting Started with the Event Webhook Security Features](https://sendgrid.com/docs/for-developers/tracking-events/getting-started-event-webhook-security-features).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "public_key": { "type": "string", "description": "The public key you can use to verify the Twilio SendGrid signature." } }, "required": [ "public_key" ] }, "examples": { "application/json": { "public_key": "anim quis in sint" } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_user-webhooks-event-settings-signed", "summary": "Enable/Disable Signed Webhook", "tags": [ "Webhooks" ], "description": "**This endpoint allows you to enable or disable signing of the Event Webhook.**\n\nThis endpoint takes a single boolean request parameter, `enabled`. You may either enable or disable signing of the Event Webhook using this endpoint. Once enabled, you can retrieve your public key using the `/webhooks/event/settings/signed` endpoint.\n\nFor more information about cryptographically signing the Event Webhook, see [Getting Started with the Event Webhook Security Features](https://sendgrid.com/docs/for-developers/tracking-events/getting-started-event-webhook-security-features).", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "enabled": { "type": "boolean" } }, "required": [ "enabled" ], "example": { "enabled": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "public_key": { "type": "string", "description": "The public key you can use to verify the Twilio SendGrid signature." } }, "required": [ "public_key" ] }, "examples": { "application/json": { "public_key": "voluptate id Excepteur proident" } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": [ "string", "null" ] }, "message": { "type": "string" } }, "required": [ "message" ] } } } }, "examples": { "application/json": { "errors": [ { "message": "mollit consequat dolore commodo", "field": "anim Ut" }, { "message": "qui" }, { "message": "commodo dolor ipsum" }, { "message": "minim fugiat amet", "field": "quis consectetur eiusmod ullamco laboris" } ] } } }, "401": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": [ "string", "null" ] }, "message": { "type": "string" } }, "required": [ "message" ] } } } }, "examples": { "application/json": { "errors": [ { "message": "fugiat", "field": "in proident" }, { "message": "adipisicing veniam laboris sunt ullamco", "field": "ut" }, { "message": "id sunt consequat Duis irure" }, { "message": "nisi", "field": "in qui" }, { "message": "tempor in eiusmod elit" } ] } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": [ "string", "null" ] }, "message": { "type": "string" } }, "required": [ "message" ] } } } }, "examples": { "application/json": { "errors": [ { "message": "Excepteur culpa esse ea ut" }, { "message": "enim Excepteur dolore dolore" }, { "message": "dolor occaecat" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/user/webhooks/event/test": { "post": { "operationId": "POST_user-webhooks-event-test", "summary": "Test Event Notification Settings", "tags": [ "Webhooks" ], "description": "**This endpoint allows you to test your event webhook by sending a fake event notification post to the provided URL.**\n\nSendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.\n\nCommon uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.\n\n>**Tip**: Retry logic for this endpoint differs from other endpoints, which use a rolling 24-hour retry.\n\nIf your web server does not return a 2xx response type, we will retry a POST request until we receive a 2xx response or the maximum time of 10 minutes has expired.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "url": { "type": "string", "description": "The URL where you would like the test notification to be sent." }, "oauth_client_id": { "type": "string", "description": "The client ID Twilio SendGrid sends to your OAuth server or service provider to generate an OAuth access token. When passing data in this field, you must also include the oauth_client_secret and oauth_token_url fields." }, "oauth_client_secret": { "type": "string", "description": "This secret is needed only once to create an access token. SendGrid will store this secret, allowing you to update your Client ID and Token URL without passing the secret to SendGrid again. When passing data in this field, you must also include the oauth_client_id and oauth_token_url fields." }, "oauth_token_url": { "type": "string", "description": "The URL where Twilio SendGrid sends the Client ID and Client Secret to generate an access token. This should be your OAuth server or service provider. When passing data in this field, you must also include the oauth_client_id and oauth_client_secret fields." } }, "example": { "url": "mollit non ipsum magna", "oauth_client_id": "nisi", "oauth_client_secret": "veniam commodo ex sunt", "oauth_token_url": "dolor Duis" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "" } }, "security": [ { "Authorization": [] } ] } }, "/messages": { "get": { "operationId": "GET-messages", "summary": "Filter all messages", "tags": [ "Query", "Messages" ], "description": "This is **BETA** functionality. You may not have access, and we reserve the right to change functionality without notice.\n\nFilter all messages to search your Email Activity. All queries need to be [URL encoded](https://meyerweb.com/eric/tools/dencoder/), and have this format:\n\n`query={query_type}=\"{query_content}\"`\n\nencoded, this would look like this:\n\n`query=type%3D%22query_content%22`\n\nfor example:\n\nFilter by a specific email - `query=to_email%3D%22example%40example.com%22`\n\nFilter by subject line - `query=subject%3d%22A%20Great%20Subject%22`\n\n**Full list of basic query types and examples:**\n\n\n| **Filter query** | **Unencoded Example** (put this one into the try it out query - it'll automatically encode it for you) | **Encoded Example** (use this one in your code) |\n|-----------------|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|\n| msg_id | msg_id=“filter0307p1las1-16816-5A023E36-1.0” | msg_id%3D%22filter0307p1las1-16816-5A023E36-1.0%22 |\n| from_email | from_email=“testing@sendgrid.net” | from_email%3D%22testing%40sendgrid.net%22 |\n| subject | subject=\"This is a subject test\" | subject%22This%20is%20a%20subject%20test%22 |\n| to_email | to_email=\"example@example.com\" | to_email%3D%22example%40example.com%22 |\n| status | | status%22processed%22 |\n| template_id | | |\n| asm_group_id | | |\n| api_key_id | | |\n| events | status=\"processed\" | status%3D%22processed%22 |\n| originating_ip | | |\n| categories | | |\n| unique_args | | |\n| outbound_ip | | |\n| last_event_time | last_event_time=“2017-11-07T23:13:58Z” | last_event_time%3D%E2%80%9C2017-11-07T23%3A13%3A58Z%E2%80%9D |\n| clicks | clicks=\"0\" | clicks%3D%220%22 |\n\nFor information about building compound queries, and for the full query language functionality, see the [query language reference](https://docs.google.com/a/sendgrid.com/document/d/1fWoKTFNfg5UUsB6t9KuIcSo9CetKF_T0bGfWJ_gdPCs/edit?usp=sharing).\n\nComing soon, example compound queries: limit + to email + date", "parameters": [ { "name": "query", "in": "query", "description": "Use the query syntax to filter your email activity.", "required": true, "type": "string" }, { "name": "limit", "in": "query", "description": "The number of messages returned. This parameter must be greater than 0 and less than or equal to 1000", "required": false, "type": "number", "default": 10, "minimum": 1, "maximum": 1000 }, { "name": "X-Query-Id", "in": "header", "required": false, "type": "string" }, { "name": "X-Cursor", "in": "header", "required": false, "type": "string" }, { "$ref": "#/parameters/trait:authorizationHeader:Authorization" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "messages": { "type": "array", "items": { "allOf": [ { "$ref": "#/definitions/email-activity-response-common-fields" }, { "type": "object", "properties": { "opens_count": { "type": "integer", "description": "The number of times the message was opened." }, "clicks_count": { "type": "integer", "description": "The number of times links in the message were clicked." }, "last_event_time": { "type": "integer", "description": "A timestamp of the last event received for the specific message." } } } ], "title": "Abbv. Message", "type": "object", "properties": { "from_email": { "type": "string" }, "msg_id": { "type": "string" }, "subject": { "type": "string" }, "to_email": { "type": "string" }, "status": { "type": "string", "enum": [ "processed", "delivered", "not_delivered" ] }, "opens_count": { "type": "integer" }, "clicks_count": { "type": "integer" }, "last_event_time": { "type": "string", "description": "iso 8601 format" } }, "required": [ "from_email", "msg_id", "subject", "to_email", "status", "opens_count", "clicks_count", "last_event_time" ], "example": { "from_email": "from@test.com", "msg_id": "abc123", "subject": "anim Duis sint veniam", "to_email": "test@test.com", "status": "processed", "opens_count": 1, "clicks_count": 2, "last_event_time": "2017-10-13T18:56:21Z" } } } } }, "examples": { "application/json": { "messages": [ { "from_email": "from@test.com", "msg_id": "abc123", "subject": "something profound", "to_email": "to@test.com", "status": "processed", "opens_count": 0, "clicks_count": 0, "last_event_time": 1495064728, "last_timestamp": 1495064728 }, { "from_email": "yeah@test.com", "msg_id": "321befe", "subject": "something profound", "to_email": "nah@test.com", "status": "delivered", "opens_count": 500, "clicks_count": 200, "last_event_time": 1495064793, "last_timestamp": 1495064793 }, { "from_email": "sad@test.com", "msg_id": "434512dfg", "subject": "something sad", "to_email": "reject@test.com", "status": "not delivered", "opens_count": 0, "clicks_count": 0, "last_event_time": 1495064993, "last_timestamp": 1495064993 } ] } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } }, "required": [ "message" ] } } }, "required": [ "errors" ] }, "examples": { "application/json": { "errors": [ { "message": "invalid syntax: 'bad_field' is not a known field" } ] } } }, "429": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "too many requests" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/messages/{msg_id}": { "parameters": [ { "name": "msg_id", "in": "path", "description": "The ID of the message you are requesting details for.", "required": true, "type": "string" } ], "get": { "operationId": "GET-v3-messages-msg_id", "summary": "Filter messages by message ID", "tags": [ "Query", "Messages" ], "description": "This is BETA functionality. You may not have access, and we reserve the right to change functionality without notice.\n\nGet all of the details about the specified message.", "responses": { "200": { "description": "", "schema": { "allOf": [ { "$ref": "#/definitions/email-activity-response-common-fields" }, { "type": "object", "example": { "from_email": "jane_doe@example.com", "msg_id": "in aliquip id aliqua", "subject": "est incididunt adipisicing pariatur", "to_email": "send@test.com", "status": "not delivered", "template_id": "123e4567-e89b-12d3-a456-426655440000", "asm_group_id": 11376349, "teammate": "", "api_key_id": "sdfsdfsdf123", "originating_ip": "2.3.4.5", "events": [ { "event_name": "bounced", "processed": 1492453589, "server_response": "some error message" } ], "categories": [ "hi", "bye" ], "unique_args": "{'key': 'value'}", "outbound_ip": "1.2.3.4", "outbound_ip_type": "dedicated" }, "properties": { "template_id": { "type": "string", "description": "The ID associated with a Twilio SendGrid email template used to format the message." }, "asm_group_id": { "type": "integer", "minimum": 1, "description": "The unsubscribe group associated with this email." }, "teammate": { "type": "string", "description": "Teammate's username", "minLength": 0, "maxLength": 64, "pattern": "^$|^[A-Za-z0-9]+" }, "api_key_id": { "type": "string", "minLength": 3, "maxLength": 50, "pattern": "^[A-Za-z0-9]+", "description": "The ID of the API Key used to authenticate the sending request for the message." }, "events": { "type": "array", "description": "List of events related to email message", "items": { "title": "Event", "type": "object", "example": { "event_name": "bounced", "processed": "2017-10-13T18:56:21Z", "reason": "some reason", "url": "http://3LX,MU}N=B8'd,K}>bEma{l~!ad%peIF}y>qHfLPWQ$l9b\\!6.1H?$Z9H\"il-_gZD>/JPYsGqH4x4_3v090TCtnFalXGFiAdooDxgrDAYNXShUywSxwYr8gKeyc/4sal4VJ3IxEWsG74V5MYQ0mz27jhy7n5DHsUtApQ6zXHS13uO5vYBlJHpJRfuT6/F5nIpkHre2w3eTtN7M6pg9V5stjnnsavKkzQxyTv15CMSDLFwR_BTZwofhWpyBU7B9ypYL79vT97N3LDZyoaM/fNsOLPIqfGBer_Mx9_StergbQYANyOmOSjR6pZof01ky/ZcNDhpu3CkSl4MTtQ3NMCX780pOKQ5SYIPigyvz9IC9WtrCNcOkTxdOPdY0_4MJU4EuTTPmGvO/14KaJCDjIjgrbIqpzuUEL5mET0t2VeVlwvtnOnlHaBE8sic20ze2E0Xt3ETqXyzVJRjLDKh/LWkW8OVp_xkLBCCW7LQngRukKcOiWjMXeCEhYI9HoZ0RsMEWZC8KzRaHc4OI0uXPD4M9pav1LGrI/_0t_RnBnfnqGKsBJr0kdQi/Y6QN_aeawIqX5hDNIU3MF/wWKVWLS0ZFbDfK6KVv5oAid83EpwKoazAMA8MTfEXvHQLO7k7XYWX1Il3eGXL6/wCA96I1SOabzJkZHo2HsFpIC/VBk52Lnpp0xtDH/OCdlQ5e4PpxXQeklp70LPOndr7QKSYEQNUc48n36ixvTjhgpgO8wHsFFYqGcuBMHg9oaCARppQomiQDWYuVPVDynJHdsM1_gWl4/NSs8Y9PL7DrQXOu0UiFRRE0TUsvgqyUgJzlGjUnRziyYeROO75D0K_3aTtbGbCmhaxecos40a1w0PDCNkFp1W/iHwY7922drhsoM6ShwqqwGpAh5HLuU6Q5gqyckeai6YN7HCh9DdHPhhJcatgtMHZDKfQUBVt9ecUlDgiCFF_OnRX/GpzttcsL8E2FoXL9_eAWvSqjodROqx7MZCA/ORdnR/IssPCYP1kTHTIL5mZxv4UGEpyNjUzt4GdSJJTm0nztltWDYX8_Ezl2JvpLVnGVTJxobb4yQIJhe3n64khbOFyFLKHWEniIolm/AxpZQYmseWlVqrIz3YXU59XaSbTTrdCHNhvwF1ogXiiggN6TZ2B3QY_mBEtAp/SD0ONPVqEUkTNAFWTgnnlv6ZIMdMbTw5uZwtFRlB7qDvQouml9kujGmRu6k7zZMTOwWowRNtpboLUcL2NzkVgK6N1Zi2vq/Nt4NJvM5_l1dpIIbwJv_CIcZQZOqPtRWULa2iVxfmJJQaqgLQPwSHQH1zuRJMhraEsPjqVQRC0pZpSt/24VBDN8y31Ye/y_ekWxMdZCvr978C/WrdcTi29kxjJLyT9BII7BsgT5vLuI2l7ntqRAhAUWMs/h9JR0i8RbX5OfB46q41/TfmSdgi97bCR2HfgflyypXwKhRfKYU2MVpu2Dd90WQUlm7hZV8dSfGusuMj/nPMpRVWcbnvlAdsehJCPbLv6n4qdLSPeoMBo32acAGgu1BwBG8JsBgbH43yYi5X7UdGRWKqm_ZbqaDEKH3ncU/uA8EOJb41VfGho4LUeOi1IeYwVAhFEyO6YbteYZecEubrNFZrWWjZUqhzouzY95TeWU8E4StCXVPKlYPiFiwUSX20kG0lVtDbAy/7u4f4x0cYlFOvI1UN1qoOExmNxnxzQQFeM5exWfW2JrRXq5e0UdAJr4q2o9Y_0WaGfhL/nP6Ei06YajDKr11dK5H0LX/9CGTC37HFZeopyopzP_7fvGFkqIRoGTS48pLaIFz3gwpQNlWXUFCsd/PnRlsqJ3SBQSgp_AQe2cP6iBNy2bJI8lkxwY5YVDDdjxusuCcafdjfs2aUa/4tr_iMnNBnd27GxjQI28_JGJlfbOaajVJOxuPMT4ELpYCfPiFjdSbJyE0/gCwtj0rgDKSLWJnOPJ5TAJ935gCqeIsBhOhfcZX413GdilBZRRYEjCVKfOuWzHZ3GW/8yjyk5e_WMNv5F6xggl07w90DBwpx/Q/iWfncqMuSfoeFeqHQkDL9F5W19j1cGuAcyfIYMAXztHXpgTKh9vZcsLYC7LcgKr4FQj3JjEvtnDG2PjcMjGF/MnbCRCz22Ho410_vE9M1Hpq0wdk_i5DbZKNoSwlPgey9URkpuX146TcDdsx_VWDenCepY5HwMr9CPOY9hzUs/c5AWeUMXk/gvsI81Jkv5rHpEnNBUZXYzfqkwQfffhmrc/StLCtzRRlja8dpsEWdkzoKR9Kdxq1qAs5f0sdrGjVRLTT_s1Q2P59zhA/QmS4bubi64cYot3gSIgdNnkjA2GjCp1ETVa548_U9B6boTKDVmaKJlVIDvqL84RC3WI7Er/8opi2lZ48W83Ur47BRh38oOnI0agrCyZz8bp1w_gfVRlSO8PS0i/l_/qxq5xpLbhPkdxVoyZVsNAZchfnmkIHyIk5IK6EUDXdMR21y6OvKW50ZbooAtk9ymynBj4dAYMsd25RV7FE1I1vRTsiDw52/.E5WC0Ymo2zn.qelSbhzr-4laArYiWP.dwJB6qm_6rs0Rm5UXYaYtUNbh76_jJp_X1xQUCDSgbr2KOkDU0\"Q/-4dV\"Yk3QGg[(O86=Pf\"e17K4'r{)kicofHSXcMmP@>VF^`~4j4F*L/1]tD+Lw!WI!@]*OZm6C`M$u96}*ObEma{l~!ad%peIF}y>qHfLPWQ$l9b\\!6.1H?$Z9H\"il-_gZD>/JPYsGqH4x4_3v090TCtnFalXGFiAdooDxgrDAYNXShUywSxwYr8gKeyc/4sal4VJ3IxEWsG74V5MYQ0mz27jhy7n5DHsUtApQ6zXHS13uO5vYBlJHpJRfuT6/F5nIpkHre2w3eTtN7M6pg9V5stjnnsavKkzQxyTv15CMSDLFwR_BTZwofhWpyBU7B9ypYL79vT97N3LDZyoaM/fNsOLPIqfGBer_Mx9_StergbQYANyOmOSjR6pZof01ky/ZcNDhpu3CkSl4MTtQ3NMCX780pOKQ5SYIPigyvz9IC9WtrCNcOkTxdOPdY0_4MJU4EuTTPmGvO/14KaJCDjIjgrbIqpzuUEL5mET0t2VeVlwvtnOnlHaBE8sic20ze2E0Xt3ETqXyzVJRjLDKh/LWkW8OVp_xkLBCCW7LQngRukKcOiWjMXeCEhYI9HoZ0RsMEWZC8KzRaHc4OI0uXPD4M9pav1LGrI/_0t_RnBnfnqGKsBJr0kdQi/Y6QN_aeawIqX5hDNIU3MF/wWKVWLS0ZFbDfK6KVv5oAid83EpwKoazAMA8MTfEXvHQLO7k7XYWX1Il3eGXL6/wCA96I1SOabzJkZHo2HsFpIC/VBk52Lnpp0xtDH/OCdlQ5e4PpxXQeklp70LPOndr7QKSYEQNUc48n36ixvTjhgpgO8wHsFFYqGcuBMHg9oaCARppQomiQDWYuVPVDynJHdsM1_gWl4/NSs8Y9PL7DrQXOu0UiFRRE0TUsvgqyUgJzlGjUnRziyYeROO75D0K_3aTtbGbCmhaxecos40a1w0PDCNkFp1W/iHwY7922drhsoM6ShwqqwGpAh5HLuU6Q5gqyckeai6YN7HCh9DdHPhhJcatgtMHZDKfQUBVt9ecUlDgiCFF_OnRX/GpzttcsL8E2FoXL9_eAWvSqjodROqx7MZCA/ORdnR/IssPCYP1kTHTIL5mZxv4UGEpyNjUzt4GdSJJTm0nztltWDYX8_Ezl2JvpLVnGVTJxobb4yQIJhe3n64khbOFyFLKHWEniIolm/AxpZQYmseWlVqrIz3YXU59XaSbTTrdCHNhvwF1ogXiiggN6TZ2B3QY_mBEtAp/SD0ONPVqEUkTNAFWTgnnlv6ZIMdMbTw5uZwtFRlB7qDvQouml9kujGmRu6k7zZMTOwWowRNtpboLUcL2NzkVgK6N1Zi2vq/Nt4NJvM5_l1dpIIbwJv_CIcZQZOqPtRWULa2iVxfmJJQaqgLQPwSHQH1zuRJMhraEsPjqVQRC0pZpSt/24VBDN8y31Ye/y_ekWxMdZCvr978C/WrdcTi29kxjJLyT9BII7BsgT5vLuI2l7ntqRAhAUWMs/h9JR0i8RbX5OfB46q41/TfmSdgi97bCR2HfgflyypXwKhRfKYU2MVpu2Dd90WQUlm7hZV8dSfGusuMj/nPMpRVWcbnvlAdsehJCPbLv6n4qdLSPeoMBo32acAGgu1BwBG8JsBgbH43yYi5X7UdGRWKqm_ZbqaDEKH3ncU/uA8EOJb41VfGho4LUeOi1IeYwVAhFEyO6YbteYZecEubrNFZrWWjZUqhzouzY95TeWU8E4StCXVPKlYPiFiwUSX20kG0lVtDbAy/7u4f4x0cYlFOvI1UN1qoOExmNxnxzQQFeM5exWfW2JrRXq5e0UdAJr4q2o9Y_0WaGfhL/nP6Ei06YajDKr11dK5H0LX/9CGTC37HFZeopyopzP_7fvGFkqIRoGTS48pLaIFz3gwpQNlWXUFCsd/PnRlsqJ3SBQSgp_AQe2cP6iBNy2bJI8lkxwY5YVDDdjxusuCcafdjfs2aUa/4tr_iMnNBnd27GxjQI28_JGJlfbOaajVJOxuPMT4ELpYCfPiFjdSbJyE0/gCwtj0rgDKSLWJnOPJ5TAJ935gCqeIsBhOhfcZX413GdilBZRRYEjCVKfOuWzHZ3GW/8yjyk5e_WMNv5F6xggl07w90DBwpx/Q/iWfncqMuSfoeFeqHQkDL9F5W19j1cGuAcyfIYMAXztHXpgTKh9vZcsLYC7LcgKr4FQj3JjEvtnDG2PjcMjGF/MnbCRCz22Ho410_vE9M1Hpq0wdk_i5DbZKNoSwlPgey9URkpuX146TcDdsx_VWDenCepY5HwMr9CPOY9hzUs/c5AWeUMXk/gvsI81Jkv5rHpEnNBUZXYzfqkwQfffhmrc/StLCtzRRlja8dpsEWdkzoKR9Kdxq1qAs5f0sdrGjVRLTT_s1Q2P59zhA/QmS4bubi64cYot3gSIgdNnkjA2GjCp1ETVa548_U9B6boTKDVmaKJlVIDvqL84RC3WI7Er/8opi2lZ48W83Ur47BRh38oOnI0agrCyZz8bp1w_gfVRlSO8PS0i/l_/qxq5xpLbhPkdxVoyZVsNAZchfnmkIHyIk5IK6EUDXdMR21y6OvKW50ZbooAtk9ymynBj4dAYMsd25RV7FE1I1vRTsiDw52/.E5WC0Ymo2zn.qelSbhzr-4laArYiWP.dwJB6qm_6rs0Rm5UXYaYtUNbh76_jJp_X1xQUCDSgbr2KOkDU0\"Q/-4dV\"Yk3QGg[(O86=Pf\"e17K4'r{)kicofHSXcMmP@>VF^`~4j4F*L/1]tD+Lw!WI!@]*OZm6C`M$u96}*O0OiStFG.ZoRi2=j%fUVa]&re6k{hKqD-8vWE12Fb5JC6z>S@@'cWS~w5KtuIwv$8/JDD94CXx1n5yjC_I2lQ66zDj4MXe/4bqlcqqQ7evnQWTYx5roaEYMapyuzb/USpsyalh/HcYc9PmQfF8ND_C7bXnwFQ_fb_BHMXbIV8JN28/NjZdawDJ6kSWxLykSVTHzcISGPBRfs_rt3Uc65Vzj6LDSSMN8WRs70m0tAWs/fkDvjvm_7ZeV08YZeB9j9mS9BcE089Fn5UzDlTJW9vqDF5uipjlIVrNbM7oWE/MIJcjg2vJO20jA24WHrchrEXCvKcxriviSDl3tuyDxqdqRSekpm2aH6yW7_ylXj/nWsex4jm3rKvYw1uLq3Tp7qb9edhj8B_TnwLv1yjHSkgbA5jKI4BTqxugmwVTnFf2OFCFp/ZILLkoKgfwOyIK4reUIkhCjuhkwp/cqGaFAkeCFQXPB6DLYesLZ2M3KPuBsBrs3pr3HRbTtwaOzdKtGc8e0C0VTjrJ3GwljStMPrSuQWh6/vigHRasZ4P9kFv5DPVbHWZzPvtwUw0AMByt44YH678WpbAXXy4I/IVOHmErZTbw1mJ/3vd4uI5rr2zEO_YA9qJZLJT/wmBimbOyaMtmTNYr_FhgfkKMN3_1la7RCK8CIP3p26mbuHbdJV1j/5sTIKibInM5l2BoWdEi49bPqzagsfjKpGVbg0YQ8mjrLhI92/qy0eVYi34kBGVuLzxK2FLC8vwYUrbupjUYE23Mc_6nmHYRK1HF1QmZDZG1hw96I3MPbTZqeJOWGch230qDNxOgnHRNNM52k/3c7FeuRr88RwZGpif/4FaSAbdqkUNvJ9J9qX2tJS9x5vZlgD8k4YHIXDztrnwg2VPquj/uo_2MjbWybIF/NGJM2RFAsKV1S5iOejuTV4p12KlH1p0Dt5EpxCSIl0XoWuvyLYar77f_hzqNdWAyL0FDxGfj4ma4jwqdTTLNyeZEtguYoCHTFfY/HgJkpHx/yO23G7gLhKPvD459ceffHidFh7LipTxNF0GFXhIAPrWfhv7PkPmVofBoFFlo6/rMcHQ82d5VS8i1CCyLtfuT5WH9GqrsOY7xo3lxi7BNL93/PLRdQT3SObRFRERw68V5ZFvIuEQqFOFZQ848rWPLXYDGY658dyjZALf/Ug4EROi_ehNtzPwecer_RGBHxeMnpxrPAFZEL6YXNKzm8hh3HY4Uc4fgkjge5fXsR4CeTSkS66/FOD00deDKmN7XcHEj1LGlAmd4XlV8vFpXg2VazX4OLW8z6vXn5vntNGYO6eBCEKUwupRz9nQSMeZ/Pbmjoopyt6TxQBUfPkHBdgCIhqA1zDV72ARqGlK_ao9KVjvgbB98YeiieIyogkuOa4y0E5iUEdBopzovVgtY88yLijh9ww/tl0R5rI2P2_OxguTbv_wrfEm8jRjISEIqSE9q29RB3n8PeD4hu24rcsaEuTMCqniiLN0a2OtZiKxHnbsNB660Aq3/tEo2SHZBkkIFYXBbDNE7gLfvFz9ZaC_E2oV2quyK1Id5SkNkJBVRRgROWBc_XEOXktc4vRUKxy1MQ526Xilyo8/uI67lHH1Vlr4V3GVmweT4A16KMqzmVzvRDRFLpkBv2iu3Okc1vIqkC/426aOqeUm6SXIx16d8BWVRcmqKqizxDEF3JkLFgX0ab73CZ4GdJ9YaakJO7y4adFGzzIVLcn08UZ/pwDQ9BAuwuMc2yMnKihdvmLKbnAa1ATk9jFXQ9QAEMBHZLbPNvtS3pkpk0s6fyh2ceHa9Myy3fL/oqvPmq_14KzLgPZHaOlyb3tUoQM52fv/I78TqTGyB4WYD_vkm8gYHZcCF0dFIXsiXUbAbwR90Ldk8lsgxSL6rBvjPSlQq7N66NPzUVRYr3zSISupG_66uS4rJszHwmxmmraT3/zfVKxHXFHgxUDRmnwIMfdFKm4sf/qnRRccOLExJYGcZy8u65jo4gHDvO6vnpsdf0YtVWqDBJXa95/Y/qL7EYS73_t6/2xnWra9TTO0OtQNXEQ1XXLSLt6vPw1FTlE2aYCitDgUo7DyxiwuGtvmMKUkYCo/lqXouo2TGXZFF80lrCu1vKdxBgOOerlrsKrOJawGEzL8XzXdxkOMUT8HOzHPNOvDwsxc47mvpVzXEbX5DRaioOlm2U4flTG/6bZfLqJqHNtrKwC5U5NNG6_yNOW5Jg_bLmzUosi86IXxn7i04vRXXn92JmdE70TcdujehT1n15wtiD8ld5A65IV2W1801/wr0XcDIGiUSmxFfCozUCtBTFwln0uJ0cquSDXhj7JQADhYDGyz8WhqcPE7CP9xN93EUBrWczINbA4IsfckY8CZh68/Tak5dEhw8i_3rz/8U39D/iML1G_A8TsnKQ9/_S8o89fFc7Wx/f1nXF8H6OLVbPpp5IZg7UTZ2K0bSe3iBpsmkkJpxY_6zEHTJE3LbIANwF9Ik5Tu0ZJpjck7I07xlHR8mDW9FXclSQC/qJUGL5qByf2SY2Wd24hqKGrahLfqApQuRI8_DtU/Y8kH6DDif5kD6as3sIe6VbKYnU9c1URq/npTlE72m107FXxW9zktdzbBJAxt4udMFzjt2LPcBpqrMKGkrg4BHqKXwhFTspCWyYCjxJ/eFb3fd3BB5kb9D0yl3oOjeWtbJBqsboyzdLisRBn2MCtXO2O8eo4Hkm/2uJDoRjRCyIi2GNRkH0B3EkN6Z3vG40C985bAtM8eqHABzP2QRcKCz4ICOw_Xz249bJk8qM0/m4EeIWnx2ISf9TBU6_0KZ5QJ0VPOCPXxV9jCeK5W5/RV5nd7GUUXG0btDqUAa3DzpaRHX3klMAqL73hK4AGD3ItikmxF8vnSaqtsgOCpEePERt9qcUOJJP2aR0scPAf_1TkGSrgr5VF/XLM2i7YhC_3J9fA2Qwa0dbTedY/xGayjimEkuWSWvh7P5FNOum_l7qJPnA31lQq6ixqR0NKhO328rWfijqKHF6WR/5O0MJ4WNuIXk6xBtTOA9mK7CGUgWjaF5mB72PVnDpN8G6ERO39GqO/fCO96/A1mwIPWedF6HklU8jaQ_M5EUzwCsBE3/7FW2hbcD3GCOFCiLvObjn59o6CKoYlmTop/PZw2CLzvARAr5KaLhjIuZRSKTGlmYjvSoSELuvWi/QHUV7SJ0kF_1O3b_3a88cm/z7qD3Rp6MmoQdGPSyu1lXTpoETypgOMywfsr4ycV2LQr5XaE3UrQP/RzobA4rI_I3ceCUaRASmil2rV1TUiyljhdCFt8zmi1o2NyTzSBRNGP0lXU5Qtm6dKKp7lGRC19P2oSSFrxt85vWRNo1mv8odcL/TF7/MN1Ev7gY20MqlRSBrlwg5LZ4_Az7QnBnpbU3LkTC/oVb743VFtXMW4cK/3lw6wfBJZe_8DobxT_6/gCXp6QOs/LuqmrQHMQvTS6jfbqVFnPfLjrQ01Mb_F4lr3md6m87wpc1CYd9hdzgUL/aqz68HMDCxjGauC00Rajq9wGVYcWJ3j6rIaHIPwclftjARXFDg0yH8v/L6qDgIgGwbB3eZfjOXHAMXRFNMMihseZxYkcFAzLtYr94q9XpQeK4bKi9h_rWAMwcEHnS8/MHHlySbgy8azGEA0u9xsY96MRi45Qe74kZ9xlsI1t4Yutx8/gsjIiu7vNsKEyeTwd88BMExjWNcJHOSHRff57pJBMEAtPdbMETYorvUkRyErsqprxX0W45n0RRQ85w/JCOsYaxZOAFfzO0AdLpMCguFwl01fkFOKYrQeXfNn8w0KF4XS0k/fPx02fU7fFjUoXcPH7_9xo755WL8DNIU2ne4b6DpiROe473yUfD8_zSNUI1tpxzVYNA7GvVSYt8UtqHn3/_QwuOc4VeAI6RiAG5O5bcAxzQl96Q35emNwtTT_CYqHORCmyPj6By2hT_SCLf8m_xFxxe3YzvnxDZGq3qf__pq7Tw181/GosBAJy3MotiIxcYDASbY9sV4T2V/KoGHyJ64spdkQbJOHJ216JMSKj8ii5m8gxqJ2ypL81p5hbjWtjbUgSc8M_KTLuc0Owf1R/3vr/dKbQ2pJ4XEfXhnZTBQY7ZrClnVCnd5cMe9ic/aNF0yyOSQVVOecUFkK9IYFVR8VHdVf4/Nfu3nOEskHki1_r3At1HLOMniS6qNTvhS0hfqIuBiQBsd5aB7OdfVpYy1HdIR72gMToBlpHPsE5GrVO0J9/gcyB2xcyZ3UpTom8G3V48LUkk6kcJ6l1SL5Fgzbst0z3pDA4dzBfswbC8dW57_MkswDANNd8atPrOBSU5m2z66dP/mIYQ8iq/DcmBexkARDI47VzYuw5gwy8Lvym2_B2gxBokU9_T/fHCPjlpqjTsY6SgBOz1nlDh_HcSWYAqnyrZxbEO2erVJ4WPKNzjM3KaPXGH/dZryna1E28wxCrMqLCs9aL9oVBlDMjUcEryAyRh7xwN0uWGopdpkd7Du6O9EPjAj37sHkUiVs7WL6JyexoDF_n67MICvQnJ9FK/FVrp1uMZnmr7ijkMW87moNRBkXbVc2EA_hHOHmpbVGqr6WgNtJ7bBk1LrAPT8sKtE75vbe_L9VYqBHJ/njk.WIIj-V23pwC7ZahcIL0XnDPupL7ltwEc779Ofhrk9dt_wIOFsA8XwnCjrYqH2ty.F0XdS\"*;@kDYgfL4dwE/5I@>k|u0D:wGz\"_8=}RJM!Ybbwd}eN=ZB*esF&(iQ%FW]_FSA:3Ze4O*6&tG-Fe**/j^a&S8zIa#6gxL2NmnNMSVGF-Bf3z08tt0ug_UfNshhs4HJh0l1o24gjAN-Uck1OvWkGQSXH0glB7CnOm0gI", "bounce_type": "soft", "mx_server": "laborum nisi", "http_user_agent": "quis re" } ], "originating_ip": "204.173.18.0", "categories": [ "dolor", "pie" ], "unique_args": "eu", "outbound_ip": "181.40.184.87", "outbound_ip_type": "dedicated", "id": "2mMUdxV2HRfAeDiBTYs2IP" } } }, "400": { "description": "", "schema": { "errors": [ { "message": "invalid syntax: 'bad_field' is not a known field" } ] } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "not found", "field": "message_id" } ] } } }, "429": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "too many requests" } ] } } } }, "security": [ { "Authorization": [] } ], "consumes": [ "application/json" ], "parameters": [ { "$ref": "#/parameters/trait:authorizationHeader:Authorization" } ] } }, "/messages/download": { "post": { "operationId": "POST_v3-messages-download", "summary": "Request CSV", "tags": [ "CSV (UI only)", "V3" ], "description": "This is BETA functionality. You may not have access, and we reserve the right to change functionality without notice.\n\nThis request will kick off a backend process to generate a CSV file. Once generated, the worker will then send an email for the user download the file. The link will expire in 3 days.\n\nThe CSV fill contain the last 1 million messages. This endpoint will be rate limited to 1 request every 12 hours (rate limit may change).\n\nThis endpoint is similar to the GET Single Message endpoint - the only difference is that /download is added to indicate that this is a CSV download requests but the same query is used to determine what the CSV should contain.", "parameters": [ { "name": "query", "in": "query", "description": "Uses a SQL like syntax to indicate which messages to include in the CSV", "required": false, "type": "string" }, { "$ref": "#/parameters/trait:authorizationHeader:Authorization" } ], "responses": { "202": { "description": "", "schema": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "pending" ] }, "message": { "type": "string" } } }, "examples": { "application/json": { "status": "pending", "message": "An email will be sent to jane_doe@example.com when the CSV is ready to download." } } }, "400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "some error" } ] } } }, "429": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "too many requests", "field": "" } ] } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "internal server error" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/messages/download/{download_uuid}": { "parameters": [ { "name": "download_uuid", "in": "path", "description": "UUID used to locate the download csv request entry in the DB.\n\nThis is the UUID provided in the email sent to the user when their csv file is ready to download", "required": true, "type": "string", "format": "uuid" } ], "get": { "operationId": "GET_v3-messages-download-download_uuid", "summary": "Download CSV", "tags": [ "CSV (UI only)", "V3" ], "description": "**This endpoint will return a presigned URL that can be used to download the CSV that was requested from the \"Request a CSV\" endpoint.**", "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "presigned_url": { "type": "string", "format": "uri", "description": "A signed link that will allow you to download the CSV file requested by the Request a CSV endpoint." }, "csv": { "type": "string", "minLength": 5, "pattern": "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$", "description": "Returns the aws signed link to the csv file which mako UI should perform a get on to trigger the csv download for the user" } }, "required": [ "csv" ] }, "examples": { "application/json": { "presigned_url": "https://example.com", "csv": "https://s3-us-west-2.amazonaws.com/sendgrid-rts-development-queries/013c31af-7c9a-49e6-922c-d990f4aff151.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600&X-Amz-Credential=AKIAI4NOW7APZHRFYGWQ%2F20170728%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Date=20170728T223936Z&X-Amz-Signature=5c13ede58b211799ab1a556280bd316c404eac3aef1450c47906a077166c4ab4" } } }, "404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "download token is invalid or expired", "field": "" } ] } } }, "500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "examples": { "application/json": { "errors": [ { "message": "internal server error" } ] } } } }, "security": [ { "Authorization": [] } ], "parameters": [ { "$ref": "#/parameters/trait:authorizationHeader:Authorization" } ] } }, "/tracking_settings": { "get": { "operationId": "GET_tracking_settings", "summary": "Retrieve Tracking Settings", "tags": [ "Settings - Tracking" ], "description": "**This endpoint allows you to retrieve a list of all tracking settings on your account.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "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": { "application/json": { "result": [ { "name": "open", "title": "Open Tracking", "description": "lorem ipsum... .", "enabled": true } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/tracking_settings/click": { "get": { "operationId": "GET_tracking_settings-click", "summary": "Retrieve Click Track Settings", "tags": [ "Settings - 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’s 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": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/click-tracking" }, "examples": { "application/json": { "enable_text": false, "enabled": true } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_tracking_settings-click", "summary": "Update Click Tracking Settings", "tags": [ "Settings - 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’s 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": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "The setting you want to use for click tracking." } }, "example": { "enabled": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/click-tracking" }, "examples": { "application/json": { "enable_text": false, "enabled": true } } } }, "security": [ { "Authorization": [] } ] } }, "/tracking_settings/google_analytics": { "get": { "operationId": "GET_tracking_settings-google_analytics", "summary": "Retrieve Google Analytics Settings", "tags": [ "Settings - 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’s 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’s recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/ui/analytics-and-reporting/google-analytics/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/google_analytics_settings" }, "examples": { "application/json": { "enabled": true, "utm_campaign": "", "utm_content": "lotsandlotsofcontent", "utm_medium": "", "utm_source": "", "utm_term": "" } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_tracking_settings-google_analytics", "summary": "Update Google Analytics Settings", "tags": [ "Settings - 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’s 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’s recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/ui/analytics-and-reporting/google-analytics/).", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/google_analytics_settings", "example": { "enabled": true, "utm_source": "sendgrid.com", "utm_medium": "email", "utm_term": "", "utm_content": "", "utm_campaign": "website" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/google_analytics_settings" }, "examples": { "application/json": { "enabled": true, "utm_campaign": "", "utm_content": "lotsandlotsofcontent", "utm_medium": "", "utm_source": "", "utm_term": "" } } } }, "security": [ { "Authorization": [] } ] } }, "/tracking_settings/open": { "get": { "operationId": "GET_tracking_settings-open", "summary": "Get Open Tracking Settings", "tags": [ "Settings - 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’s 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": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if open tracking is enabled." } }, "required": [ "enabled" ] }, "examples": { "application/json": { "enabled": true } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_tracking_settings-open", "summary": "Update Open Tracking Settings", "tags": [ "Settings - 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’s 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": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "The new status that you want to set for open tracking." } }, "example": { "enabled": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if open tracking is enabled." } }, "required": [ "enabled" ] }, "examples": { "application/json": { "enabled": true } } } }, "security": [ { "Authorization": [] } ] } }, "/tracking_settings/subscription": { "get": { "operationId": "GET_tracking_settings-subscription", "summary": "Retrieve Subscription Tracking Settings", "tags": [ "Settings - Tracking" ], "description": "**This endpoint allows you to retrieve your current settings for subscription tracking.**\n\nSubscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/subscription_tracking_settings" }, "examples": { "application/json": { "enabled": true, "html_content": "

Something something unsubscribe <% %> something something

\n", "landing": "

subscribehere

\n", "plain_content": "Something something unsubscribe <% %> something something", "replace": "thetag", "url": "" } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_tracking_settings-subscription", "summary": "Update Subscription Tracking Settings", "tags": [ "Settings - Tracking" ], "description": "**This endpoint allows you to update your current settings for subscription tracking.**\n\nSubscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/subscription_tracking_settings", "example": { "enabled": true, "landing": "landing page html", "url": "url", "replace": "replacement tag", "html_content": "html content", "plain_content": "text content" } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/subscription_tracking_settings" }, "examples": { "application/json": { "enabled": true, "landing": "landing page html", "url": "url", "replace": "replacement tag", "html_content": "html content", "plain_content": "text content" } } } }, "security": [ { "Authorization": [] } ] } }, "/stats": { "get": { "operationId": "GET_stats", "summary": "Retrieve global email statistics", "tags": [ "Stats" ], "description": "**This endpoint allows you to retrieve all of your global email statistics between a given date range.**\n\nParent accounts will see aggregated stats for their account and all subuser accounts. Subuser accounts will only see their own stats.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:limit" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:offset" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:aggregated_by" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:start_date" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:end_date" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date the stats were gathered." }, "stats": { "type": "array", "description": "The individual email activity stats.", "items": { "type": "object", "properties": { "metrics": { "$ref": "#/definitions/stats-advanced-global-stats" } } } } }, "required": [ "date", "stats" ] } }, "examples": { "application/json": [ { "date": "2015-11-03", "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 } } ] }, { "date": "2015-11-04", "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 } } ] }, { "date": "2015-11-05", "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 } } ] }, { "date": "2015-11-06", "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 } } ] }, { "date": "2015-11-07", "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 } } ] }, { "date": "2015-11-08", "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 } } ] }, { "date": "2015-11-09", "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 } } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/geo/stats": { "get": { "operationId": "GET_geo-stats", "summary": "Retrieve email statistics by country and state/province.", "tags": [ "Stats" ], "description": "**This endpoint allows you to retrieve your email statistics segmented by country and state/province.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).", "parameters": [ { "name": "country", "in": "query", "description": "The country you would like to see statistics for. Currently only supported for US and CA.", "type": "string", "enum": [ "US", "CA" ] }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:limit" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:offset" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:aggregated_by" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:start_date" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:end_date" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date that the statistics were gathered." }, "stats": { "type": "array", "description": "The list of statistics.", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "The type of segmentation." }, "name": { "type": "string", "description": "The name of the specific segmentation." }, "metrics": { "$ref": "#/definitions/advanced_stats_clicks_opens" } } } } } } }, "examples": { "application/json": [ { "date": "2015-10-11", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-12", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-13", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-14", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-15", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-16", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-17", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-18", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-19", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-20", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-21", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 1, "unique_clicks": 0, "unique_opens": 1 } } ] }, { "date": "2015-10-22", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-23", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-24", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-25", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-26", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-27", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-28", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-29", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-30", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-31", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-01", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-02", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-03", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-04", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-05", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-06", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-07", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-08", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-09", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-10", "stats": [ { "type": "province", "name": "TX", "metrics": { "clicks": 0, "opens": 0, "unique_clicks": 0, "unique_opens": 0 } } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/devices/stats": { "get": { "operationId": "GET_devices-stats", "summary": "Retrieve email statistics by device type.", "tags": [ "Stats" ], "description": "**This endpoint allows you to retrieve your email statistics segmented by the device type.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\n## Available Device Types\n| **Device** | **Description** | **Example** |\n|---|---|---|\n| Desktop | Email software on desktop computer. | I.E., Outlook, Sparrow, or Apple Mail. |\n| Webmail |\tA web-based email client. | I.E., Yahoo, Google, AOL, or Outlook.com. |\n| Phone | A smart phone. | iPhone, Android, Blackberry, etc.\n| Tablet | A tablet computer. | iPad, android based tablet, etc. |\n| Other | An unrecognized device. |\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:limit" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:offset" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:aggregated_by" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:start_date" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:end_date" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date that the statistics were gathered." }, "stats": { "type": "array", "description": "The list of statistics.", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "The type of segmentation." }, "name": { "type": "string", "description": "The name of the specific segmentation." }, "metrics": { "$ref": "#/definitions/advanced_stats_opens" } } } } } } }, "examples": { "application/json": [ { "date": "2015-10-11", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-12", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-13", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-14", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-15", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-16", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-17", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-18", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-19", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-20", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-21", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 1, "unique_opens": 1 } } ] }, { "date": "2015-10-22", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-23", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-24", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-25", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-26", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 2, "unique_opens": 2 } } ] }, { "date": "2015-10-27", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-28", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-29", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-30", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-31", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-01", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-02", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-03", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-04", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-05", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-06", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-07", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-08", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-09", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-10", "stats": [ { "type": "device", "name": "Webmail", "metrics": { "opens": 0, "unique_opens": 0 } } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/clients/stats": { "get": { "operationId": "GET_clients-stats", "summary": "Retrieve email statistics by client type.", "tags": [ "Stats" ], "description": "**This endpoint allows you to retrieve your email statistics segmented by client type.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" }, { "$ref": "#/parameters/trait:statsAdvancedStatsBaseQueryStrings:start_date" }, { "$ref": "#/parameters/trait:statsAdvancedStatsBaseQueryStrings:end_date" }, { "$ref": "#/parameters/trait:statsAdvancedStatsBaseQueryStrings:aggregated_by" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date that the statistics were gathered." }, "stats": { "type": "array", "description": "The list of statistics.", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "The type of segmentation." }, "name": { "type": "string", "description": "The name of the specific segmentation." }, "metrics": { "$ref": "#/definitions/advanced_stats_opens" } } } } } } }, "examples": { "application/json": [ { "date": "2014-10-01", "stats": [ { "metrics": { "opens": 1, "unique_opens": 1 }, "name": "Gmail", "type": "client" } ] }, { "date": "2014-10-02", "stats": [ { "metrics": { "opens": 0, "unique_opens": 0 }, "name": "Gmail", "type": "client" } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/clients/{client_type}/stats": { "parameters": [ { "name": "client_type", "in": "path", "description": "Specifies the type of client to retrieve stats for. Must be either \"phone\", \"tablet\", \"webmail\", or \"desktop\".", "required": true, "type": "string", "enum": [ "phone", "tablet", "webmail", "desktop" ] } ], "get": { "operationId": "GET_clients-client_type-stats", "summary": "Retrieve stats by a specific client type.", "tags": [ "Stats" ], "description": "**This endpoint allows you to retrieve your email statistics segmented by a specific client type.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\n## Available Client Types\n- phone\n- tablet\n- webmail\n- desktop\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" }, { "$ref": "#/parameters/trait:statsAdvancedStatsBaseQueryStrings:start_date" }, { "$ref": "#/parameters/trait:statsAdvancedStatsBaseQueryStrings:end_date" }, { "$ref": "#/parameters/trait:statsAdvancedStatsBaseQueryStrings:aggregated_by" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date that the statistics were gathered." }, "stats": { "type": "array", "description": "The list of statistics.", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "The type of segmentation." }, "name": { "type": "string", "description": "The name of the specific segmentation." }, "metrics": { "$ref": "#/definitions/advanced_stats_opens" } } } } } } }, "examples": { "application/json": [ { "date": "2014-10-01", "stats": [ { "metrics": { "opens": 1, "unique_opens": 1 }, "name": "Gmail", "type": "client" } ] }, { "date": "2014-10-02", "stats": [ { "metrics": { "opens": 0, "unique_opens": 0 }, "name": "Gmail", "type": "client" } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/mailbox_providers/stats": { "get": { "operationId": "GET_mailbox_providers-stats", "summary": "Retrieve email statistics by mailbox provider.", "tags": [ "Stats" ], "description": "**This endpoint allows you to retrieve your email statistics segmented by recipient mailbox provider.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).", "parameters": [ { "name": "mailbox_providers", "in": "query", "description": "The mail box providers to get statistics for. You can include up to 10 by including this parameter multiple times.", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:limit" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:offset" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:aggregated_by" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:start_date" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:end_date" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date that the statistics were gathered." }, "stats": { "type": "array", "description": "The list of statistics.", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "The type of segmentation." }, "name": { "type": "string", "description": "The name of the specific segmentation." }, "metrics": { "$ref": "#/definitions/advanced_stats_mailbox_provider" } } } } } } }, "examples": { "application/json": [ { "date": "2015-10-11", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-12", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-13", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-14", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-15", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-16", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-17", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-18", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-19", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-20", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-21", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 1, "drops": 0, "opens": 1, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 1 } } ] }, { "date": "2015-10-22", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-23", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-24", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-25", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-26", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 2, "drops": 0, "opens": 2, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 2 } } ] }, { "date": "2015-10-27", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-28", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-29", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-30", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-10-31", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-01", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-02", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-03", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-04", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-05", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-06", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-07", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-08", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-09", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] }, { "date": "2015-11-10", "stats": [ { "type": "mailbox_provider", "name": "Gmail", "metrics": { "blocks": 0, "bounces": 0, "clicks": 0, "deferred": 0, "delivered": 0, "drops": 0, "opens": 0, "processed": 0, "requests": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0 } } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/browsers/stats": { "get": { "operationId": "GET_browsers-stats", "summary": "Retrieve email statistics by browser.", "tags": [ "Stats" ], "description": "**This endpoint allows you to retrieve your email statistics segmented by browser type.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).", "parameters": [ { "name": "browsers", "in": "query", "description": "The browsers to get statistics for. You can include up to 10 different browsers by including this parameter multiple times.", "type": "string" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:limit" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:offset" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:aggregated_by" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:start_date" }, { "$ref": "#/parameters/trait:statsAdvancedQueryStringsLimitOffset:end_date" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date that the statistics were gathered." }, "stats": { "type": "array", "description": "The list of statistics.", "items": { "type": "object", "properties": { "type": { "type": "string", "description": "The type of segmentation." }, "name": { "type": "string", "description": "The name of the specific segmentation." }, "metrics": { "$ref": "#/definitions/advanced_stats_clicks" } } } } } } }, "examples": { "application/json": [ { "date": "2014-10-01", "stats": [ { "metrics": { "clicks": 0, "unique_clicks": 0 }, "name": "Chrome", "type": "browser" }, { "metrics": { "clicks": 1, "unique_clicks": 1 }, "name": "Firefox", "type": "browser" } ] }, { "date": "2014-10-02", "stats": [ { "metrics": { "clicks": 0, "unique_clicks": 0 }, "name": "Chrome", "type": "browser" }, { "metrics": { "clicks": 1, "unique_clicks": 1 }, "name": "Firefox", "type": "browser" } ] } ] } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/bounces": { "get": { "operationId": "GET_suppression-bounces", "summary": "Retrieve all bounces", "tags": [ "Bounces API" ], "description": "**This endpoint allows you to retrieve all of your bounces.**", "parameters": [ { "name": "start_time", "in": "query", "description": "Refers start of the time range in unix timestamp when a bounce was created (inclusive).", "type": "integer" }, { "name": "end_time", "in": "query", "description": "Refers end of the time range in unix timestamp when a bounce was created (inclusive).", "type": "integer" }, { "name": "Accept", "in": "header", "required": true, "type": "string", "default": "application/json" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/bounce_response" } }, "examples": { "application/json": [ { "created": 1250337600, "email": "example@example.com", "reason": "550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/answer/6596 o186si2389584ioe.63 - gsmtp ", "status": "5.1.1" }, { "created": 1250337600, "email": "example@example.com", "reason": "550 5.1.1 : Recipient address rejected: User unknown in virtual alias table ", "status": "5.1.1" } ] } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_suppression-bounces", "summary": "Delete bounces", "tags": [ "Bounces API" ], "description": "**This endpoint allows you to delete all emails on your bounces list.**\n\nThere are two options for deleting bounced emails: \n\n1. You can delete all bounced emails by setting `delete_all` to `true` in the request body. \n2. You can delete a selection of bounced emails by specifying the email addresses in the `emails` array of the request body.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "delete_all": { "type": "boolean", "description": "This parameter allows you to delete **every** email in your bounce list. This should not be used with the emails parameter." }, "emails": { "type": "array", "description": "Delete multiple emails from your bounce list at the same time. This should not be used with the delete_all parameter.", "items": { "type": "string" } } }, "example": { "delete_all": false, "emails": [ "example@example.com", "example2@example.com" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "null" } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/bounces/{email}": { "parameters": [ { "name": "email", "in": "path", "required": true, "type": "string" } ], "get": { "operationId": "GET_suppression-bounces-email", "summary": "Retrieve a Bounce", "tags": [ "Bounces API" ], "description": "**This endpoint allows you to retrieve a specific bounce by email address.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/bounce_response" } }, "examples": { "application/json": [ { "created": 1443651125, "email": "bounce1@test.com", "reason": "550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/answer/6596 o186si2389584ioe.63 - gsmtp ", "status": "5.1.1" } ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_suppression-bounces-email", "summary": "Delete a bounce", "tags": [ "Bounces API" ], "description": "**This endpoint allows you to remove an email address from your bounce list.**", "parameters": [ { "name": "email_address", "in": "query", "description": "The email address you would like to remove from the bounce list.", "required": true, "type": "string", "format": "email" }, { "name": "body", "in": "body", "schema": { "type": "null" } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } }, "401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" }, "examples": { "application/json": { "errors": [ { "field": null, "message": "authorization required" } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/blocks": { "get": { "operationId": "GET_suppression-blocks", "summary": "Retrieve all blocks", "tags": [ "Blocks API" ], "description": "**This endpoint allows you to retrieve all email addresses that are currently on your blocks list.**", "parameters": [ { "name": "start_time", "in": "query", "description": "The start of the time range when a blocked email was created (inclusive). This is a unix timestamp.", "type": "integer" }, { "name": "end_time", "in": "query", "description": "The end of the time range when a blocked email was created (inclusive). This is a unix timestamp.", "type": "integer" }, { "name": "limit", "in": "query", "description": "Limit the number of results to be displayed per page.", "type": "integer" }, { "name": "offset", "in": "query", "description": "The point in the list to begin displaying results.", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/blocks-response" }, "examples": { "application/json": [ { "created": 1443651154, "email": "example@example.com", "reason": "error dialing remote address: dial tcp 10.57.152.165:25: no route to host", "status": "4.0.0" }, { "created": 1443651155, "email": "example1@example.com", "reason": "unable to resolve MX record for example.com: servfail", "status": "4.0.0" } ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_suppression-blocks", "summary": "Delete blocks", "tags": [ "Blocks API" ], "description": "**This endpoint allows you to delete all email addresses on your blocks list.**\n\nThere are two options for deleting blocked emails: \n\n1. You can delete all blocked emails by setting `delete_all` to `true` in the request body. \n2. You can delete a selection of blocked emails by specifying the email addresses in the `emails` array of the request body.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "delete_all": { "type": "boolean", "description": "Indicates if you want to delete all blocked email addresses." }, "emails": { "type": "array", "description": "The specific blocked email addresses that you want to delete.", "items": { "type": "string" } } }, "example": { "delete_all": false, "emails": [ "example1@example.com", "example2@example.com" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/blocks/{email}": { "parameters": [ { "name": "email", "in": "path", "description": "The email address of the specific block.", "required": true, "type": "string", "format": "email" } ], "get": { "operationId": "GET_suppression-blocks-email", "summary": "Retrieve a specific block", "tags": [ "Blocks API" ], "description": "**This endpoint allows you to retrieve a specific email address from your blocks list.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/blocks-response" }, "examples": { "application/json": [ { "created": 1443651154, "email": "example@example.com", "reason": "error dialing remote address: dial tcp 10.57.152.165:25: no route to host", "status": "4.0.0" } ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_suppression-blocks-email", "summary": "Delete a specific block", "tags": [ "Blocks API" ], "description": "**This endpoint allows you to delete a specific email address from your blocks list.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/spam_reports": { "get": { "operationId": "GET_suppression-spam_reports", "summary": "Retrieve all spam reports", "tags": [ "Spam Reports API" ], "description": "**This endpoint allows you to retrieve all spam reports.**", "parameters": [ { "name": "start_time", "in": "query", "description": "The start of the time range when a spam report was created (inclusive). This is a unix timestamp.", "type": "integer" }, { "name": "end_time", "in": "query", "description": "The end of the time range when a spam report was created (inclusive). This is a unix timestamp.", "type": "integer" }, { "name": "limit", "in": "query", "description": "Limit the number of results to be displayed per page.", "type": "integer" }, { "name": "offset", "in": "query", "description": "Paging offset. The point in the list to begin displaying results.", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/spam-reports-response" }, "examples": { "application/json": [ { "created": 1443651141, "email": "user1@example.com", "ip": "10.63.202.100" }, { "created": 1443651154, "email": "user2@example.com", "ip": "10.63.202.100" } ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_suppression-spam_reports", "summary": "Delete spam reports", "tags": [ "Spam Reports API" ], "description": "**This endpoint allows you to delete your spam reports.**\n\nDeleting a spam report will remove the suppression, meaning email will once again be sent to the previously suppressed address. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.\n\nThere are two options for deleting spam reports: \n\n1. You can delete all spam reports by setting the `delete_all` field to `true` in the request body.\n2. You can delete a list of select spam reports by specifying the email addresses in the `emails` array of the request body.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "delete_all": { "type": "boolean", "description": "Indicates if you want to delete all email addresses on the spam report list." }, "emails": { "type": "array", "description": "A list of specific email addresses that you want to remove from the spam report list.", "items": { "type": "string" } } }, "example": { "delete_all": false, "emails": [ "example1@example.com", "example2@example.com" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/spam_reports/{email}": { "parameters": [ { "name": "email", "in": "path", "description": "The email address of a specific spam report that you want to retrieve.", "required": true, "type": "string", "format": "email" } ], "get": { "operationId": "GET_suppression-spam_reports-email", "summary": "Retrieve a specific spam report", "tags": [ "Spam Reports API" ], "description": "**This endpoint allows you to retrieve a specific spam report by email address.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/spam-reports-response" }, "examples": { "application/json": [ { "created": 1454433146, "email": "test1@example.com", "ip": "10.89.32.5" } ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_suppression-spam_reports-email", "summary": "Delete a specific spam report", "tags": [ "Spam Reports API" ], "description": "**This endpoint allows you to delete a specific spam report by email address.**\n\nDeleting a spam report will remove the suppression, meaning email will once again be sent to the previously suppressed address. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] } }, "/asm/suppressions/global": { "post": { "operationId": "POST_asm-suppressions-global", "summary": "Add recipient addresses to the global suppression group.", "tags": [ "Suppressions - Global Suppressions" ], "description": "**This endpoint allows you to add one or more email addresses to the global suppressions group.**", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/suppressions-request", "example": { "recipient_emails": [ "test1@example.com", "test2@example.com" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "recipient_emails": { "type": "array", "description": "The email addresses that are globally suppressed", "items": { "type": "string", "format": "email" } } }, "required": [ "recipient_emails" ] }, "examples": { "application/json": { "recipient_emails": [ "test1@example.com", "test2@example.com" ] } } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/unsubscribes": { "get": { "operationId": "GET_suppression-unsubscribes", "summary": "Retrieve all global suppressions", "tags": [ "Suppressions - Global Suppressions" ], "description": "**This endpoint allows you to retrieve a list of all email address that are globally suppressed.**", "parameters": [ { "name": "start_time", "in": "query", "description": "Refers start of the time range in unix timestamp when an unsubscribe email was created (inclusive).", "type": "integer" }, { "name": "end_time", "in": "query", "description": "Refers end of the time range in unix timestamp when an unsubscribe email was created (inclusive).", "type": "integer" }, { "name": "limit", "in": "query", "description": "The number of results to display on each page.", "type": "integer" }, { "name": "offset", "in": "query", "description": "The point in the list of results to begin displaying global suppressions.", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "created": { "type": "integer", "description": "A Unix timestamp indicating when the recipient was added to the global suppression list." }, "email": { "type": "string", "description": "The email address of the recipient who is globally suppressed.", "format": "email" } }, "required": [ "created", "email" ] } }, "examples": { "application/json": [ { "created": 1443651141, "email": "user1@example.com" }, { "created": 1443651154, "email": "user2@example.com" } ] } } }, "security": [ { "Authorization": [] } ] } }, "/asm/suppressions/global/{email}": { "parameters": [ { "name": "email", "in": "path", "description": "The email address of the global suppression you want to retrieve. Or, if you want to check if an email address is on the global suppressions list, enter that email address here.", "required": true, "type": "string" } ], "get": { "operationId": "GET_asm-suppressions-global-email", "summary": "Retrieve a Global Suppression", "tags": [ "Suppressions - Global Suppressions" ], "description": "**This endpoint allows you to retrieve a global suppression. You can also use this endpoint to confirm if an email address is already globally suppresed.**\n\nIf the email address you include in the URL path parameter `{email}` is already globally suppressed, the response will include that email address. If the address you enter for `{email}` is not globally suppressed, an empty JSON object `{}` will be returned.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "title": "Retrieve a Global Suppression response", "type": "object", "properties": { "recipient_email": { "type": "string", "description": "The email address that is globally suppressed. This will be an empty object if the email address you included in your call is not globally suppressed.", "format": "email" } }, "required": [ "recipient_email" ] }, "examples": { "application/json": { "recipient_email": "test@example.com" } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_asm-suppressions-global-email", "summary": "Delete a Global Suppression", "tags": [ "Suppressions - Global Suppressions" ], "description": "**This endpoint allows you to remove an email address from the global suppressions group.**\n\nDeleting a suppression group will remove the suppression, meaning email will once again be sent to the previously suppressed addresses. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/asm/groups": { "post": { "operationId": "POST_asm-groups", "summary": "Create a new suppression group", "tags": [ "Suppressions - Unsubscribe Groups" ], "description": "**This endpoint allows you to create a new suppression group.**\n\nTo add an email address to the suppression group, [create a Suppression](https://sendgrid.api-docs.io/v3.0/suppressions-suppressions/add-suppressions-to-a-suppression-group).", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/suppression-group-request-base", "example": { "name": "Product Suggestions", "description": "Suggestions for products our users might like.", "is_default": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the suppression group." }, "name": { "type": "string", "description": "The name of the suppression group." }, "description": { "type": "string", "description": "A brief description of the suppression group." }, "is_default": { "type": "boolean", "description": "Indicates if this is the default suppression group." } }, "required": [ "id", "name", "description", "is_default" ] }, "examples": { "application/json": { "id": 103, "name": "Product Suggestions", "description": "Suggestions for products our users might like.", "is_default": false } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_asm-groups", "summary": "Retrieve all suppression groups associated with the user.", "tags": [ "Suppressions - Unsubscribe Groups" ], "description": "**This endpoint allows you to retrieve a list of all suppression groups created by this user.**\n\nThis endpoint can also return information for multiple group IDs that you include in your request. To add a group ID to your request, simply append `?id=123456&id=123456`, with the appropriate group IDs.", "parameters": [ { "name": "id", "in": "query", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/suppression_group" } }, "examples": { "application/json": [ { "id": 1234, "name": "Unsubscribe Group", "description": "An Unsubscribe Group", "last_email_sent_at": null, "is_default": true, "unsubscribes": 1234 }, { "id": 1234, "name": "Unsubscribe Group", "description": "An Unsubscribe Group", "last_email_sent_at": null, "is_default": true, "unsubscribes": 1234 } ] } } }, "security": [ { "Authorization": [] } ] } }, "/asm/groups/{group_id}": { "parameters": [ { "name": "group_id", "in": "path", "description": "The ID of the suppression group you would like to retrieve.", "required": true, "type": "string" } ], "get": { "operationId": "GET_asm-groups-group_id", "summary": "Get information on a single suppression group.", "tags": [ "Suppressions - Unsubscribe Groups" ], "description": "**This endpoint allows you to retrieve a single suppression group.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "allOf": [ { "$ref": "#/definitions/suppression-group-request-base" }, { "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the suppression group." }, "unsubscribes": { "type": "integer", "description": "The number of unsubscribes, or suppressions, in this group." }, "last_email_sent_at": { "type": [ "string", "null" ] } }, "required": [ "id" ] } ] }, "examples": { "application/json": { "description": "Our monthly newsletter.", "id": 100, "is_default": true, "last_email_sent_at": null, "name": "Newsletters", "unsubscribes": 400 } } } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_asm-groups-group_id", "summary": "Update a suppression group.", "tags": [ "Suppressions - Unsubscribe Groups" ], "description": "**This endpoint allows you to update or change a suppression group.**", "parameters": [ { "name": "body", "in": "body", "schema": { "allOf": [ { "$ref": "#/definitions/suppression-group-request-base" } ], "example": { "id": 103, "name": "Item Suggestions", "description": "Suggestions for items our users might like." } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "$ref": "#/definitions/suppression_group" }, "examples": { "application/json": { "id": 103, "name": "Item Suggestions", "description": "Suggestions for items our users might like." } } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_asm-groups-group_id", "summary": "Delete a Suppression Group", "tags": [ "Suppressions - Unsubscribe Groups" ], "description": "**This endpoint allows you to delete a suppression group.**\n\nIf a recipient uses the \"one-click unsubscribe\" option on an email associated with a deleted group, that recipient will be added to the global suppression list.\n\nDeleting a suppression group will remove the suppression, meaning email will once again be sent to the previously suppressed addresses. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } } }, "security": [ { "Authorization": [] } ] } }, "/asm/groups/{group_id}/suppressions": { "parameters": [ { "name": "group_id", "in": "path", "description": "The id of the unsubscribe group that you are adding suppressions to.", "required": true, "type": "string" } ], "post": { "operationId": "POST_asm-groups-group_id-suppressions", "summary": "Add suppressions to a suppression group", "tags": [ "Suppressions - Suppressions" ], "description": "**This endpoint allows you to add email addresses to an unsubscribe group.**\n\nIf you attempt to add suppressions to a group that has been deleted or does not exist, the suppressions will be added to the global suppressions list.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/suppressions-request", "example": { "recipient_emails": [ "test1@example.com", "test2@example.com" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "201": { "description": "", "schema": { "type": "object", "properties": { "recipient_emails": { "type": "array", "description": "The email addresses you added to the unsubscribe group", "items": { "type": "string", "format": "email" } } } }, "examples": { "application/json": { "recipient_emails": [ "test1@example.com", "test2@example.com" ] } } } }, "security": [ { "Authorization": [] } ] }, "get": { "operationId": "GET_asm-groups-group_id-suppressions", "summary": "Retrieve all suppressions for a suppression group", "tags": [ "Suppressions - Suppressions" ], "description": "**This endpoint allows you to retrieve all suppressed email addresses belonging to the given group.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "description": "The list of email addresses belonging to the given suppression group.", "items": { "type": "string", "format": "email" } }, "examples": { "application/json": [ "example@example.com", "example2@example.com" ] } } }, "security": [ { "Authorization": [] } ] } }, "/asm/groups/{group_id}/suppressions/search": { "parameters": [ { "name": "group_id", "in": "path", "description": "The ID of the suppression group that you would like to search.", "required": true, "type": "string" } ], "post": { "operationId": "POST_asm-groups-group_id-suppressions-search", "summary": "Search for suppressions within a group", "tags": [ "Suppressions - Suppressions" ], "description": "**This endpoint allows you to search a suppression group for multiple suppressions.**\n\nWhen given a list of email addresses and a group ID, this endpoint will only return the email addresses that have been unsubscribed from the given group.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/suppressions-request", "example": { "recipient_emails": [ "exists1@example.com", "exists2@example.com", "doesnotexists@example.com" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "description": "The email address from your search that do exist in the suppression group.", "items": { "type": "string", "format": "email" } }, "examples": { "application/json": [ "exists1@example.com", "exists2@example.com" ] } } }, "security": [ { "Authorization": [] } ] } }, "/asm/suppressions": { "get": { "operationId": "GET_asm-suppressions", "summary": "Retrieve all suppressions", "tags": [ "Suppressions - Suppressions" ], "description": "**This endpoint allows you to retrieve a list of all suppressions.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "items": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address that was suppressed." }, "group_id": { "type": "integer", "description": "The id of the suppression group that this email address belongs to." }, "group_name": { "type": "string", "description": "The name of the suppression group that this email address belongs to." }, "created_at": { "type": "integer", "description": "A UNIX timestamp indicating when the suppression was created." } }, "required": [ "email", "group_id", "group_name", "created_at" ] } }, "examples": { "application/json": [ { "email": "test1@example.com", "group_id": 1, "group_name": "Weekly News", "created_at": 1410986704 }, { "email": "test1@example.com", "group_id": 2, "group_name": "Daily News", "created_at": 1411493671 }, { "email": "test2@example.com", "group_id": 2, "group_name": "Daily News", "created_at": 1411493671 } ] } } }, "security": [ { "Authorization": [] } ] } }, "/asm/suppressions/{email}": { "parameters": [ { "name": "email", "in": "path", "description": "The email address that you want to search suppression groups for.", "required": true, "type": "string" } ], "get": { "operationId": "GET_asm-suppressions-email", "summary": "Retrieve all suppression groups for an email address", "tags": [ "Suppressions - Suppressions" ], "description": "**This endpoint returns a list of all groups from which the given email address has been unsubscribed.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "object", "properties": { "suppressions": { "type": "array", "description": "The array of suppression groups.", "items": { "type": "object", "properties": { "description": { "type": "string", "description": "The description of the suppression group." }, "id": { "type": "integer", "description": "The id of the suppression group." }, "is_default": { "type": "boolean", "description": "Indicates if the suppression group is set as the default." }, "name": { "type": "string", "description": "The name of the suppression group." }, "suppressed": { "type": "boolean", "description": "Indicates if the given email address is suppressed for this group." } }, "required": [ "description", "id", "is_default", "name", "suppressed" ] } } }, "required": [ "suppressions" ] }, "examples": { "application/json": { "suppressions": [ { "description": "Optional description.", "id": 1, "is_default": true, "name": "Weekly News", "suppressed": true }, { "description": "Some daily news.", "id": 2, "is_default": true, "name": "Daily News", "suppressed": true }, { "description": "An old group.", "id": 2, "is_default": false, "name": "Old News", "suppressed": false } ] } } } }, "security": [ { "Authorization": [] } ] } }, "/asm/groups/{group_id}/suppressions/{email}": { "parameters": [ { "name": "group_id", "in": "path", "description": "The id of the suppression group that you are removing an email address from.", "required": true, "type": "string" }, { "name": "email", "in": "path", "description": "The email address that you want to remove from the suppression group.", "required": true, "type": "string" } ], "delete": { "operationId": "DELETE_asm-groups-group_id-suppressions-email", "summary": "Delete a suppression from a suppression group", "tags": [ "Suppressions - Suppressions" ], "description": "**This endpoint allows you to remove a suppressed email address from the given suppression group.**\n\nRemoving an address will remove the suppression, meaning email will once again be sent to the previously suppressed addresses. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "null" } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/invalid_emails": { "get": { "operationId": "GET_suppression-invalid_emails", "summary": "Retrieve all invalid emails", "tags": [ "Invalid Emails API" ], "description": "**This endpoint allows you to retrieve a list of all invalid email addresses.**", "parameters": [ { "name": "start_time", "in": "query", "description": "Refers start of the time range in unix timestamp when an invalid email was created (inclusive).", "type": "integer" }, { "name": "end_time", "in": "query", "description": "Refers end of the time range in unix timestamp when an invalid email was created (inclusive).", "type": "integer" }, { "name": "limit", "in": "query", "description": "Limit the number of results to be displayed per page.", "type": "integer" }, { "name": "offset", "in": "query", "description": "Paging offset. The point in the list to begin displaying results.", "type": "integer" }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "description": "The list of invalid email addresses.", "items": { "$ref": "#/definitions/invalid-email" } }, "examples": { "application/json": [ { "created": 1449953655, "email": "user1@example.com", "reason": "Mail domain mentioned in email address is unknown" }, { "created": 1449939373, "email": "user2@example.com", "reason": "Mail domain mentioned in email address is unknown" } ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_suppression-invalid_emails", "summary": "Delete invalid emails", "tags": [ "Invalid Emails API" ], "description": "**This endpoint allows you to remove email addresses from your invalid email address list.**\n\nThere are two options for deleting invalid email addresses: \n\n1) You can delete all invalid email addresses by setting `delete_all` to true in the request body.\n2) You can delete some invalid email addresses by specifying certain addresses in an array in the request body.", "parameters": [ { "name": "body", "in": "body", "schema": { "type": "object", "properties": { "delete_all": { "type": "boolean", "description": "Indicates if you want to remove all email address from the invalid emails list." }, "emails": { "type": "array", "description": "The list of specific email addresses that you want to remove.", "items": { "type": "string", "format": "email" } } }, "example": { "delete_all": false, "emails": [ "example1@example.com", "example2@example.com" ] } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] } }, "/suppression/invalid_emails/{email}": { "parameters": [ { "name": "email", "in": "path", "description": "The specific email address of the invalid email entry that you want to retrieve.", "required": true, "type": "string" } ], "get": { "operationId": "GET_suppression-invalid_emails-email", "summary": "Retrieve a specific invalid email", "tags": [ "Invalid Emails API" ], "description": "**This endpoint allows you to retrieve a specific invalid email addresses.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "type": "array", "description": "A specific invalid email.", "minItems": 0, "maxItems": 1, "items": { "$ref": "#/definitions/invalid-email" } }, "examples": { "application/json": [ { "created": 1454433146, "email": "test1@example.com", "reason": "Mail domain mentioned in email address is unknown" } ] } } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_suppression-invalid_emails-email", "summary": "Delete a specific invalid email", "tags": [ "Invalid Emails API" ], "description": "**This endpoint allows you to remove a specific email address from the invalid email address list.**", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object", "properties": {} } } }, "security": [ { "Authorization": [] } ] } }, "/user/webhooks/parse/settings/{hostname}": { "parameters": [ { "name": "hostname", "in": "path", "description": "The hostname associated with the inbound parse setting that you would like to retrieve.", "required": true, "type": "string" } ], "get": { "operationId": "GET_user-webhooks-parse-settings-hostname", "summary": "Retrieve a specific parse setting", "tags": [ "Settings - Inbound Parse" ], "description": "**This endpoint allows you to retrieve a specific inbound parse setting by hostname.**\n\nYou can retrieve all your Inbound Parse settings and their associated host names with the \"Retrieve all parse settings\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/parse-setting" }, "examples": { "application/json": { "url": "http://mydomain.com/parse", "hostname": "mail.mydomain.com", "spam_check": true, "send_raw": true } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "patch": { "operationId": "PATCH_user-webhooks-parse-settings-hostname", "summary": "Update a parse setting", "tags": [ "Settings - Inbound Parse" ], "description": "**This endpoint allows you to update a specific inbound parse setting by hostname.**\n\nYou can retrieve all your Inbound Parse settings and their associated host names with the \"Retrieve all parse settings\" endpoint.", "parameters": [ { "name": "body", "in": "body", "schema": { "$ref": "#/definitions/parse-setting", "example": { "url": "http://newdomain.com/parse", "spam_check": false, "send_raw": true } } }, { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/parse-setting" }, "examples": { "application/json": { "url": "http://mydomain.com/parse", "hostname": "mail.mydomain.com", "spam_check": true, "send_raw": true } } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] }, "delete": { "operationId": "DELETE_user-webhooks-parse-settings-hostname", "summary": "Delete a parse setting", "tags": [ "Settings - Inbound Parse" ], "description": "**This endpoint allows you to delete a specific inbound parse setting by hostname.**\n\nYou can retrieve all your Inbound Parse settings and their associated host names with the \"Retrieve all parse settings\" endpoint.", "parameters": [ { "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" } ], "responses": { "204": { "description": "", "schema": { "type": "object" } }, "401": { "$ref": "#/responses/trait:globalErrors:401" }, "403": { "$ref": "#/responses/trait:globalErrors:403" }, "404": { "$ref": "#/responses/trait:globalErrors:404" }, "500": { "$ref": "#/responses/trait:globalErrors:500" } }, "security": [ { "Authorization": [] } ] } } }, "parameters": { "trait:onBehalfOfSubuser:on-behalf-of": { "name": "on-behalf-of", "in": "header", "type": "string", "default": "The subuser's username. This header generates the API call as if the subuser account was making the call." }, "trait:baseParams:aggregated_by": { "name": "aggregated_by", "in": "query", "description": "Dictates how the stats are time-sliced. Currently, `\"total\"` and `\"day\"` are supported.", "type": "string", "default": "total", "enum": [ "day", "total" ] }, "trait:baseParams:start_date": { "name": "start_date", "in": "query", "description": "Format: `YYYY-MM-DD`. If this parameter is included, the stats' start date is included in the search.", "type": "string", "format": "date", "default": "" }, "trait:baseParams:end_date": { "name": "end_date", "in": "query", "description": "Format: `YYYY-MM-DD`.If this parameter is included, the stats' end date is included in the search.", "type": "string", "default": "", "format": "date" }, "trait:baseParams:timezone": { "name": "timezone", "in": "query", "description": "[IANA Area/Region](https://en.wikipedia.org/wiki/Tz_database#Names_of_time_zones) string representing the timezone in which the stats are to be presented, e.g., \"America/Chicago\".", "type": "string", "default": "UTC" }, "trait:pagination:page_size": { "name": "page_size", "in": "query", "description": "The number of elements you want returned on each page.", "type": "integer", "default": 50, "minimum": 1, "maximum": 100 }, "trait:pagination:page_token": { "name": "page_token", "in": "query", "description": "The stats endpoints are paginated. To get the next page, call the passed `_metadata.next` URL. If `_metadata.prev` doesn't exist, you're at the first page. Similarly, if `_metadata.next` is not present, you're at the last page.", "type": "string" }, "trait:singlesendQueryParams:group_by": { "name": "group_by", "in": "query", "description": "A/B Single Sends have multiple variation IDs and phase IDs. Including these additional fields allows further granularity of stats by these fields.", "type": "array", "items": { "type": "string", "enum": [ "ab_variation", "ab_phase" ] } }, "trait:automationQueryParams:group_by": { "name": "group_by", "in": "query", "description": "Automations can have multiple steps. Including `step_id` as a `group_by` metric allows further granularity of stats.", "type": "array", "items": { "type": "string", "enum": [ "step_id" ] } }, "trait:automationQueryParams:step_ids": { "name": "step_ids", "in": "query", "description": "Comma-separated list of `step_ids` that you want the link stats for.", "type": "array", "uniqueItems": true, "items": { "type": "string", "format": "uuid" } }, "trait:singlesendQueryParams2:group_by": { "name": "group_by", "in": "query", "description": "A/B Single Sends have multiple variation IDs and phase IDs. Including these additional fields allows further granularity of stats by these fields.", "type": "array", "items": { "type": "string", "enum": [ "ab_variation", "ab_phase" ] } }, "trait:singlesendQueryParams2:ab_variation_id": { "name": "ab_variation_id", "in": "query", "type": "string", "format": "uuid" }, "trait:singlesendQueryParams2:ab_phase_id": { "name": "ab_phase_id", "in": "query", "type": "string", "enum": [ "test", "send" ] }, "trait:statsAdvancedStatsBaseQueryStrings:start_date": { "name": "start_date", "in": "query", "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", "required": true, "type": "string" }, "trait:statsAdvancedStatsBaseQueryStrings:end_date": { "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, "type": "string" }, "trait:statsAdvancedStatsBaseQueryStrings:aggregated_by": { "name": "aggregated_by", "in": "query", "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", "required": false, "type": "string", "enum": [ "day", "week", "month" ] }, "trait:statsAdvancedQueryStringsLimitOffset:limit": { "name": "limit", "in": "query", "description": "The number of results to return.", "required": false, "type": "integer" }, "trait:statsAdvancedQueryStringsLimitOffset:offset": { "name": "offset", "in": "query", "description": "The point in the list to begin retrieving results.", "required": false, "type": "integer" }, "trait:statsAdvancedQueryStringsLimitOffset:aggregated_by": { "name": "aggregated_by", "in": "query", "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", "required": false, "type": "string", "enum": [ "day", "week", "month" ] }, "trait:statsAdvancedQueryStringsLimitOffset:start_date": { "name": "start_date", "in": "query", "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", "required": true, "type": "string" }, "trait:statsAdvancedQueryStringsLimitOffset:end_date": { "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, "type": "string" }, "trait:designsQueryStrings:page_size": { "name": "page_size", "in": "query", "description": "number of results to return", "type": "integer", "minimum": 0, "default": 100 }, "trait:designsQueryStrings:page_token": { "name": "page_token", "in": "query", "description": "token corresponding to a specific page of results, as provided by metadata", "type": "string" }, "trait:designsQueryStrings:summary": { "name": "summary", "in": "query", "description": "set to false to return all fields", "type": "boolean", "default": true }, "trait:authorizationHeader:Authorization": { "name": "Authorization", "in": "header", "required": true, "type": "string", "default": "Bearer <>" } }, "responses": { "trait:errorResponse:400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:pagination:200": { "description": "", "schema": { "type": "object", "properties": { "_metadata": { "$ref": "#/definitions/metadata" } } } }, "trait:mailSendErrors:400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:mailSendErrors:413": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:globalErrors:401": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:globalErrors:403": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:globalErrors:404": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:globalErrors:500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" } } } } } } }, "trait:cancelScheduledSendsErrors:400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" }, "help": { "type": "object" } } } }, "id": { "type": "string" } } } }, "trait:apiKeysErrors:400": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:apiKeysErrors:403": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:apiKeysErrors:404": { "description": "", "schema": { "$ref": "#/definitions/global_error_response_schema" } }, "trait:makoErrorResponse:400": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "error_id": { "type": "string", "description": "The ID associated with the error." }, "field": { "type": [ "string", "null" ], "description": "The field that generated the error." }, "message": { "type": "string", "description": "The error message." }, "parameter": { "type": "string" } }, "required": [ "message" ] } } } } }, "trait:makoErrorResponse:401": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "error_id": { "type": "string", "description": "The ID associated with the error." }, "field": { "type": [ "string", "null" ], "description": "The field that generated the error." }, "message": { "type": "string", "description": "The error message." }, "parameter": { "type": "string" } }, "required": [ "message" ] } } } } }, "trait:makoErrorResponse:403": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "error_id": { "type": "string", "description": "The ID associated with the error." }, "field": { "type": [ "string", "null" ], "description": "The field that generated the error." }, "message": { "type": "string", "description": "The error message." }, "parameter": { "type": "string" } }, "required": [ "message" ] } } } } }, "trait:makoErrorResponse:404": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "error_id": { "type": "string", "description": "The ID associated with the error." }, "field": { "type": [ "string", "null" ], "description": "The field that generated the error." }, "message": { "type": "string", "description": "The error message." }, "parameter": { "type": "string" } }, "required": [ "message" ] } } } } }, "trait:makoErrorResponse:500": { "description": "", "schema": { "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "error_id": { "type": "string", "description": "The ID associated with the error." }, "field": { "type": [ "string", "null" ], "description": "The field that generated the error." }, "message": { "type": "string", "description": "The error message." }, "parameter": { "type": "string" } }, "required": [ "message" ] } } } } }, "trait:singleSignOnErrorsTrait:400": { "description": "", "schema": { "$ref": "#/definitions/sso-error-response" } }, "trait:singleSignOnErrorsTrait:401": { "description": "", "schema": { "$ref": "#/definitions/sso-error-response" } }, "trait:singleSignOnErrorsTrait:403": { "description": "", "schema": { "$ref": "#/definitions/sso-error-response" } }, "trait:singleSignOnErrorsTrait:429": { "description": "", "schema": { "$ref": "#/definitions/sso-error-response" } }, "trait:singleSignOnErrorsTrait:500": { "description": "", "schema": { "$ref": "#/definitions/sso-error-response" } }, "trait:errors:400": { "description": "", "schema": { "$ref": "#/definitions/errors-seg-v2" } }, "trait:errors:404": { "description": "" }, "trait:errors:500": { "description": "" } }, "definitions": { "partner_settings_new_relic": { "title": "Partner Settings: New Relic", "type": "object", "properties": { "enable_subuser_statistics": { "type": "boolean", "description": "Indicates if your subuser statistics will be sent to your New Relic Dashboard." }, "enabled": { "type": "boolean", "description": "Indicates if this setting is enabled. " }, "license_key": { "type": "string", "description": "The license key provided with your New Relic account." } }, "required": [ "enabled", "license_key" ] }, "subscription_tracking_settings": { "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’s server." }, "plain_content": { "type": "string", "description": "The information in plain text for your unsubscribe link. You should have the “<% %>” 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" } } }, "contactdb_recipient_response": { "title": "ContactDB: Recipient response", "type": "object", "properties": { "error_count": { "type": "number", "default": 0, "description": "The number of errors found while adding recipients." }, "error_indices": { "type": "array", "default": [], "description": "The indices of the recipient(s) sent that caused the error. ", "items": { "type": "number" } }, "new_count": { "type": "number", "default": 0, "description": "The count of new recipients added to the contactdb." }, "persisted_recipients": { "type": "array", "default": [], "description": "The recipient IDs of the recipients that already existed from this request.", "items": { "type": "string" } }, "updated_count": { "type": "number", "default": 0, "description": "The recipients who were updated from this request." }, "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "error_indices": { "type": "array", "items": { "type": "number" } } } } } }, "required": [ "error_count", "new_count", "persisted_recipients", "updated_count" ], "example": { "error_count": 1, "error_indices": [ 2 ], "new_count": 2, "persisted_recipients": [ "YUBh", "bWlsbGVyQG1pbGxlci50ZXN0" ], "updated_count": 0, "errors": [ { "message": "Invalid email.", "error_indices": [ 2 ] } ] } }, "campaign_response": { "title": "Campaigns Response", "allOf": [ { "$ref": "#/definitions/campaign_request" }, { "type": "object", "properties": { "status": { "type": "string", "description": "The status of your campaign." }, "id": { "type": "integer" } }, "required": [ "status" ] } ] }, "contactdb_segments_conditions": { "title": "ContactDB: Segments: Conditions", "type": "object", "properties": { "field": { "type": "string" }, "value": { "type": "string" }, "operator": { "type": "string", "enum": [ "eq", "ne", "lt", "gt", "contains" ] }, "and_or": { "type": "string", "enum": [ "and", "or", "" ] } }, "required": [ "field", "value", "operator" ] }, "bounce_response": { "title": "Bounce Response", "type": "object", "properties": { "created": { "type": "number", "description": "The unix timestamp for when the bounce record was created at SendGrid." }, "email": { "type": "string", "format": "email", "description": "The email address that was added to the bounce list." }, "reason": { "type": "string", "description": "The reason for the bounce. This typically will be a bounce code, an enhanced code, and a description." }, "status": { "type": "string", "description": "Enhanced SMTP bounce response" } }, "example": { "created": 1250337600, "email": "example@example.com", "reason": "550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/answer/6596 o186si2389584ioe.63 - gsmtp ", "status": "5.1.1" } }, "contacts": { "title": "Contacts", "type": "object", "properties": { "address": { "type": "string" }, "address2": { "type": "object" }, "city": { "type": "string" }, "company": { "type": "string" }, "country": { "type": "string" }, "email": { "type": "string" }, "first_name": { "type": "string" }, "last_name": { "type": "string" }, "phone": { "type": "string" }, "state": { "type": "string" }, "zip": { "type": "string" } } }, "reverse_dns": { "title": "Reverse DNS", "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the Reverse DNS." }, "ip": { "type": "string", "description": "The IP address that this Reverse DNS was created for." }, "rdns": { "type": "string", "description": "The reverse DNS record for the IP address. This points to the Reverse DNS subdomain." }, "users": { "type": "array", "description": "The users who are able to send mail from the IP address.", "items": { "type": "object", "properties": { "username": { "type": "string", "description": "The username of a user who can send mail from the IP address." }, "user_id": { "type": "integer", "description": "The ID of a user who can send mail from the IP address." } }, "required": [ "username", "user_id" ] } }, "subdomain": { "type": "string", "description": "The subdomain created for this reverse DNS. This is where the rDNS record points." }, "domain": { "type": "string", "description": "The root, or sending, domain." }, "valid": { "type": "boolean", "description": "Indicates if this is a valid Reverse DNS." }, "legacy": { "type": "boolean", "description": "Indicates if this Reverse DNS was created using the legacy whitelabel tool. If it is a legacy whitelabel, it will still function, but you'll need to create a new Reverse DNS if you need to update it." }, "last_validation_attempt_at": { "type": "integer", "description": "A Unix epoch timestamp representing the last time of a validation attempt." }, "a_record": { "type": "object", "required": [ "valid", "type", "host", "data" ], "properties": { "valid": { "type": "boolean", "description": "Indicates if the a_record is valid." }, "type": { "type": "string", "description": "The type of DNS record." }, "host": { "type": "string", "description": "This is the web address that will be mapped to the IP address." }, "data": { "type": "string", "description": "The IP address being set up with Reverse DNS." } } } }, "required": [ "id", "ip", "rdns", "users", "domain", "valid", "legacy", "a_record" ], "example": { "id": 1, "ip": "192.168.1.1", "rdns": "o1.email.example.com", "users": [ { "username": "john@example.com", "user_id": 7 }, { "username": "jane@example.com", "user_id": 8 } ], "subdomain": "email", "domain": "example.com", "valid": true, "legacy": false, "a_record": { "valid": true, "type": "a", "host": "o1.email.example.com", "data": "192.168.1.1" } } }, "senderID": { "title": "Sender ID", "allOf": [ { "$ref": "#/definitions/sender-id-request" }, { "type": "object", "properties": { "id": { "type": "integer", "description": "The unique identifier of the sender identity." }, "verified": { "type": "boolean", "description": "If the sender identity is verified or not. Only verified sender identities can be used to send email." }, "updated_at": { "type": "integer", "description": "The time the sender identity was last updated." }, "created_at": { "type": "integer", "description": "The time the sender identity was created." }, "locked": { "type": "boolean", "description": "True when the sender id is associated to a campaign in the Draft, Scheduled, or In Progress status. You cannot update or delete a locked sender identity." } } }, { "type": "object", "required": [ "nickname", "address", "city", "country" ] } ], "example": { "id": 1, "nickname": "My Sender ID", "from": { "email": "from@example.com", "name": "Example INC" }, "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "state": "Colorado", "zip": "80202", "country": "United States", "verified": true, "updated_at": 1449872165, "created_at": 1449872165, "locked": false } }, "global:empty_request": { "title": "Global: Request Empty Body", "type": "null" }, "contactdb_custom_field": { "title": "ContactDB Custom field schema.", "type": "object", "properties": { "name": { "type": "string", "description": "The name of the field" }, "type": { "type": "string", "description": "The type of the field.", "enum": [ "date", "text", "number" ] } }, "example": { "name": "first_name", "type": "text" } }, "domain_authentication:domain_spf": { "title": "Domain Authentication", "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the authenticated domain." }, "domain": { "type": "string", "description": "The domain authenticated." }, "subdomain": { "type": "string", "description": "The subdomain that was used to create this authenticated domain." }, "username": { "type": "string", "description": "The username of the account that this authenticated domain is associated with." }, "user_id": { "type": "integer", "description": "The user_id of the account that this authenticated domain is associated with." }, "ips": { "type": "array", "description": "The IP addresses that are included in the SPF record for this authenticated domain.", "items": {} }, "custom_spf": { "type": "boolean", "description": "Indicates if this authenticated domain uses custom SPF." }, "default": { "type": "boolean", "description": "Indicates if this is the default domain." }, "legacy": { "type": "boolean", "description": "Indicates if this authenticated domain was created using the legacy whitelabel tool. If it is a legacy whitelabel, it will still function, but you'll need to create a new authenticated domain if you need to update it." }, "automatic_security": { "type": "boolean", "description": "Indicates if this authenticated domain uses automated security." }, "valid": { "type": "boolean", "description": "Indicates if this is a valid authenticated domain ." }, "dns": { "type": "object", "description": "The DNS records for this authenticated domain.", "required": [ "mail_server", "subdomain_spf", "domain_spf", "dkim" ], "properties": { "mail_server": { "type": "object", "description": "Designates which mail server is responsible for accepting messages from a domain.", "required": [ "host", "type", "data", "valid" ], "properties": { "host": { "type": "string", "description": "The domain sending the messages." }, "type": { "type": "string", "description": "They type of DNS record." }, "data": { "type": "string", "description": "The mail server responsible for accepting messages from the sending domain." }, "valid": { "type": "boolean", "description": "Indicates if this is a valid DNS record." } } }, "subdomain_spf": { "type": "object", "description": "The SPF record for the subdomain used to create this authenticated domain.", "required": [ "host", "type", "data", "valid" ], "properties": { "host": { "type": "string", "description": "The domain that this SPF record will be used to authenticate." }, "type": { "type": "string", "description": "The type of data in the SPF record." }, "data": { "type": "string", "description": "The SPF record." }, "valid": { "type": "boolean", "description": "Indicates if this is a valid SPF record." } } }, "domain_spf": { "type": "object", "description": "The SPF record for the root domain.", "required": [ "host", "type", "data", "valid" ], "properties": { "host": { "type": "string", "description": "The root domain that this SPF record will be used to authenticate." }, "type": { "type": "string", "description": "The type of data in the SPF record." }, "data": { "type": "string", "description": "The SPF record." }, "valid": { "type": "boolean", "description": "Indicates if the SPF record is valid." } } }, "dkim": { "type": "object", "description": "The DKIM record for messages sent using this authenticated domain.", "required": [ "host", "type", "data", "valid" ], "properties": { "host": { "type": "string", "description": "The DNS labels for the DKIM signature." }, "type": { "type": "string", "description": "The type of data in the DKIM record." }, "data": { "type": "string", "description": "The DKIM record." }, "valid": { "type": "boolean", "description": "Indicates if the DKIM record is valid." } } } } } }, "required": [ "id", "domain", "username", "user_id", "ips", "custom_spf", "default", "legacy", "automatic_security", "valid", "dns" ] }, "subuser": { "title": "List all Subusers for a parent response", "type": "object", "properties": { "disabled": { "type": "boolean", "description": "Whether or not the user is enabled or disabled." }, "id": { "type": "number", "description": "The ID of this subuser." }, "username": { "type": "string", "description": "The name by which this subuser will be referred." }, "email": { "type": "string", "description": "The email address to contact this subuser.", "format": "email" } }, "required": [ "disabled", "id", "username", "email" ], "example": { "disabled": false, "email": "example@example.com", "id": 1234, "username": "example_subuser" } }, "mail_settings_address_whitelabel": { "title": "Mail Settings: Address Whitelabel", "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if you have an email address whitelist enabled. " }, "list": { "type": "array", "description": "All email addresses that are currently on the whitelist.", "items": { "type": "string" } } }, "example": { "enabled": true, "list": [ "email1@example.com", "example.com" ] } }, "link_branding_200_response": { "title": "Link Branding 200 Response", "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the branded link." }, "domain": { "type": "string", "description": "The root domain of the branded link." }, "subdomain": { "type": "string", "description": "The subdomain used to generate the DNS records for this link branding. This subdomain must be different from the subdomain used for your authenticated domain." }, "username": { "type": "string", "description": "The username of the account that this link branding is associated with." }, "user_id": { "type": "integer", "description": "The ID of the user that this link branding is associated with." }, "default": { "type": "boolean", "description": "Indicates if this is the default link branding.", "enum": [ true, false ] }, "valid": { "type": "boolean", "description": "Indicates if this link branding is valid.", "enum": [ true, false ] }, "legacy": { "type": "boolean", "description": "Indicates if this link branding was created using the legacy whitelabel tool. If it is a legacy whitelabel, it will still function, but you'll need to create new link branding if you need to update it.", "enum": [ true, false ] }, "dns": { "type": "object", "description": "The DNS records generated for this link branding.", "required": [ "domain_cname" ], "properties": { "domain_cname": { "type": "object", "description": "The DNS record generated to point to your link branding subdomain.", "required": [ "valid", "type", "host", "data" ], "properties": { "valid": { "type": "boolean", "description": "Indicates if the DNS record is valid.", "enum": [ true, false ] }, "type": { "type": "string", "description": "The type of DNS record that was generated.", "enum": [ "cname", "txt", "mx" ] }, "host": { "type": "string", "description": "The domain that this link branding will use for the links in your email." }, "data": { "type": "string", "description": "The domain that the DNS record points to." } } }, "owner_cname": { "type": "object", "description": "The DNS record generated to verify who created the link branding.", "properties": { "valid": { "type": "boolean", "description": "Indicates if the DNS record is valid.", "enum": [ true, false ] }, "type": { "type": "string", "description": "The type of DNS record generated.", "enum": [ "cname", "txt", "mx" ] }, "host": { "type": "string", "description": "Used to verify the link branding. The subdomain of this domain is the ID of the user who created the link branding." }, "data": { "type": "string", "description": "The domain that the DNS record points to." } }, "required": [ "valid", "host", "data" ] } } } }, "required": [ "id", "domain", "username", "user_id", "default", "valid", "legacy", "dns" ] }, "from_email_object": { "title": "From Email Object", "type": "object", "properties": { "email": { "type": "string", "format": "email", "description": "The 'From' email address used to deliver the message. This address should be a verified sender in your Twilio SendGrid account." }, "name": { "type": "string", "description": "A name or title associated with the sending email address." } }, "required": [ "email" ], "example": { "email": "jane_doe@example.com", "name": "Jane Doe" } }, "api_key_name_id_scopes": { "title": "API Key Name, ID, and Scopes", "allOf": [ { "type": "object", "properties": { "scopes": { "type": "array", "description": "The permissions this API Key has access to.", "items": { "type": "string" } } } }, { "$ref": "#/definitions/api_key_name_id" } ], "example": { "api_key_id": "qfTQ6KG0QBiwWdJ0-pCLCA", "name": "Mail Send", "scopes": [ "mail.send", "mail.batch.create", "mail.batch.read", "mail.batch.update", "mail.batch.delete", "user.scheduled_sends.create", "user.scheduled_sends.read", "user.scheduled_sends.update", "user.scheduled_sends.delete", "sender_verification_eligible", "sender_verification_legacy", "2fa_required" ] } }, "contactdb_segments": { "title": "Create a Segment request", "type": "object", "properties": { "name": { "type": "string", "description": "The name of this segment." }, "list_id": { "type": "integer", "description": "The list id from which to make this segment. Not including this ID will mean your segment is created from the main contactdb rather than a list." }, "conditions": { "type": "array", "description": "The conditions for a recipient to be included in this segment.", "items": { "$ref": "#/definitions/contactdb_segments_conditions" } }, "recipient_count": { "type": "number", "description": "The count of recipients in this list. This is not included on creation of segments." } }, "required": [ "name", "conditions" ], "example": { "name": "Last Name Miller", "list_id": 4, "conditions": [ { "field": "last_name", "value": "Miller", "operator": "eq", "and_or": "" }, { "field": "last_clicked", "value": "01/02/2015", "operator": "gt", "and_or": "and" }, { "field": "clicks.campaign_identifier", "value": "513", "operator": "eq", "and_or": "or" } ], "recipient_count": 1234 } }, "api_key_name_id": { "title": "API Key Name and ID", "type": "object", "properties": { "api_key_id": { "type": "string", "description": "The ID of your API Key. " }, "name": { "type": "string", "description": "The name of your API Key." } }, "example": { "api_key_id": "qfTQ6KG0QBiwWdJ0-pCLCA", "name": "Mail Send" } }, "advanced_stats_opens": { "title": "Stats: Advanced Stats with Opens", "type": "object", "description": "The individual events and their stats.", "properties": { "opens": { "type": "integer", "description": "The total number of times your emails were opened by recipients." }, "unique_opens": { "type": "integer", "description": "The number of unique recipients who opened your emails." } } }, "mail_settings_template": { "title": "Mail Settings: Template", "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if the legacy email template setting is enabled." }, "html_content": { "type": "string", "description": "The HTML content that you want to use for your legacy email template." } }, "example": { "enabled": false, "html_content": "

<% body %>Example

\n" } }, "ip_warmup_response": { "title": "IP Warmup: IP", "type": "array", "items": { "type": "object", "properties": { "ip": { "type": "string", "description": "The IP address." }, "start_date": { "type": "integer", "description": "A Unix timestamp indicating when the IP address entered warmup mode." } }, "required": [ "ip", "start_date" ] }, "example": [ { "ip": "0.0.0.0", "start_date": 1409616000 } ] }, "monitor": { "title": "Create monitor settings request", "type": "object", "properties": { "email": { "type": "string", "description": "The email address to which Sendgrid should send emails for monitoring.", "format": "email" }, "frequency": { "type": "number", "description": "The frequency at which to forward monitoring emails. An email will be sent when your subuser sends this many (e.g., 1,000) emails." } }, "required": [ "email", "frequency" ], "example": { "email": "example@example.com", "frequency": 50000 } }, "global_error_response_schema": { "title": "Global Error Response Schema", "type": "object", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string", "description": "the error message" }, "field": { "type": [ "string", "null" ], "description": "the field that generated the error" }, "help": { "type": "object", "description": "helper text or docs for troubleshooting" } }, "required": [ "message" ] } }, "id": { "type": "string" } }, "example": { "errors": [ { "field": "field_name", "message": "error message" } ] } }, "advanced_stats_mailbox_provider": { "title": "Stats: Advanced Stats for Mailbox Provider", "description": "The individual events and their stats.", "allOf": [ { "$ref": "#/definitions/advanced_stats_clicks_opens" }, { "type": "object", "description": "The individual events and their stats.", "properties": { "blocks": { "type": "integer", "description": "The number of emails that were not allowed to be delivered by ISPs." }, "bounces": { "type": "integer", "description": "The number of emails that bounced instead of being delivered." }, "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." }, "drops": { "type": "integer", "description": "The number of emails that were not delivered due to the recipient email address being on a suppression list." }, "requests": { "type": "integer", "description": "The number of emails that were requested to be delivered." }, "processed": { "type": "integer", "description": "Requests from your website, application, or mail client via SMTP Relay or the Web API that SendGrid processed." }, "spam_reports": { "type": "integer", "description": "The number of recipients who marked your email as spam." } } } ] }, "contactdb_custom_field_with_id": { "title": "ContactDB Custom field schema with ID.", "allOf": [ { "$ref": "#/definitions/contactdb_custom_field" }, { "type": "object", "properties": { "id": { "type": "number", "description": "The ID of the custom field." } } } ] }, "ip_pool": { "title": "IP Pools: Pool", "type": "object", "properties": { "name": { "type": "string", "description": "The name of the IP pool.", "maxLength": 64 } }, "required": [ "name" ] }, "google_analytics_settings": { "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" } }, "event-webhook-response": { "title": "Webhooks: Event Webhook Response", "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if the event webhook is enabled." }, "url": { "type": "string", "description": "The URL that you want the event webhook to POST to." }, "group_resubscribe": { "type": "boolean", "description": "Recipient resubscribes to specific group by updating preferences. You need to enable Subscription Tracking for getting this type of event." }, "delivered": { "type": "boolean", "description": "Message has been successfully delivered to the receiving server." }, "group_unsubscribe": { "type": "boolean", "description": "Recipient unsubscribe from specific group, by either direct link or updating preferences. You need to enable Subscription Tracking for getting this type of event." }, "spam_report": { "type": "boolean", "description": "Recipient marked a message as spam." }, "bounce": { "type": "boolean", "description": "Receiving server could not or would not accept message." }, "deferred": { "type": "boolean", "description": "Recipient's email server temporarily rejected message." }, "unsubscribe": { "type": "boolean", "description": "Recipient clicked on message's subscription management link. You need to enable Subscription Tracking for getting this type of event." }, "processed": { "type": "boolean", "description": "Message has been received and is ready to be delivered." }, "open": { "type": "boolean", "description": "Recipient has opened the HTML message. You need to enable Open Tracking for getting this type of event." }, "click": { "type": "boolean", "description": "Recipient clicked on a link within the message. You need to enable Click Tracking for getting this type of event." }, "dropped": { "type": "boolean", "description": "You may see the following drop reasons: Invalid SMTPAPI header, Spam Content (if spam checker app enabled), Unsubscribed Address, Bounced Address, Spam Reporting Address, Invalid, Recipient List over Package Quota" }, "oauth_client_id": { "type": "string", "description": "The client ID Twilio SendGrid sends to your OAuth server or service provider to generate an OAuth access token." }, "oauth_token_url": { "type": "string", "description": "The URL where Twilio SendGrid sends the Client ID and Client Secret to generate an access token. This should be your OAuth server or service provider." } }, "required": [ "enabled", "url", "group_resubscribe", "delivered", "group_unsubscribe", "spam_report", "bounce", "deferred", "unsubscribe", "processed", "open", "click", "dropped" ] }, "user_profile": { "title": "User: Profile", "type": "object", "properties": { "address": { "type": "string", "description": "The street address for this user profile." }, "address2": { "type": "string", "description": "An optional second line for the street address of this user profile." }, "city": { "type": "string", "description": "The city for the user profile." }, "company": { "type": "string", "description": "That company that this user profile is associated with." }, "country": { "type": "string", "description": "Th country of this user profile." }, "first_name": { "type": "string", "description": "The first name of the user." }, "last_name": { "type": "string", "description": "The last name of the user." }, "phone": { "type": "string", "description": "The phone number for the user." }, "state": { "type": "string", "description": "The state for this user." }, "website": { "type": "string", "description": "The website associated with this user." }, "zip": { "type": "string", "description": "The zip code for this user." } }, "example": { "address": "1451 Larimer Street, 3rd floor", "address2": "", "city": "Denver, CO", "company": "SendGrid", "country": "US", "first_name": "Matthew", "last_name": "Bernier", "phone": "7208788003", "state": "CO", "website": "http://sendgrid.com", "zip": "80202" } }, "mail_settings_footer": { "title": "Mail Settings: Footer", "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if the Footer mail setting is currently enabled." }, "html_content": { "type": "string", "description": "The custom HTML content of your email footer." }, "plain_content": { "type": "string", "description": "The plain text content of your email footer." } }, "example": { "enabled": true, "html_content": "Example HTML content", "plain_content": "Example plain content" } }, "category_stats": { "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" } ] } }, "parse-setting": { "title": "Parse Setting", "type": "object", "properties": { "url": { "type": "string", "description": "The public URL where you would like SendGrid to POST the data parsed from your email. Any emails sent with the given hostname provided (whose MX records have been updated to point to SendGrid) will be parsed and POSTed to this URL." }, "hostname": { "type": "string", "description": "A specific and unique domain or subdomain that you have created to use exclusively to parse your incoming email. For example, `parse.yourdomain.com`." }, "spam_check": { "type": "boolean", "description": "Indicates if you would like SendGrid to check the content parsed from your emails for spam before POSTing them to your domain." }, "send_raw": { "type": "boolean", "description": "Indicates if you would like SendGrid to post the original MIME-type content of your parsed email. When this parameter is set to `true`, SendGrid will send a JSON payload of the content of your email." } }, "example": { "url": "http://email.myhostname.com", "hostname": "myhostname.com", "spam_check": false, "send_raw": true } }, "transactional_template": { "title": "Transactional Templates: Template", "allOf": [ { "$ref": "#/definitions/transactional-templates-template-lean" }, { "type": "object", "properties": { "warning": { "$ref": "#/definitions/transactional-template-warning" } } } ], "example": { "id": "33feeff2-5069-43fe-8853-428651e5be79", "name": "example_name", "updated_at ": "2021-04-28 13:12:46", "warning": { "message": "Sample warning message" }, "generation": "legacy" } }, "contactdb_list": { "title": "ContactDB lists", "type": "object", "properties": { "id": { "type": "integer", "description": "The reference ID of your list." }, "name": { "type": "string", "description": "The name of your list. Must be unique against all other list and segment names." }, "recipient_count": { "type": "integer", "description": "The count of recipients currently in the list." } }, "required": [ "id", "name", "recipient_count" ], "example": { "id": 1, "name": "listname", "recipient_count": 0 } }, "suppression_group": { "title": "Suppressions: Suppression Group", "type": "object", "properties": { "id": { "type": "number", "description": "The id of the suppression group." }, "name": { "type": "string", "description": "The name of the suppression group. Each group created by a user must have a unique name.", "maxLength": 30 }, "description": { "type": "string", "description": "A description of the suppression group.", "maxLength": 100 }, "last_email_sent_at": { "type": "null" }, "is_default": { "type": "boolean", "default": false, "description": "Indicates if this is the default suppression group." }, "unsubscribes": { "type": "integer", "description": "The unsubscribes associated with this group." } }, "required": [ "id", "name", "description" ] }, "mail_settings_bounce_purge": { "title": "Mail Settings: Bounce Purge", "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if the bounce purge mail setting is enabled." }, "soft_bounces": { "type": [ "integer", "null" ], "description": "The number of days after which SendGrid will purge all contacts from your soft bounces suppression lists." }, "hard_bounces": { "type": [ "integer", "null" ], "description": "The number of days after which SendGrid will purge all contacts from your hard bounces suppression lists." } }, "example": { "enabled": false, "soft_bounces": 1234, "hard_bounces": null } }, "transactional_template_version_output": { "title": "Transactional Templates: Version Output", "allOf": [ { "type": "object", "properties": { "warnings": { "type": "array", "items": { "$ref": "#/definitions/transactional-template-warning" } } } }, { "$ref": "#/definitions/transactional_template_version_create" }, { "$ref": "#/definitions/transactional-templates-version-output-lean" } ] }, "credentials": { "title": "Credentials", "type": "object", "properties": { "permissions": { "type": "object", "properties": { "api": { "type": "string" }, "mail": { "type": "string" }, "web": { "type": "string" } } }, "username": { "type": "string" } }, "example": { "address": "1234 example street", "address2": null, "city": "Denver", "company": "Company name", "country": "US", "email": "example@example.com", "first_name": "Example", "last_name": "User", "phone": "(555) 555-5555", "state": "CO", "zip": "55555" } }, "global:id": { "title": "Global: ID", "type": "integer" }, "mail_settings_forward_spam": { "title": "Mail Settings: Forward Spam", "type": "object", "properties": { "email": { "type": "string", "description": "The email address where you would like the spam reports to be forwarded." }, "enabled": { "type": "boolean", "description": "Indicates if the Forward Spam setting is enabled." } }, "example": { "email": "", "enabled": true } }, "campaign_request": { "title": "Campaigns Request", "type": "object", "properties": { "title": { "type": "string", "description": "The display title of your campaign. This will be viewable by you in the Marketing Campaigns UI." }, "subject": { "type": [ "string", "null" ], "description": "The subject of your campaign that your recipients will see." }, "sender_id": { "type": [ "null", "integer" ], "description": "The ID of the \"sender\" identity that you have created. Your recipients will see this as the \"from\" on your marketing emails." }, "list_ids": { "type": [ "array", "null" ], "description": "The IDs of the lists you are sending this campaign to. You can have both segment IDs and list IDs", "items": { "type": "integer" } }, "segment_ids": { "type": [ "array", "null" ], "description": "The segment IDs that you are sending this list to. You can have both segment IDs and list IDs. Segments are limited to 10 segment IDs.", "items": { "type": "integer" } }, "categories": { "type": [ "array", "null" ], "description": "The categories you would like associated to this campaign.", "items": { "type": "string" } }, "suppression_group_id": { "type": [ "null", "integer" ], "description": "The suppression group that this marketing email belongs to, allowing recipients to opt-out of emails of this type." }, "custom_unsubscribe_url": { "type": [ "string", "null" ], "description": "This is the url of the custom unsubscribe page that you provide for customers to unsubscribe from your suppression groups." }, "ip_pool": { "type": [ "string", "null" ], "description": "The pool of IPs that you would like to send this email from." }, "html_content": { "type": [ "string", "null" ], "description": "The HTML of your marketing email." }, "plain_content": { "type": [ "string", "null" ], "description": "The plain text content of your emails." }, "editor": { "type": "string", "enum": [ "code", "design" ], "description": "The editor used in the UI." } }, "required": [ "title" ], "example": { "id": 986724, "title": "May Newsletter", "subject": "New Products for Summer!", "sender_id": 124451, "list_ids": [ 110, 124 ], "segment_ids": [ 110 ], "categories": [ "summer line" ], "suppression_group_id": 42, "custom_unsubscribe_url": "", "ip_pool": "marketing", "html_content": "

Check out our summer line!

", "plain_content": "Check out our summer line!", "status": "Draft" } }, "subuser_stats": { "title": "subuser_stats", "type": "object", "properties": { "date": { "type": "string", "description": "The date the statistics were gathered." }, "stats": { "type": "array", "description": "The list of statistics.", "items": { "type": "object", "properties": { "first_name": { "type": "string", "description": "The first name of the subuser." }, "last_name": { "type": "string", "description": "The last name of the subuser." }, "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 in your emails." }, "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." } } }, "name": { "type": "string", "description": "The username of the subuser." }, "type": { "type": "string", "description": "The type of account." } } } } }, "example": { "date": "2016-02-01", "stats": [ { "first_name": "John", "last_name": "Doe", "metrics": { "blocks": 0, "bounce_drops": 0, "bounces": 0, "clicks": 5, "deferred": 0, "delivered": 0, "invalid_emails": 0, "opens": 10, "processed": 10, "requests": 10, "spam_report_drops": 0, "spam_reports": 0, "unique_clicks": 0, "unique_opens": 0, "unsubscribe_drops": 0, "unsubscribes": 0 }, "name": "user1", "type": "subuser" } ] } }, "user_scheduled_send_status": { "title": "User Scheduled Send status", "allOf": [ { "$ref": "#/definitions/mail_batch_id" }, { "type": "object", "description": "The status of the scheduled send.", "properties": { "status": { "type": "string", "description": "The status of the scheduled send.", "enum": [ "cancel", "pause" ] } }, "required": [ "status" ] } ], "example": { "batch_id": "HkJ5yLYULb7Rj8GKSx7u025ouWVlMgAi", "status": "pause" } }, "advanced_stats_clicks_opens": { "title": "Stats: Advanced Stats with Clicks and Opens", "description": "The individual events and their stats.", "allOf": [ { "$ref": "#/definitions/advanced_stats_clicks" }, { "$ref": "#/definitions/advanced_stats_opens" } ] }, "contactdb_segments_with_id": { "title": "ContactDB:: Segments with ID", "allOf": [ { "type": "object", "properties": { "id": { "type": "number", "description": "The ID of the segment." } }, "required": [ "id" ] }, { "$ref": "#/definitions/contactdb_segments" } ] }, "advanced_stats_clicks": { "title": "Stats: Advanced Stats with Clicks", "type": "object", "description": "The individual events and their stats.", "properties": { "clicks": { "type": "integer", "description": "The number of links that were clicked in your emails." }, "unique_clicks": { "type": "integer", "description": "The number of unique recipients who clicked links in your emails." } } }, "contactdb_recipient": { "title": "ContactDB: Recipient", "type": "object", "properties": { "recipients": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "The ID of this recipient." }, "created_at": { "type": "number", "description": "The time this record was created in your contactdb, in unixtime." }, "custom_fields": { "type": "array", "description": "The custom fields assigned to this recipient and their values.", "items": { "$ref": "#/definitions/contactdb_custom_field_with_id_value" } }, "email": { "type": "string", "description": "The email address of this recipient. This is a default custom field that SendGrid provides.", "format": "email" }, "first_name": { "type": [ "string", "null" ], "description": "The first name of this recipient. This is a default custom field that SendGrid provides." }, "last_name": { "type": [ "string", "null" ], "description": "The last name of the recipient." }, "last_clicked": { "type": [ "number", "null" ], "description": "The last time this recipient clicked a link from one of your campaigns, in unixtime." }, "last_emailed": { "type": [ "number", "null" ], "description": "The last time this user was emailed by one of your campaigns, in unixtime." }, "last_opened": { "type": [ "number", "null" ], "description": "The last time this recipient opened an email from you, in unixtime." }, "updated_at": { "type": "number", "description": "The last update date for this recipient's record." } }, "required": [ "email" ] } } } }, "mail_settings_patch": { "title": "Mail Settings: Patch", "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if the mail setting is enabled." }, "email": { "type": "string", "description": "The email address of the recipient." } }, "example": { "enabled": true, "email": "email@example.com" } }, "mail_settings_forward_bounce": { "title": "Mail Settings: Forward Bounce", "type": "object", "properties": { "email": { "type": [ "string", "null" ], "description": "The email address that you would like your bounce reports forwarded to." }, "enabled": { "type": "boolean", "description": "Indicates if the bounce forwarding mail setting is enabled." } }, "example": { "enabled": false, "email": null } }, "mail_batch_id": { "title": "Mail Batch ID", "type": "object", "properties": { "batch_id": { "type": "string", "pattern": "^[a-zA-Z0-9\\-\\_]" } }, "required": [ "batch_id" ], "example": { "batch_id": "HkJ5yLYULb7Rj8GKSx7u025ouWVlMgAi" } }, "subuser_post": { "title": "Subuser::POST", "type": "object", "properties": { "username": { "type": "string", "description": "The username of the subuser." }, "user_id": { "type": "number", "description": "The user ID for this subuser." }, "email": { "type": "string", "description": "The email address for this subuser.", "format": "email" }, "signup_session_token": { "type": "string" }, "authorization_token": { "type": "string" }, "credit_allocation": { "type": "object", "properties": { "type": { "type": "string" } } } }, "required": [ "username", "user_id", "email" ], "example": { "username": "example_subuser", "user_id": 1234, "email": "example@example.com", "signup_session_token": "", "authorization_token": "", "credit_allocation": { "type": "unlimited" } } }, "contactdb_recipient_count": { "title": "ContactDB: Recipient Count", "type": "object", "properties": { "recipient_count": { "type": "number", "description": "The count of recipients." } }, "required": [ "recipient_count" ], "example": { "recipient_count": 1234 } }, "authentication::domain": { "title": "Domain Authentication - Mandatory Subdomain", "type": "object", "properties": { "id": { "type": "number", "description": "The ID of the authenticated domain." }, "user_id": { "type": "number", "description": "The ID of the user that this domain is associated with." }, "subdomain": { "type": "string", "description": "The subdomain to use for this authenticated domain." }, "domain": { "type": "string", "description": "The domain to be authenticated." }, "username": { "type": "string", "description": "The username that this domain will be associated with." }, "ips": { "type": "array", "description": "The IPs to be included in the custom SPF record for this authenticated domain.", "items": { "type": "string" } }, "custom_spf": { "type": "boolean", "description": "Indicates whether this authenticated domain uses custom SPF." }, "default": { "type": "boolean", "description": "Indicates if this is the default authenticated domain." }, "legacy": { "type": "boolean", "description": "Indicates if this authenticated domain was created using the legacy whitelabel tool. If it is a legacy whitelabel, it will still function, but you'll need to create a new authenticated domain if you need to update it." }, "automatic_security": { "type": "boolean", "description": "Indicates if this authenticated domain uses automated security." }, "valid": { "type": "boolean", "description": "Indicates if this is a valid authenticated domain." }, "dns": { "type": "object", "description": "The DNS records used to authenticate the sending domain.", "required": [ "mail_cname", "dkim1", "dkim2" ], "properties": { "mail_cname": { "type": "object", "description": "The CNAME for your sending domain that points to sendgrid.net.", "required": [ "valid", "type", "host", "data" ], "properties": { "valid": { "type": "boolean", "description": "Indicates if this is a valid CNAME." }, "type": { "type": "string", "description": "The type of DNS record." }, "host": { "type": "string", "description": "The domain that this CNAME is created for.", "format": "hostname" }, "data": { "type": "string", "description": "The CNAME record." } } }, "dkim1": { "type": "object", "description": "A DNS record.", "required": [ "valid", "type", "host", "data" ], "properties": { "valid": { "type": "boolean", "description": "Indicates if this is a valid DNS record." }, "type": { "type": "string", "description": "The type of DNS record." }, "host": { "type": "string", "description": "The domain that this DNS record was created for." }, "data": { "type": "string", "description": "The DNS record." } } }, "dkim2": { "type": "object", "description": "A DNS record.", "required": [ "valid", "type", "host", "data" ], "properties": { "valid": { "type": "boolean", "description": "Indicates if this is a valid DNS record." }, "type": { "type": "string", "description": "The type of DNS record." }, "host": { "type": "string", "description": "The domain that this DNS record was created for." }, "data": { "type": "string", "description": "The DNS record." } } } } } }, "required": [ "id", "user_id", "subdomain", "domain", "username", "ips", "custom_spf", "default", "legacy", "automatic_security", "valid", "dns" ], "example": { "id": 45373692, "user_id": 66036447, "subdomain": "sub", "domain": "example.com", "username": "jdoe", "ips": [ "127.0.0.1" ], "custom_spf": false, "default": true, "legacy": false, "automatic_security": true, "valid": true, "dns": { "mail_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "u7.wl.sendgrid.net" }, "dkim1": { "valid": true, "type": "cname", "host": "s1._domainkey.example.com", "data": "s1._domainkey.u7.wl.sendgrid.net" }, "dkim2": { "valid": true, "type": "cname", "host": "s2._domainkey.example.com", "data": "s2._domainkey.u7.wl.sendgrid.net" } } } }, "contactdb_custom_field_with_id_value": { "title": "ContactDB Custom field schema.", "allOf": [ { "$ref": "#/definitions/contactdb_custom_field_with_id" }, { "type": "object", "properties": { "value": { "type": [ "string", "null" ], "description": "The value of this recipient's custom field" } } } ] }, "transactional_template_version_create": { "title": "Transactional Templates: Version Create", "type": "object", "properties": { "active": { "type": "integer", "description": "Set the version as the active version associated with the template (0 is inactive, 1 is active). Only one version of a template can be active. The first version created for a template will automatically be set to Active.", "enum": [ 0, 1 ] }, "name": { "type": "string", "description": "Name of the transactional template version.", "maxLength": 100 }, "html_content": { "type": "string", "description": "The HTML content of the version. Maximum of 1048576 bytes allowed.", "maxLength": 1048576 }, "plain_content": { "type": "string", "description": "Text/plain content of the transactional template version. Maximum of 1048576 bytes allowed.", "maxLength": 1048576, "default": "" }, "generate_plain_content": { "type": "boolean", "description": "If true, plain_content is always generated from html_content. If false, plain_content is not altered.", "default": true }, "subject": { "type": "string", "description": "Subject of the new transactional template version.", "maxLength": 255 }, "editor": { "type": "string", "enum": [ "code", "design" ], "description": "The editor used in the UI." }, "test_data": { "type": "string", "description": "For dynamic templates only, the mock json data that will be used for template preview and test sends." } }, "required": [ "name", "subject" ], "example": { "template_id": "Excepteur Ut qui", "active": 1, "name": "pariatur non incididunt commodo", "html_content": "dolor", "generate_plain_content": false, "subject": "aliquip nulla Ut", "editor": "design", "plain_content": "labore dolore" } }, "transactional-templates-version-output-lean": { "title": "Transactional Templates: Version Output Lean", "type": "object", "properties": { "id": { "type": "string", "description": "ID of the transactional template version.", "format": "uuid" }, "template_id": { "type": "string", "description": "ID of the transactional template." }, "active": { "type": "integer", "description": "Set the version as the active version associated with the template. Only one version of a template can be active. The first version created for a template will automatically be set to Active.", "enum": [ 0, 1 ] }, "name": { "type": "string", "description": "Name of the transactional template version.", "maxLength": 100 }, "subject": { "type": "string", "description": "Subject of the new transactional template version.", "maxLength": 255 }, "updated_at": { "type": "string", "description": "The date and time that this transactional template version was updated." }, "generate_plain_content": { "type": "boolean", "description": "If true, plain_content is always generated from html_content. If false, plain_content is not altered.", "default": true }, "editor": { "type": "string", "enum": [ "code", "design" ], "description": "The editor used in the UI." }, "thumbnail_url": { "type": "string", "description": "A Thumbnail preview of the template's html content." } } }, "transactional-templates-template-lean": { "title": "Transactional Templates: Template Lean", "type": "object", "properties": { "id": { "type": "string", "description": "The ID of the transactional template.", "minLength": 36, "maxLength": 36, "format": "uuid" }, "name": { "type": "string", "description": "The name for the transactional template.", "maxLength": 100 }, "generation": { "type": "string", "description": "Defines the generation of the template.", "enum": [ "legacy", "dynamic" ] }, "updated_at ": { "type": "string", "description": "The date and time that this transactional template version was updated.", "pattern": "^(\\d{4}-\\d{2}-\\d{2}) ((\\d{2}):(\\d{2}):(\\d{2}))$" }, "versions": { "type": "array", "description": "The different versions of this transactional template.", "items": { "$ref": "#/definitions/transactional-templates-version-output-lean" } } }, "required": [ "id", "name", "generation", "updated_at " ], "example": { "id": "0c314114-a2b7-4523-8cbc-a293d7d19007", "name": "example_name", "generation": "legacy", "updated_at ": "2021-04-28 13:12:46", "versions": [] } }, "custom-fields-by-id": { "title": "custom-fields-by-id", "type": "object", "example": { "w1": "2002-10-02T15:00:00Z", "w33": 9.5, "e2": "Coffee is a beverage that puts one to sleep when not drank." } }, "custom-fields-by-name": { "title": "custom-fields-by-name", "type": "object", "example": { "birthday": "2002-10-02T15:00:00Z", "shoe_size": 9.5, "favoriteQuote": "Coffee is a beverage that puts one to sleep when not drank." } }, "contact-details": { "title": "contact-details", "type": "object", "properties": { "address_line_1": { "type": "string" }, "address_line_2": { "type": "string" }, "alternate_emails": { "type": "array", "items": { "type": "string" } }, "city": { "type": "string" }, "country": { "type": "string" }, "email": { "type": "string" }, "first_name": { "type": "string" }, "id": { "type": "string" }, "last_name": { "type": "string" }, "postal_code": { "type": "string" }, "state_province_region": { "type": "string" }, "list_ids": { "type": "array", "items": { "type": "string" } }, "created_at": { "type": "string", "description": "The ISO8601 timestamp when the contact was created." }, "updated_at": { "type": "string", "description": "The ISO8601 timestamp when the contact was updated." }, "_metadata": { "$ref": "#/definitions/selfmetadata" }, "custom_fields": { "$ref": "#/definitions/custom-fields-by-name" } }, "required": [ "id", "list_ids", "created_at", "updated_at" ] }, "contact-import": { "title": "contact-import", "type": "object", "properties": { "id": { "type": "string", "description": "The job ID." }, "status": { "type": "string", "description": "The job state. Allowed values: `pending`, `completed`, `errored`, or `failed`." }, "job_type": { "type": "string", "description": "The job type. Allowed values: `upsert`, or `delete`." }, "results": { "type": "object", "description": "Result map of the import job.", "properties": { "requested_count": { "description": "Requested contact count from the import.", "type": "number" }, "created_count": { "description": "Created contact count from the import.", "type": "number" }, "updated_count": { "description": "Updated contact count from the import.", "type": "number" }, "deleted_count": { "description": "Count of deleted contacts that resulted in error.", "type": "number" }, "errored_count": { "description": "Count of imported contacts that resulted in error.", "type": "number" }, "errors_url": { "type": "string", "description": "The download URL of the file which provides information about any errors." } } }, "started_at": { "description": "The ISO8601 timestamp when the job was created.", "type": "string" }, "finished_at": { "description": "The ISO8601 timestamp when the job was finished.", "type": "string" } } }, "single-contact-request": { "title": "single contact request", "type": "object", "properties": { "list_ids": { "type": "array", "minItems": 0, "maxItems": 100, "description": "The contact's list IDs.", "items": { "type": "string", "format": "uuid" } }, "contact": { "type": "object", "properties": { "primary_email": { "type": "string" }, "alternate_emails": { "type": "string" }, "first_name": { "type": "string" }, "last_name": { "type": "string" }, "address_line_1": { "type": "string" }, "address_line_2": { "type": "string" }, "city": { "type": "string" }, "state_province_region": { "type": "string" }, "postal_code": { "type": "string" }, "country": { "type": "string" }, "custom_fields": { "type": "object", "properties": { "custom_field_name1": { "type": "string" }, "custom_field_name2": { "type": "string" } } } } } } }, "contact-export": { "title": "contact-export", "type": "object", "properties": { "id": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "ready", "failure" ], "description": "The export job's status. Allowed values: `pending`, `ready`, or `failure`." }, "created_at": { "type": "string", "description": "The ISO8601 timestamp when the export was begun." }, "updated_at": { "type": "string", "description": "The ISO8601 timestamp when the export was updated." }, "completed_at": { "type": "string", "description": "The ISO8601 timestamp when the export was completed." }, "expires_at": { "type": "string", "description": "The ISO8601 timestamp when the exported file on S3 will expire." }, "urls": { "type": "array", "description": "One or more download URLs for the contact file if the status is `ready`.", "items": { "type": "string" } }, "message": { "type": "string", "description": "A human readable message if the status is `failure`." }, "_metadata": { "$ref": "#/definitions/metadata" }, "contact_count": { "type": "integer", "description": "The total number of exported contacts." } }, "required": [ "id", "status", "created_at", "updated_at", "expires_at" ] }, "contact-summary": { "title": "contact-summary", "type": "object", "properties": { "email": { "type": "string", "description": "Primary email address." }, "first_name": { "type": "string" }, "id": { "type": "string", "description": "Contact UUID." }, "last_name": { "type": "string" }, "list_ids": { "type": "array", "description": "List UUID linked with this contact.", "items": { "type": "string" } }, "created_at": { "type": "number", "description": "Unix Epoch Timestamp." }, "updated_at": { "type": "number", "description": "Unix Epoch Timestamp." }, "_metadata": { "$ref": "#/definitions/selfmetadata" } }, "required": [ "id", "list_ids", "created_at", "updated_at" ] }, "contact-request": { "title": "contact-request", "type": "object", "properties": { "address_line_1": { "type": "string", "description": "The first line of the address.", "maxLength": 100 }, "address_line_2": { "type": "string", "description": "An optional second line for the address.", "maxLength": 100 }, "alternate_emails": { "type": "array", "description": "Additional emails associated with the contact.", "minItems": 0, "maxItems": 5, "items": { "type": "string", "maxLength": 254 } }, "city": { "type": "string", "description": "The contact's city.", "maxLength": 60 }, "country": { "type": "string", "description": "The contact's country. Can be a full name or an abbreviation.", "maxLength": 50 }, "email": { "type": "string", "description": "The contact's primary email. This is required to be a valid email.", "maxLength": 254 }, "first_name": { "type": "string", "description": "The contact's personal name.", "maxLength": 50 }, "last_name": { "type": "string", "description": "The contact's family name.", "maxLength": 50 }, "postal_code": { "type": "string", "description": "The contact's ZIP code or other postal code." }, "state_province_region": { "type": "string", "description": "The contact's state, province, or region.", "maxLength": 50 }, "custom_fields": { "$ref": "#/definitions/custom-fields-by-id" } }, "required": [ "email" ] }, "contact-details2": { "title": "contact-details2", "type": "object", "properties": { "id": { "type": "string", "minLength": 36, "maxLength": 36, "format": "uuid" }, "first_name": { "type": "string" }, "last_name": { "type": "string" }, "unique_name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "alternate_emails": { "type": [ "array", "null" ], "items": { "type": "string", "format": "email" } }, "address_line_1": { "type": "string" }, "address_line_2": { "type": "string" }, "city": { "type": "string" }, "state_province_region": { "type": "string" }, "country": { "type": "string" }, "postal_code": { "type": "string" }, "phone_number": { "type": "string" }, "whatsapp": { "type": "string" }, "line": { "type": "string" }, "facebook": { "type": "string" }, "list_ids": { "type": "array", "items": { "type": "string", "format": "uuid" } }, "segment_ids": { "type": "array", "items": { "type": "string", "format": "uuid" } }, "custom_fields": { "type": "object" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" }, "_metadata": { "$ref": "#/definitions/selfmetadata" } }, "required": [ "id", "list_ids", "created_at", "updated_at" ] }, "selfmetadata": { "title": "selfMetadata", "type": "object", "properties": { "self": { "type": "string", "description": "A link to this object." } } }, "error": { "title": "error", "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" }, "error_id": { "type": "string" }, "parameter": { "type": "string" } }, "required": [ "message" ] }, "link": { "title": "Link", "type": "object", "properties": { "rel": { "type": "string" }, "href": { "type": "string" } } }, "metadata": { "title": "metadata", "type": "object", "properties": { "prev": { "type": "string", "format": "uri", "description": "The URL of the previous page of results. If this field isn't present, you're at the start of the list." }, "self": { "type": "string", "format": "uri", "description": "The URL of the current page of results." }, "next": { "type": "string", "format": "uri", "description": "The URL of the next page of results. If this field isn't present, you're at the end of the list." }, "count": { "type": "number", "description": "The number of items in the entire list, i.e., across all pages." } } }, "webhook": { "title": "webhook", "type": "object", "properties": { "url": { "type": "string", "description": "The URL to invoke in the webhook" }, "nonce": { "type": "string", "description": "The one time nonce to use when \"signature\" is \"hmac-sha1\"", "minLength": 8, "maxLength": 32 } }, "required": [ "url", "nonce" ] }, "list": { "title": "list", "type": "object", "properties": { "id": { "type": "string", "description": "The generated ID for your list.", "minLength": 36, "maxLength": 36 }, "name": { "type": "string", "description": "The name you gave your list." }, "contact_count": { "type": "integer", "description": "The number of contacts currently stored on the list." }, "_metadata": { "$ref": "#/definitions/selfmetadata" } } }, "reserved_field_definitions_response": { "title": "reserved_field_definitions_response", "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "field_type": { "type": "string", "enum": [ "Text", "Number", "Date" ] }, "read_only": { "type": "boolean", "default": false, "description": "When `true` this means API consumers are unable to set the value of this field on contacts." } } }, "required": [ "name", "field_type" ], "example": [ { "id": "_rf20_T", "name": "automation_id", "field_type": "Text", "read_only": true } ] }, "custom_field_definitions_response": { "title": "custom_field_definitions_response", "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "field_type": { "type": "string", "enum": [ "Text", "Number", "Date" ] } }, "required": [ "id", "name", "field_type" ], "example": { "id": "a1_D", "name": "custom_field_name", "field_type": "Date" } }, "segment_write": { "title": "segment_write", "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "query_dsl": { "type": "string", "description": "Use this field for adding your query string." } }, "required": [ "name", "query_dsl" ] }, "segment_summary": { "title": "segment_summary", "type": "object", "properties": { "id": { "type": "string", "minLength": 36, "maxLength": 36, "format": "uuid" }, "contacts_count": { "type": "integer" }, "created_at": { "type": "string", "description": "ISO8601 of created timestamp\n", "format": "date-time" }, "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "parent_list_id": { "type": "string", "minLength": 36, "maxLength": 36, "format": "uuid", "description": "The id of the list if this segment is a child of a list. This implies the query `AND CONTAINS(list_ids, ${parent_list_id})`" }, "sample_updated_at": { "type": "string", "description": "ISO8601 timestamp the sample was last updated", "format": "date-time" }, "updated_at": { "type": "string", "description": "ISO8601 timestamp the object was last updated", "format": "date-time" }, "next_sample_update": { "type": "string", "description": "ISO8601 string that is equal to `sample_updated_at` plus an internally calculated offset that depends on how often contacts enter or exit segments as the scheduled pipeline updates the samples." } }, "required": [ "id", "contacts_count", "created_at", "sample_updated_at", "updated_at" ] }, "segment_query_json": { "title": "segment_query_json", "type": "object", "properties": { "contacts": { "type": "object", "properties": { "op": { "type": "string" }, "l": { "type": "object", "properties": { "op": { "type": "string" }, "l": { "type": "object", "properties": { "op": { "type": "string" }, "l": { "type": "object", "properties": { "v": { "type": "string" }, "t": { "type": "string" } } }, "r": { "type": "object", "properties": { "v": { "type": "string" }, "t": { "type": "string" } } } } }, "r": { "type": "object", "properties": { "op": { "type": "string" }, "l": { "type": "object", "properties": { "v": { "type": "string" }, "t": { "type": "string" }, "args": { "type": "array", "items": { "type": "object", "properties": { "v": { "type": "string" }, "t": { "type": "string" } } } } } }, "r": { "type": "object", "properties": { "v": { "type": "string" }, "t": { "type": "string" } } } } } } }, "r": { "type": "object", "properties": { "op": { "type": "string" }, "l": { "type": "object", "properties": { "v": { "type": "string" }, "t": { "type": "string" } } }, "r": { "type": "object", "properties": { "v": { "type": "array", "items": { "type": "string" } }, "t": { "type": "string" } } } } } } } } }, "contact_response": { "title": "contact_response", "type": "object", "properties": { "id": { "type": "string", "maxLength": 36, "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", "format": "uuid", "description": "ID assigned to a contact when added to the system." }, "email": { "type": "string", "minLength": 3, "maxLength": 254, "format": "email", "description": "Email of the contact. This is a reserved field." }, "alternate_emails": { "type": "array", "uniqueItems": true, "minItems": 0, "description": "Alternate emails of the contact. This is a reserved field.", "items": { "type": "string", "minLength": 3, "maxLength": 254, "format": "email" } }, "first_name": { "type": "string", "minLength": 1, "description": "First name of the contact. This is a reserved field." }, "last_name": { "type": "string", "minLength": 1, "description": "Last name of the contact. This is a reserved field." }, "address_line_1": { "type": "string", "minLength": 0, "description": "First line of address of the contact. This is a reserved field." }, "address_line_2": { "type": "string", "minLength": 0, "description": "Second line of address of the contact. This is a reserved field." }, "city": { "type": "string", "minLength": 0, "pattern": "^[a-zA-Z\\u0080-\\u024F\\s\\/\\-\\)\\(\\`\\.\\\"\\']+$", "description": "City associated with the contact. This is a reserved field." }, "state_province_region": { "type": "string", "minLength": 0, "description": "State associated with the contact. This is a reserved field." }, "postal_code": { "type": "integer", "description": "Zipcode associated with the address of the contact. This is a reserved field." }, "country": { "type": "string", "minLength": 0, "description": "Country associated with the address of the contact. This is a reserved field." }, "list_ids": { "type": "array", "uniqueItems": true, "description": "IDs of all lists the contact is part of", "items": { "type": "string", "format": "uuid" } }, "custom_fields": { "type": "object", "minProperties": 0, "description": "The user may choose to create up to 120 custom fields or none at all. This is not a reserved field.", "properties": { "custom_field_name1": { "type": "string", "minLength": 0 }, "custom_field_name2": { "type": "string", "minLength": 0 }, "": { "type": "string" } } }, "segment_ids": { "type": "array", "uniqueItems": true, "description": "IDs of all segments the contact is part of", "items": { "type": "string", "format": "uuid" } } }, "required": [ "id", "email", "alternate_emails", "first_name", "last_name", "address_line_1", "address_line_2", "city", "state_province_region", "postal_code", "country", "custom_fields" ], "example": { "id": "47d23ab0-d895-4359-a0d1-ffc7a6fc7e70", "email": "abcd@gmail.com", "alternate_emails": [ "abcd@yahoo.com", "abcd@hotmail.com" ], "first_name": "Ab", "last_name": "Cd", "address_line_1": "street address / P.O. box / CompanyName / c/o", "address_line_2": "apartment, suite, unit, building, floor etc", "city": "Redwood City", "state_province_region": "CA", "postal_code": 94063, "country": "USA", "custom_fields": { "custom_field_name1": "custom_field_value1", "custom_field_name2": "custom_field_value2" } } }, "TNE-senderID": { "title": "Sender ID Response Body", "allOf": [ { "type": "object", "properties": { "id": { "type": "integer", "description": "The unique identifier of the sender." } } }, { "$ref": "#/definitions/senders-id-request-body" }, { "type": "object", "properties": { "verified": { "type": "object", "description": "Only verified sender identities can be used to send email.", "properties": { "status": { "type": "boolean", "description": "Whether the sender identity has been verified. Only verified sender identities can be used to send email." }, "reason": { "type": [ "string", "null" ], "description": "The reason for a verification failure, or null if verification succeeeded or has yet to take place." } } }, "updated_at": { "type": "integer", "description": "The time the sender identity was last updated." }, "created_at": { "type": "integer", "description": "The time the sender identity was created." }, "locked": { "type": "boolean", "description": "A sender identity is locked when it is associated with a campaign in the Draft, Scheduled, or In Progress state. You can't update or delete a locked sender identity." } } } ] }, "api-error": { "title": "error", "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" }, "error_id": { "type": "string" } }, "required": [ "message", "field", "error_id" ] }, "api-errors": { "title": "errors", "type": "object", "properties": { "errors": { "type": "array", "items": { "$ref": "#/definitions/api-error" } } } }, "_metadata": { "title": "_metadata", "type": "object", "properties": { "prev": { "type": "string", "format": "uri" }, "self": { "type": "string", "format": "uri" }, "next": { "type": "string", "format": "uri" }, "count": { "type": "integer", "minimum": 0 } } }, "design-input": { "title": "Design Input", "allOf": [ { "$ref": "#/definitions/design-duplicate-input" }, { "$ref": "#/definitions/design-common-fields" }, { "type": "object", "properties": { "html_content": { "type": "string", "description": "The HTML content of the Design.", "maxLength": 1048576 }, "plain_content": { "type": "string", "description": "Plain text content of the Design.", "maxLength": 1048576, "default": "" } }, "required": [ "html_content" ] } ], "example": { "name": "Ahoy, World!", "editor": "design", "subject": "Getting Started", "html_content": "\n\n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n
\n

\n
\n \n \n \n \n \n
Ahoy, World!

{{Sender_Name}}

{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}

Unsubscribe - Unsubscribe Preferences

\n \n
\n
\n
\n
\n
\n \n ", "plain_content": "Ahoy, World!\n\n{{Sender_Name}}\n\n{{Sender_Address}} , {{Sender_City}} , {{Sender_State}} {{Sender_Zip}}\n\nUnsubscribe ( {{{unsubscribe}}} ) - Unsubscribe Preferences ( {{{unsubscribe_preferences}}} )" } }, "design-output": { "title": "Design Output", "allOf": [ { "$ref": "#/definitions/design-output-summary" }, { "$ref": "#/definitions/design-input" } ] }, "design-output-summary": { "title": "Design Output - Summary", "allOf": [ { "type": "object", "properties": { "id": { "type": "string", "description": "ID of the Design.", "format": "uuid" }, "updated_at": { "type": "string", "description": "Datetime that Design was last updated.", "format": "ISO 8601 date-time" }, "created_at": { "type": "string", "description": "Datetime that Design was created.", "format": "ISO 8601 date-time" }, "thumbnail_url": { "type": "string", "description": "A Thumbnail preview of the template's html content." } } }, { "$ref": "#/definitions/design-duplicate-input" }, { "$ref": "#/definitions/design-common-fields" } ], "example": { "result": [ { "id": "3247eaea-c912-42a3-b0bc-60bdaf210396", "name": "Welcome Email", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/llny8o5b3m636z92p7hbjnmq1jvpka39p370jwtin2s1wxv7x1sgm0y5fk518d0s.png", "subject": "Welcom to the Cake or Pie Cafe", "created_at": "2021-04-09T17:29:46Z", "updated_at": "2021-04-09T17:29:55Z", "editor": "code", "categories": [ "welcome", "new customer" ] }, { "id": "02dfd792-f31f-439a-a79e-5c47fbcfdbac", "name": "Monthly Promo", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/hfyxahd7ues2ajuoeoqq2xe6ibdasl1q89ox0y9ncya2ftpoicssmtf9ddus4c39.png", "subject": "Free Dozen Cupcakes", "created_at": "2021-04-09T17:29:21Z", "updated_at": "2021-04-09T17:29:42Z", "editor": "design", "categories": [ "promo", "coupon" ] }, { "id": "e54be823-19ef-4c6f-8b60-efd7514f492d", "name": "Duplicate: Ingrid & Anders", "generate_plain_content": true, "thumbnail_url": "//us-east-2-production-thumbnail-bucket.s3.amazonaws.com/12kni9gjpyb9uxmwr9vk7unycjr70u95zoyhe9sg2zounul2zg7dih1s20k13q2z.png", "subject": "Welcome to Ingrid & Anders!", "created_at": "2020-10-09T17:33:46Z", "updated_at": "2021-04-07T19:57:52Z", "editor": "design", "categories": [] } ], "_metadata": { "self": "https://api.sendgrid.com/v3/designs?page_token=vHdvHCg0w1F-TmWJcPNpTEnFY2aPEmRBHONwOgZ6TgJbX2_I", "count": 3 } } }, "design-duplicate-input": { "title": "Design Duplicate Design Input", "type": "object", "properties": { "name": { "type": "string", "description": "The name of the new design.", "default": "Duplicate: " }, "editor": { "type": "string", "description": "The editor used in the UI.", "enum": [ "code", "design" ] } }, "example": { "name": "Ahoy, Cake or Pie Cafe!", "editor": "design" } }, "contact-details3": { "title": "contact-details3", "type": "object", "properties": { "id": { "type": "string" }, "first_name": { "type": "string" }, "last_name": { "type": "string" }, "unique_name": { "type": "string" }, "email": { "type": "string" }, "alternate_emails": { "type": "array", "items": { "type": "string" } }, "address_line_1": { "type": "string" }, "address_line_2": { "type": "string" }, "city": { "type": "string" }, "state_province_region": { "type": "string" }, "country": { "type": "string" }, "postal_code": { "type": "string" }, "phone_number": { "type": "string" }, "whatsapp": { "type": "string" }, "line": { "type": "string" }, "facebook": { "type": "string" }, "list_ids": { "type": "array", "items": { "type": "string" } }, "segment_ids": { "type": "array", "items": { "type": "string" } }, "custom_fields": { "type": "object" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "_metadata": { "$ref": "#/definitions/selfmetadata" } }, "required": [ "id", "list_ids", "segment_ids", "created_at", "updated_at" ] }, "transactional-template-warning": { "title": "Warning", "type": "object", "properties": { "message": { "type": "string", "description": "Warning message for the user" } }, "example": { "message": "A sample warning message." } }, "errors": { "title": "Errors", "type": "object", "description": "If the request is incorrect, an array of errors will be returned.", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "parameter": { "type": "string", "description": "The parameter in the request body that is incorrect." }, "message": { "type": [ "string", "null" ], "description": "A description of what is wrong with the field passed in the request." }, "field": { "type": [ "string", "null" ] } }, "required": [ "parameter", "message" ] } } }, "required": [ "errors" ] }, "singlesends-response": { "title": "singlesends-response", "type": "object", "properties": { "results": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "This is the ID of the Single Dend you require stats for.", "format": "uuid" }, "ab_variation": { "type": "string", "default": "all", "description": "This is the A/B variation of the Single Send stat returned. If the `group_by` parameter doesn't include `ab_variation` in the request, then the value is \"all\".", "format": "uuid" }, "ab_phase": { "type": "string", "default": "all", "description": "This is the A/B phase of the Single Send stat returned. If the `group_by` parameter doesn't include `ab_phase` in the request, then the value is \"all\".", "enum": [ "send", "test", "all" ] }, "aggregation": { "type": "string", "description": "This describes the time unit to which the stat is rolled up. It is based on the `aggregated_by` parameter included in the request. It can be \"total\" or the date (in YYYY-MM-DD format) the stats are for.", "default": "total" }, "stats": { "$ref": "#/definitions/metrics" } }, "required": [ "id", "ab_variation", "ab_phase" ] } }, "_metadata": { "$ref": "#/definitions/metadata" } }, "required": [ "results", "_metadata" ] }, "automations-response": { "title": "automations-response", "type": "object", "properties": { "results": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "This is the ID of the Automation you are requesting stats for.", "format": "uuid" }, "aggregation": { "type": "string", "description": "This describes the time unit to which the stat is rolled up. It is based on the `aggregated_by` parameter included in the request. It can be \"total\" or the date (in YYYY-MM-DD format) the stats are for.", "default": "total" }, "step_id": { "type": "string", "description": "This is the ID of the step if the stats were requested to be grouped by `step_id`.", "default": "all" }, "stats": { "$ref": "#/definitions/metrics" } }, "required": [ "id", "aggregation", "step_id" ] } }, "_metadata": { "$ref": "#/definitions/metadata" } }, "required": [ "results" ] }, "metrics": { "title": "metrics", "type": "object", "properties": { "bounce_drops": { "type": "integer" }, "bounces": { "type": "integer" }, "clicks": { "type": "integer" }, "delivered": { "type": "integer" }, "invalid_emails": { "type": "integer" }, "opens": { "type": "integer" }, "requests": { "type": "integer" }, "spam_report_drops": { "type": "integer" }, "spam_reports": { "type": "integer" }, "unique_clicks": { "type": "integer" }, "unique_opens": { "type": "integer" }, "unsubscribes": { "type": "integer" } }, "required": [ "bounce_drops", "bounces", "clicks", "delivered", "invalid_emails", "opens", "requests", "spam_report_drops", "spam_reports", "unique_clicks", "unique_opens", "unsubscribes" ] }, "singlesend_search": { "title": "singlesend_search", "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "leading and trailing wildcard search on name of the Single Send" }, "status": { "type": "array", "description": "current status of the Single Send", "uniqueItems": true, "items": { "type": "string", "enum": [ "draft", "scheduled", "triggered" ] } }, "categories": { "type": "array", "description": "categories to associate with this Single Send, match any single send that has at least one of the categories", "uniqueItems": true, "items": { "type": "string" } } } }, "singlesend_request": { "title": "singlesend_request", "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "The name of the Single Send." }, "categories": { "type": "array", "uniqueItems": true, "maxItems": 10, "description": "The categories to associate with this Single Send.", "items": { "type": "string" } }, "send_at": { "type": "string", "format": "date-time", "description": "The ISO 8601 time at which to send the Single Send — this must be set for a future time." }, "send_to": { "type": "object", "properties": { "list_ids": { "type": "array", "description": "The recipient List IDs that will receive the Single Send.", "maxItems": 10, "items": { "type": "string", "format": "uuid" } }, "segment_ids": { "type": "array", "description": "The recipient Segment IDs that will receive the Single Send.", "maxItems": 10, "items": { "type": "string", "format": "uuid" } }, "all": { "type": "boolean", "description": "Set to `true` to send to All Contacts. If set to `false`, at least one `list_ids` or `segment_ids` value must be provided before the Single Send is scheduled to be sent to recipients.", "default": false } } }, "email_config": { "type": "object", "properties": { "subject": { "type": "string", "description": "The subject line of the Single Send. Do not include this field when using a `design_id`." }, "html_content": { "type": "string", "description": "The HTML content of the Single Send. Do not include this field when using a `design_id`." }, "plain_content": { "type": "string", "description": "The plain text content of the Single Send. Do not include this field when using a `design_id`." }, "generate_plain_content": { "type": "boolean", "description": "If set to `true`, `plain_content` is always generated from `html_content`. If set to false, `plain_content` is not altered.", "default": true }, "design_id": { "type": "string", "description": "A `design_id` can be used in place of `html_content`, `plain_content`, and/or `subject`. You can retrieve a design's ID from the [\"List Designs\" endpoint](https://sendgrid.api-docs.io/v3.0/designs-api/list-designs) or by pulling it from the design's detail page URL in the Marketing Campaigns App." }, "editor": { "type": "string", "enum": [ "code", "design" ], "description": "The editor — `\"design\"` or `\"code\"` — used to modify the Single Send's design in the Marketing Campaigns App.", "default": "code" }, "suppression_group_id": { "type": [ "integer", "null" ], "description": "The ID of the Suppression Group to allow recipients to unsubscribe — you must provide this or the `custom_unsubscribe_url`." }, "custom_unsubscribe_url": { "type": [ "string", "null" ], "description": "The URL allowing recipients to unsubscribe — you must provide this or the `suppression_group_id`.", "format": "uri" }, "sender_id": { "type": [ "integer", "null" ], "description": "The ID of the verified Sender. You can retrieve a verified Sender's ID from the [\"Get Verified Senders\" endpoint](https://sendgrid.api-docs.io/v3.0/sender-verification/get-verified-senders) or by pulling it from the Sender's detail page URL in the SendGrid App." }, "ip_pool": { "type": [ "string", "null" ], "description": "The name of the IP Pool from which the Single Send emails are sent." } } } }, "required": [ "name" ] }, "singlesend_schedule": { "title": "singlesend-schedule", "type": "object", "properties": { "send_at": { "type": "string", "format": "date-time", "description": "This is the ISO 8601 time at which to send the Single Send; must be in future, or the string \"now\"" }, "status": { "type": "string", "enum": [ "draft", "scheduled", "triggered" ] } }, "required": [ "send_at" ] }, "singlesend_warning": { "title": "singlesend_warning", "type": "object", "properties": { "warnings": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" }, "warning_id": { "type": "string" } } } } } }, "to_email_array": { "title": "To Email Array", "type": "array", "items": { "type": "object", "properties": { "email": { "type": "string", "format": "email", "description": "The intended recipient's email address." }, "name": { "type": "string", "description": "The intended recipient's name." } }, "required": [ "email" ] }, "example": [ { "email": "john_doe@example.com", "name": "John Doe" } ] }, "event-webhook-update-oauth-request": { "title": "Webhooks: Event Webhook Update with OAuth Request", "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if the event webhook is enabled." }, "url": { "type": "string", "description": "The URL that you want the event webhook to POST to." }, "group_resubscribe": { "type": "boolean", "description": "Recipient resubscribes to specific group by updating preferences. You need to enable Subscription Tracking for getting this type of event." }, "delivered": { "type": "boolean", "description": "Message has been successfully delivered to the receiving server." }, "group_unsubscribe": { "type": "boolean", "description": "Recipient unsubscribe from specific group, by either direct link or updating preferences. You need to enable Subscription Tracking for getting this type of event." }, "spam_report": { "type": "boolean", "description": "Recipient marked a message as spam." }, "bounce": { "type": "boolean", "description": "Receiving server could not or would not accept message." }, "deferred": { "type": "boolean", "description": "Recipient's email server temporarily rejected message." }, "unsubscribe": { "type": "boolean", "description": "Recipient clicked on message's subscription management link. You need to enable Subscription Tracking for getting this type of event." }, "processed": { "type": "boolean", "description": "Message has been received and is ready to be delivered." }, "open": { "type": "boolean", "description": "Recipient has opened the HTML message. You need to enable Open Tracking for getting this type of event." }, "click": { "type": "boolean", "description": "Recipient clicked on a link within the message. You need to enable Click Tracking for getting this type of event." }, "dropped": { "type": "boolean", "description": "You may see the following drop reasons: Invalid SMTPAPI header, Spam Content (if spam checker app enabled), Unsubscribed Address, Bounced Address, Spam Reporting Address, Invalid, Recipient List over Package Quota" }, "oauth_client_id": { "type": "string", "description": "The client ID Twilio SendGrid sends to your OAuth server or service provider to generate an OAuth access token. When passing data in this field, you must also include the oauth_token_url field." }, "oauth_client_secret": { "type": "string", "description": "This secret is needed only once to create an access token. SendGrid will store this secret, allowing you to update your Client ID and Token URL without passing the secret to SendGrid again. When passing data in this field, you must also include the oauth_client_id and oauth_token_url fields." }, "oauth_token_url": { "type": "string", "description": "The URL where Twilio SendGrid sends the Client ID and Client Secret to generate an access token. This should be your OAuth server or service provider. When passing data in this field, you must also include the oauth_client_id field." } }, "required": [ "enabled", "url", "group_resubscribe", "delivered", "group_unsubscribe", "spam_report", "bounce", "deferred", "unsubscribe", "processed", "open", "click", "dropped" ] }, "webhooks-event-webhook-request": { "title": "Webhooks: Event Webhook Request", "type": "object", "properties": { "enabled": { "type": "boolean", "description": "Indicates if the event webhook is enabled." }, "url": { "type": "string", "description": "The URL that you want the event webhook to POST to." }, "group_resubscribe": { "type": "boolean", "description": "Recipient resubscribes to specific group by updating preferences. You need to enable Subscription Tracking for getting this type of event." }, "delivered": { "type": "boolean", "description": "Message has been successfully delivered to the receiving server." }, "group_unsubscribe": { "type": "boolean", "description": "Recipient unsubscribe from specific group, by either direct link or updating preferences. You need to enable Subscription Tracking for getting this type of event." }, "spam_report": { "type": "boolean", "description": "Recipient marked a message as spam." }, "bounce": { "type": "boolean", "description": "Receiving server could not or would not accept message." }, "deferred": { "type": "boolean", "description": "Recipient's email server temporarily rejected message." }, "unsubscribe": { "type": "boolean", "description": "Recipient clicked on message's subscription management link. You need to enable Subscription Tracking for getting this type of event." }, "processed": { "type": "boolean", "description": "Message has been received and is ready to be delivered." }, "open": { "type": "boolean", "description": "Recipient has opened the HTML message. You need to enable Open Tracking for getting this type of event." }, "click": { "type": "boolean", "description": "Recipient clicked on a link within the message. You need to enable Click Tracking for getting this type of event." }, "dropped": { "type": "boolean", "description": "You may see the following drop reasons: Invalid SMTPAPI header, Spam Content (if spam checker app enabled), Unsubscribed Address, Bounced Address, Spam Reporting Address, Invalid, Recipient List over Package Quota" }, "oauth_client_id": { "type": "string", "description": "The client ID Twilio SendGrid sends to your OAuth server or service provider to generate an OAuth access token. When passing data in this field, you must also include the oauth_token_url field." }, "oauth_token_url": { "type": "string", "description": "The URL where Twilio SendGrid sends the Client ID and Client Secret to generate an access token. This should be your OAuth server or service provider. When passing data in this field, you must also include the oauth_client_id field." } }, "required": [ "enabled", "url", "group_resubscribe", "delivered", "group_unsubscribe", "spam_report", "bounce", "deferred", "unsubscribe", "processed", "open", "click", "dropped" ] }, "reply_to_email_object": { "title": "Reply_to Email Object", "type": "object", "properties": { "email": { "type": "string", "format": "email", "description": "The email address where any replies or bounces will be returned." }, "name": { "type": "string", "description": "A name or title associated with the `reply_to` email address." } }, "required": [ "email" ], "example": { "email": "jane_doe@example.com", "name": "Jane Doe" } }, "automations-link-stats-response": { "title": "automations-link-stats-response", "type": "object", "properties": { "results": { "type": "array", "description": "", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "This is the URL of the link clicked. If `{{custom_fields}}` are part of the URL, they will be included.", "format": "uri" }, "url_location": { "type": "integer", "description": "This is the location of the link clicked in each Automation step. Links are located according to their position within the message; the topmost link has index `0`.", "minimum": 0 }, "step_id": { "type": "string", "description": "This is the ID of the step if the stats were requested to be grouped by `step_id`.", "format": "uuid" }, "clicks": { "type": "integer", "minimum": 1, "description": "The number of clicks on this particular link." } }, "required": [ "url", "step_id", "clicks" ] } }, "total_clicks": { "type": "integer" }, "_metadata": { "$ref": "#/definitions/link-tracking-metadata" } }, "required": [ "results", "total_clicks", "_metadata" ] }, "link-tracking-metadata": { "title": "link tracking metadata", "type": "object", "properties": { "prev": { "type": "string", "format": "uri", "description": "The URL of the previous page of results. If this field isn't present, you're at the start of the list." }, "self": { "type": "string", "format": "uri", "description": "The URL of the current page of results." }, "next": { "type": "string", "format": "uri", "description": "The URL of the next page of results. If this field isn't present, you're at the end of the list." }, "count": { "type": "number", "description": "The number of items in the entire list, i.e., across all pages." } } }, "singlesends-link-stats-response": { "title": "singlesends-link-stats-response", "type": "object", "properties": { "results": { "type": "array", "description": "This is the index of the link's location in the email contents.", "items": { "type": "object", "properties": { "url": { "type": "string", "description": "This is the URL of the link clicked. If `{{custom_fields}}` are part of the URL, they will be included.", "format": "uri" }, "url_location": { "type": "integer", "description": "This is the location of the link clicked in each Single Send A/B variation, or in the Single Send itself if there are no variations. Links are numbered from the top down; the topmost link is index `0`.", "minimum": 0 }, "ab_variation": { "type": "string", "description": "This is the A/B variation of the Single Send stat returned. It is set to `\"all\"` if the `ab_variation` query parameter was not set in the request and `group_by` doesn't contain `ab_variation`.", "format": "uuid" }, "ab_phase": { "type": "string", "description": "This is the A/B phase of the Single Send stat returned. If the `ab_phase` query parameter was not provided, it will return `\"all\"`.", "enum": [ "send", "test", "all" ] }, "clicks": { "type": "integer", "minimum": 1, "description": "the number of clicks on this particular link" } }, "required": [ "url", "ab_variation", "ab_phase", "clicks" ] } }, "_metadata": { "$ref": "#/definitions/link-tracking-metadata" }, "total_clicks": { "type": "integer" } }, "required": [ "results", "_metadata" ] }, "domain-authentication-200-response": { "title": "Domain Authentication 200 Response", "type": "array", "items": { "allOf": [ { "$ref": "#/definitions/authentication::domain" }, { "type": "object", "properties": { "subusers": { "type": "array", "items": { "type": "object", "properties": { "user_id": { "type": "integer", "description": "The ID of the subuser that this authenticated domain will be associated with." }, "username": { "type": "string", "description": "The username of the subuser that this authenticated domain is associated with." } } } }, "last_validation_attempt_at": { "type": "integer", "description": "A Unix epoch timestamp representing the last time of a validation attempt." } } } ] }, "example": [ { "id": 1, "user_id": 7, "subdomain": "mail", "domain": "example.com", "username": "jane@example.com", "ips": [ "192.168.1.1", "192.168.1.2" ], "custom_spf": true, "default": true, "legacy": false, "automatic_security": true, "valid": true, "dns": { "mail_cname": { "valid": true, "type": "cname", "host": "mail.example.com", "data": "u7.wl.sendgrid.net" }, "dkim1": { "valid": true, "type": "cname", "host": "s1._domainkey.example.com", "data": "s1._domainkey.u7.wl.sendgrid.net" }, "dkim2": { "valid": true, "type": "cname", "host": "s2._domainkey.example.com", "data": "s2._domainkey.u7.wl.sendgrid.net" } } }, { "id": 2, "user_id": 8, "subdomain": "new", "domain": "example2.com", "username": "john@example2.com", "ips": [], "custom_spf": false, "default": true, "legacy": false, "automatic_security": true, "valid": false, "dns": { "mail_cname": { "valid": false, "type": "mx", "host": "news.example2.com", "data": "sendgrid.net" }, "dkim1": { "valid": false, "type": "txt", "host": "example2.com", "data": "k=rsa; t=s; p=publicKey" }, "dkim2": { "valid": false, "type": "txt", "host": "example2.com", "data": "k=rsa; t=s p=publicKey" } } } ] }, "abtest_summary": { "title": "abTest_summary", "type": [ "object", "null" ], "properties": { "type": { "type": "string", "description": "What differs between the A/B tests", "enum": [ "subject", "content" ] }, "winner_criteria": { "type": "string", "description": "How the winner will be decided", "enum": [ "open", "click", "manual" ] }, "test_percentage": { "type": "integer", "description": "What percentage of your recipient will be included in your A/B testing" }, "duration": { "type": "string", "description": "How long the A/B Testing will last" }, "winning_template_id": { "type": "string", "description": "Winner of the A/B Test" }, "winner_selected_at": { "type": [ "string", "null" ], "description": "When the winner was selected" }, "expiration_date": { "type": [ "string", "null" ], "description": "Last day to select an A/B Test Winner" } }, "required": [ "type", "winner_criteria", "test_percentage", "duration", "winning_template_id", "winner_selected_at", "expiration_date" ] }, "singlesend_response_short": { "title": "singlesend_response_short", "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "name of the Single Send" }, "abtest": { "$ref": "#/definitions/abtest_summary" }, "status": { "type": "string", "enum": [ "draft", "scheduled", "triggered" ], "description": "current status of the Single Send" }, "categories": { "type": "array", "uniqueItems": true, "maxItems": 10, "description": "categories to associate with this Single Send", "items": { "type": "string" } }, "send_at": { "type": "string", "format": "date-time", "description": "the ISO 8601 time at which to send the Single Send; must be in future" }, "is_abtest": { "type": "boolean", "description": "true if the Single Send's AB Test functionality has been toggled on" }, "updated_at": { "type": "string", "description": "the ISO 8601 time at which the Single Send was last updated", "format": "date-time" }, "created_at": { "type": "string", "description": "the ISO 8601 time at which the Single Send was created", "format": "date-time" } }, "required": [ "id", "name", "abtest", "status", "categories", "is_abtest", "updated_at", "created_at" ] }, "cc_bcc_email_object": { "title": "CC BCC Email Object", "type": "object", "properties": { "email": { "type": "string", "format": "email", "description": "The intended recipient's email address." }, "name": { "type": "string", "description": "The intended recipient's name." } }, "required": [ "email" ], "example": { "email": "jane_doe@example.com", "name": "Jane Doe" } }, "verified-sender-request-schema": { "title": "Verified Sender Request Schema", "type": "object", "properties": { "nickname": { "type": "string", "maxLength": 100 }, "from_email": { "type": "string", "maxLength": 256, "format": "email" }, "from_name": { "type": "string", "maxLength": 256 }, "reply_to": { "type": "string", "maxLength": 256, "format": "email" }, "reply_to_name": { "type": "string", "maxLength": 256 }, "address": { "type": "string", "maxLength": 100 }, "address2": { "type": "string", "maxLength": 100 }, "state": { "type": "string", "maxLength": 2 }, "city": { "type": "string", "maxLength": 150 }, "zip": { "type": "string", "maxLength": 10 }, "country": { "type": "string", "maxLength": 100 } }, "required": [ "nickname", "from_email", "reply_to" ], "example": { "nickname": "Orders", "from_email": "orders@example.com", "from_name": "Example Orders", "reply_to": "orders@example.com", "reply_to_name": "Example Orders", "address": "1234 Fake St", "address2": "PO Box 1234", "state": "CA", "city": "San Francisco", "country": "USA", "zip": "94105" } }, "verified-sender-response-schema": { "title": "Verified Sender Response Schema", "type": "object", "properties": { "id": { "type": "integer" }, "nickname": { "type": "string" }, "from_email": { "type": "string" }, "from_name": { "type": "string" }, "reply_to": { "type": "string" }, "reply_to_name": { "type": "string" }, "address": { "type": "string" }, "address2": { "type": "string" }, "state": { "type": "string" }, "city": { "type": "string" }, "zip": { "type": "string" }, "country": { "type": "string" }, "verified": { "type": "boolean" }, "locked": { "type": "boolean" } }, "example": { "id": 1234, "nickname": "Example Orders", "from_email": "orders@example.com", "from_name": "Example Orders", "reply_to": "orders@example.com", "reply_to_name": "Example Orders", "address": "1234 Fake St.", "address2": "PO Box 1234", "state": "CA", "city": "San Francisco", "country": "USA", "zip": "94105", "verified": true, "locked": false } }, "ip-access-response": { "title": "IP Access Response", "type": "object", "properties": { "result": { "type": "array", "description": "An array listing all of your allowed IPs.", "items": { "type": "object", "properties": { "id": { "type": "integer", "description": "The ID of the allowed IP." }, "ip": { "type": "string", "description": "The allowed IP." }, "created_at": { "type": "integer", "description": "A Unix timestamp indicating when the IP was added to the allow list." }, "updated_at": { "type": "integer", "description": "A Unix timestamp indicating when the IPs allow status was most recently updated." } } } } }, "example": { "result": [ { "id": 1, "ip": "192.168.1.1/32", "created_at": 1441824715, "updated_at": 1441824715 }, { "id": 2, "ip": "192.0.0.0/8", "created_at": 1441824715, "updated_at": 1441824715 }, { "id": 3, "ip": "192.168.1.3/32", "created_at": 1441824715, "updated_at": 1441824715 } ] } }, "stats-advanced-global-stats": { "title": "Stats: Advanced Global Stats", "allOf": [ { "$ref": "#/definitions/advanced_stats_clicks_opens" }, { "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." }, "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." }, "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." }, "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." } } } ] }, "stats-advanced-stats-base-schema": { "title": "Stats: Advanced Stats Base Schema", "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "description": "The date the stats were gathered." }, "stats": { "type": "array", "description": "The individual email activity stats.", "items": { "type": "object", "properties": { "metrics": { "type": "object" } } } } } } }, "full-segment": { "title": "full_segment", "allOf": [ { "$ref": "#/definitions/segment_summary" }, { "type": "object", "properties": { "contacts_sample": { "type": "array", "items": { "$ref": "#/definitions/contact_response" } }, "query_json": { "type": "object", "description": "AST representation of the query DSL" } }, "required": [ "contacts_sample" ] }, { "$ref": "#/definitions/segment_write_v2" } ], "example": { "id": "58567a46-305e-48d1-b4f8-a006c906920e", "contacts_count": 9266921, "created_at": "2085-08-08T21:07:05.692Z", "sample_updated_at": "3407-09-25T04:25:02.140Z", "updated_at": "4431-05-07T22:23:22.352Z", "contacts_sample": [ { "contact_id": "c1183ada-b784-49ac-9b1f-50e73578a6dc", "primary_email": "ft88@d.izxx", "alternate_emails": [ "yKDUP11FDch@QoU.vwy", "ZNSN5@czAMqPi.at", "7wr51kFVVKlcBSH@DWxOueOZepetzBrku.qosk", "iib-ObtO7Fxz5@vLJPRIFKPOqJGCEqcIDab.ypn" ], "first_name": "est", "last_name": "eiusmod in laboris velit cupidatat", "address_line_1": "sunt aliqua", "address_line_2": "sit proident Lorem veniam labore", "city": "œȎţȸÛ\tč\u000bCŁ", "state_province_region": "ut proident", "postal_code": 30296612, "country": "do reprehenderit qui", "custom_fields": { "custom_field_name2": "in consectetur ut aliqua sint", "custom_field_name1": "esse" } } ], "name": "culpa", "query_dsl": "cillum eiusmod", "parent_list_id": "2357714d-3d82-4c80-826c-b44a4147f81c", "next_sample_update": "" } }, "senders-id-request-body": { "title": "Senders ID Request Body", "type": "object", "properties": { "nickname": { "type": "string", "description": "A nickname for the sender identity. Not used for sending." }, "from": { "type": "object", "required": [ "email", "name" ], "properties": { "email": { "type": "string", "description": "This is where the email will appear to originate from for your recipient" }, "name": { "type": "string", "description": "This is the name appended to the from email field. IE - Your name or company name." } } }, "reply_to": { "type": "object", "properties": { "email": { "type": "string", "description": "This is the email that your recipient will reply to." }, "name": { "type": "string", "description": "This is the name appended to the reply to email field. IE - Your name or company name." } }, "required": [ "email" ] }, "address": { "type": "string", "description": "The physical address of the sender identity." }, "address_2": { "type": "string", "description": "Additional sender identity address information." }, "city": { "type": "string", "description": "The city of the sender identity." }, "state": { "type": "string", "description": "The state of the sender identity." }, "zip": { "type": "string", "description": "The zipcode of the sender identity." }, "country": { "type": "string", "description": "The country of the sender identity." } }, "required": [ "nickname", "from", "address", "city", "country" ] }, "enforced-tls-request-response": { "title": "Enforced TLS Request Response", "type": "object", "properties": { "require_tls": { "type": "boolean", "description": "Indicates if you want to require your recipients to support TLS. " }, "require_valid_cert": { "type": "boolean", "description": "Indicates if you want to require your recipients to have a valid certificate." } }, "example": { "require_tls": true, "require_valid_cert": true } }, "singlesend_response": { "title": "singlesend_response", "allOf": [ { "$ref": "#/definitions/singlesend_request" }, { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": [ "draft", "scheduled", "triggered" ], "description": "current status of the Single Send" }, "updated_at": { "type": "string", "description": "the ISO 8601 time at which the Single Send was last updated", "format": "date-time" }, "created_at": { "type": "string", "description": "the ISO 8601 time at which the Single Send was created", "format": "date-time" }, "warnings": { "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": "string" }, "warning_id": { "type": "string" } } } } }, "required": [ "id", "status", "created_at" ] } ], "example": { "name": "Example API Created Single Send", "id": "27c21bbf-a12c-440b-b8bf-c526975328ca", "status": "scheduled", "created_at": "2020-05-18T17:28:27.272Z", "send_at": "2020-06-16T00:19:55.106Z", "categories": [ "unique opens" ], "email_config": { "subject": "", "html_content": "", "plain_content": "", "generate_plain_content": true, "editor": "code", "suppression_group_id": null, "custom_unsubscribe_url": null, "sender_id": null, "ip_pool": null }, "send_to": { "list_ids": [ "f2fe66a1-43f3-4e3a-87b1-c6a600d805f0" ] } } }, "design-common-fields": { "title": "Design Common Fields", "allOf": [ { "$ref": "#/definitions/design-duplicate-input" }, { "type": "object", "properties": { "generate_plain_content": { "type": "boolean", "description": "If true, plain_content is always generated from html_content. If false, plain_content is not altered.", "default": true }, "subject": { "type": "string", "description": "Subject of the Design.", "maxLength": 5000 }, "categories": { "type": "array", "description": "The list of categories applied to the design", "uniqueItems": true, "maxItems": 10, "items": { "type": "string", "maxLength": 255 } } } } ] }, "invalid-email": { "title": "Invalid Email", "type": "object", "properties": { "created": { "type": "integer", "description": "A Unix timestamp indicating when the email address was added to the invalid emails list." }, "email": { "type": "string", "description": "The email address that was marked as invalid.", "format": "email" }, "reason": { "type": "string", "description": "The reason that the email address was marked as invalid." } }, "example": { "created": 1620141015, "email": "invalid@example.com", "reason": "Mail domain mentioned in email address is unknown" } }, "email-activity-response-common-fields": { "title": "Email Activity Response Common Fields", "type": "object", "properties": { "from_email": { "type": "string", "format": "email", "default": "", "description": "The 'From' email address used to deliver the message. This address should be a verified sender in your Twilio SendGrid account." }, "msg_id": { "type": "string", "description": "A unique ID assigned to the message. This ID can be used to retrieve activity data for the specific message." }, "subject": { "type": "string", "description": "The email's subject line." }, "to_email": { "type": "string", "format": "email", "description": "The intended recipient's email address." }, "status": { "type": "string", "description": "The message's status.", "enum": [ "processed", "delivered", "not delivered" ] } } }, "suppressions-request": { "title": "Suppressions Request Body", "type": "object", "properties": { "recipient_emails": { "type": "array", "description": "The array of email addresses to add or find.", "items": { "type": "string", "format": "email" } } }, "required": [ "recipient_emails" ], "example": { "recipient_emails": [ "test1@example.com", "test2@example.com" ] } }, "suppression-group-request-base": { "title": "Suppression Group Request Base", "type": "object", "properties": { "name": { "type": "string", "description": "The name of your suppression group. Required when creating a group.", "maxLength": 30 }, "description": { "type": "string", "description": "A brief description of your suppression group. Required when creating a group.", "maxLength": 100 }, "is_default": { "type": "boolean", "description": "Indicates if you would like this to be your default suppression group." } } }, "sso-certificate-body": { "title": "Single Sign-On Certificate Body", "type": "object", "properties": { "public_certificate": { "type": "string", "description": "This certificate is used by Twilio SendGrid to verify that SAML requests are coming from Okta. This is called the X509 certificate in the Twilio SendGrid UI." }, "id": { "type": "number", "description": "A unique ID assigned to the certificate by SendGrid." }, "not_before": { "type": "number", "description": "A unix timestamp (e.g., 1603915954) that indicates the time before which the certificate is not valid." }, "not_after": { "type": "number", "description": "A unix timestamp (e.g., 1603915954) that indicates the time after which the certificate is no longer valid." }, "intergration_id": { "type": "string", "description": "An ID that matches a certificate to a specific IdP integration." } }, "example": { "public_certificate": "", "id": 66138975, "not_before": 1621289880, "not_after": 1621289880, "intergration_id": "b0b98502-9408-4b24-9e3d-31ed7cb15312" } }, "sso-integration": { "title": "Single Sign-On Integration", "allOf": [ { "$ref": "#/definitions/create-integration-request" }, { "type": "object", "properties": { "last_updated": { "type": "number", "description": "A timestamp representing the last time the configuration was modified." }, "id": { "type": "string", "description": "A unique ID assigned to the configuration by SendGrid." }, "single_signon_url": { "type": "string", "description": "The URL where your IdP should POST its SAML response. This is the Twilio SendGrid URL that is responsible for receiving and parsing a SAML assertion. This is the same URL as the Audience URL when using SendGrid." }, "audience_url": { "type": "string", "description": "The URL where your IdP should POST its SAML response. This is the Twilio SendGrid URL that is responsible for receiving and parsing a SAML assertion. This is the same URL as the Single Sign-On URL when using SendGrid." } }, "required": [ "last_updated" ] } ] }, "create-integration-request": { "title": "Create Integration Request", "type": "object", "properties": { "name": { "type": "string", "description": "The name of your integration. This name can be anything that makes sense for your organization (eg. Twilio SendGrid)" }, "enabled": { "type": "boolean", "description": "Indicates if the integration is enabled." }, "signin_url": { "type": "string", "description": "The IdP's SAML POST endpoint. This endpoint should receive requests and initiate an SSO login flow. This is called the \"Embed Link\" in the Twilio SendGrid UI." }, "signout_url": { "type": "string", "description": "This URL is relevant only for an IdP-initiated authentication flow. If a user authenticates from their IdP, this URL will return them to their IdP when logging out." }, "entity_id": { "type": "string", "description": "An identifier provided by your IdP to identify Twilio SendGrid in the SAML interaction. This is called the \"SAML Issuer ID\" in the Twilio SendGrid UI." }, "completed_integration": { "type": "boolean", "description": "Indicates if the integration is complete." } }, "required": [ "name", "enabled", "signin_url", "signout_url", "entity_id" ] }, "sso-teammate-response": { "title": "Single Sign-On Teammate Response", "allOf": [ { "$ref": "#/definitions/sso-teammate-common-fields" }, { "type": "object", "properties": { "username": { "type": "string", "description": "This should be set to the Teammate's email address." }, "is_sso": { "type": "boolean", "description": "Indicates if the Teammate authenticates with SendGrid using SSO or with a username and password." } } } ] }, "sso-teammate-request": { "title": "Single Sign-On Teammate Request", "allOf": [ { "$ref": "#/definitions/sso-teammate-common-fields" }, { "type": "object", "properties": { "scopes": { "type": "array", "description": "The permission scopes assigned to the Teammate.", "items": { "type": "string" } } }, "required": [ "scopes" ] } ] }, "sso-teammates-patch-response": { "title": "Single Sign-On Teammates PATCH Response", "allOf": [ { "$ref": "#/definitions/sso-teammate-response" }, { "type": "object", "properties": { "address": { "type": "string", "description": "The Teammate’s street address." }, "address2": { "type": "string", "description": "The Teammate’s apartment number, suite number, or other secondary address information that is not part of the physical street address." }, "city": { "type": "string", "description": "The Teammate's city." }, "company": { "type": "string", "description": "The Teammate’s company name." }, "country": { "type": "string", "description": "The Teammate’s country of residence." }, "email": { "type": "string", "format": "email" }, "phone": { "type": "string", "description": "The Teammate’s stored phone number." }, "scopes": { "type": "array", "description": "The permission scopes assigned to the Teammate.", "items": { "type": "string" } }, "state": { "type": "string", "description": "The Teammate’s state or province." }, "user_type": { "type": "string", "description": "A Teammate can be an “admin,” “owner,” or “teammate.” Each role is associated with the scope of the Teammate’s permissions.", "enum": [ "admin", "owner", "teammate" ] }, "website": { "type": "string", "description": "A website associated with the Teammate" }, "zip": { "type": "string", "description": "The Teammate’s zip code." } } } ] }, "sso-error-response": { "title": "SSO Error Response", "type": "array", "items": { "type": "object", "properties": { "message": { "type": "string" }, "field": { "type": [ "string", "null" ] }, "error_id": { "type": "string" } } } }, "click-tracking": { "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 } }, "sso-teammate-common-fields": { "title": "Single Sing-On Teammate Common Fields", "type": "object", "properties": { "first_name": { "type": "string", "description": "The Teammate’s first name." }, "last_name": { "type": "string", "description": "The Teammate’s last name." }, "email": { "type": "string", "format": "email", "description": "The Teammate’s email address. This email address will also function as the Teammate’s username and must match the address assigned to the user in your IdP. This address cannot be changed after the Teammate is created." }, "is_admin": { "type": "boolean", "description": "Indicates if the Teammate has admin permissions." }, "is_read_only": { "type": "boolean", "description": "Indicates if the Teammate has read_only permissions." } }, "required": [ "first_name", "last_name", "email" ] }, "spam-reports-response": { "title": "Spam Reports Response", "type": "array", "items": { "type": "object", "properties": { "created": { "type": "integer", "description": "A Unix timestamp that indicates when the recipient marked your message as spam." }, "email": { "type": "string", "description": "The email address of the recipient that marked your message as spam.", "format": "email" }, "ip": { "type": "string", "description": "The IP address that the message was sent from." } }, "required": [ "created", "email", "ip" ] }, "example": [ { "created": 1443651141, "email": "user1@example.com", "ip": "10.63.202.100" }, { "created": 1443651154, "email": "user2@example.com", "ip": "10.63.202.100" } ] }, "blocks-response": { "title": "Blocks Response", "type": "array", "items": { "type": "object", "properties": { "created": { "type": "integer", "description": "A Unix timestamp indicating when the email address was added to the blocks list." }, "email": { "type": "string", "description": "The email address that was added to the block list.", "format": "email" }, "reason": { "type": "string", "description": "An explanation for the reason of the block." }, "status": { "type": "string", "description": "The status of the block." } }, "required": [ "created", "email", "reason", "status" ] }, "example": [ { "created": 1443651154, "email": "example@example.com", "reason": "error dialing remote address: dial tcp 10.57.152.165:25: no route to host", "status": "4.0.0" } ] }, "ip_pool_response": { "title": "IP Pools: Pool Resp", "type": "object", "properties": { "name": { "type": "string", "description": "The name of the IP pool." } }, "example": { "name": "sunt sint enim" } }, "sender-id-request": { "title": "Sender ID Request", "type": "object", "properties": { "nickname": { "type": "string", "description": "A nickname for the sender identity. Not used for sending." }, "from": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address from which your recipient will receive emails." }, "name": { "type": "string", "description": "The name appended to the from email field. Typically your name or company name." } } }, "reply_to": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address to which your recipient will reply." }, "name": { "type": "string", "description": "The name appended to the reply to email field. Typically your name or company name." } } }, "address": { "type": "string", "description": "The physical address of the sender identity." }, "address_2": { "type": "string", "description": "Additional sender identity address information." }, "city": { "type": "string", "description": "The city of the sender identity." }, "state": { "type": "string", "description": "The state of the sender identity." }, "zip": { "type": "string", "description": "The zipcode of the sender identity." }, "country": { "type": "string", "description": "The country of the sender identity." } }, "example": { "nickname": "My Sender ID", "from": { "email": "from@example.com", "name": "Example INC" }, "reply_to": { "email": "replyto@example.com", "name": "Example INC" }, "address": "123 Elm St.", "address_2": "Apt. 456", "city": "Denver", "state": "Colorado", "zip": "80202", "country": "United States" } }, "segment_status_response": { "title": "segment_status_response", "type": "object", "description": "Segment status indicates whether the segment's contacts will be updated periodically", "properties": { "query_validation": { "type": "string", "description": "Status of query validation. PENDING, VALID, or INVALID" }, "error_message": { "type": "string", "description": "Describes any errors that were encountered during query validation" } }, "required": [ "query_validation" ] }, "all_segments_response": { "title": "all_segments_response", "type": "object", "properties": { "id": { "type": "string", "minLength": 36, "maxLength": 36, "format": "uuid", "description": "ID assigned to the segment when created." }, "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "Name of the segment." }, "contacts_count": { "type": "integer", "description": "Total number of contacts present in the segment" }, "created_at": { "type": "string", "description": "ISO8601 timestamp of when the object was created" }, "updated_at": { "type": "string", "description": "ISO8601 timestamp of when the object was last updated" }, "sample_updated_at": { "type": "string", "description": "ISO8601 timestamp of when the samples were last updated" }, "next_sample_update": { "type": "string", "description": "ISO8601 timestamp of when the samples will be next updated" }, "parent_list_ids": { "type": "array", "description": "The array of list ids to filter contacts on when building this segment. It allows only one such list id for now. We will support more in future", "uniqueItems": true, "items": { "type": "string" } }, "query_version": { "type": "string", "description": "If not set, segment contains a query for use with Segment v1 APIs. If set to '2', segment contains a SQL query for use in v2." }, "_metadata": { "$ref": "#/definitions/_metadata" }, "status": { "$ref": "#/definitions/segment_status_response" } }, "required": [ "id", "name", "contacts_count", "created_at", "updated_at", "sample_updated_at", "next_sample_update", "parent_list_ids", "query_version", "status" ] }, "segment_summary_v2": { "title": "segment_summary", "type": "object", "description": "", "properties": { "results": { "type": "array", "items": { "$ref": "#/definitions/segment_summary" } } } }, "segment_response": { "title": "segment_response", "type": "object", "properties": { "id": { "type": "string", "minLength": 36, "maxLength": 36, "format": "uuid", "description": "ID assigned to the segment when created." }, "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "Name of the segment." }, "query_dsl": { "type": "string", "description": "SQL query which will filter contacts based on the conditions provided" }, "contacts_count": { "type": "integer", "description": "Total number of contacts present in the segment" }, "contacts_sample": { "type": "array", "description": "A subset of all contacts that are in this segment", "items": { "$ref": "#/definitions/contact_response" } }, "created_at": { "type": "string", "description": "ISO8601 timestamp of when the object was created" }, "updated_at": { "type": "string", "description": "ISO8601 timestamp of when the object was last updated" }, "sample_updated_at": { "type": "string", "description": "ISO8601 timestamp of when the samples were last updated" }, "next_sample_update": { "type": "string", "description": "ISO8601 timestamp of when the samples will be next updated" }, "parent_list_ids": { "type": "array", "description": "The array of list ids to filter contacts on when building this segment. It allows only one such list id for now. We will support more in future", "uniqueItems": true, "items": { "type": "string" } }, "query_version": { "type": "string", "description": "If not set, segment contains a Query for use with Segment v1 APIs. If set to '2', segment contains a SQL query for use in v2." }, "status": { "$ref": "#/definitions/segment_status_response" } }, "required": [ "id", "name", "query_dsl", "contacts_count", "contacts_sample", "created_at", "updated_at", "sample_updated_at", "next_sample_update", "parent_list_ids", "query_version", "status" ] }, "errors-seg-v2": { "title": "errors-seg", "type": "object", "description": "If the request is incorrect, an array of errors will be returned.", "properties": { "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string", "description": "the field in the request body that is incorrect" }, "message": { "type": "string", "description": "a description of what is specifically wrong with the field passed in the request" } }, "required": [ "field", "message" ] } } }, "required": [ "errors" ] }, "segment_write_v2": { "title": "segment_write", "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "Name of the segment." }, "parent_list_ids": { "type": "array", "description": "The array of list ids to filter contacts on when building this segment. It allows only one such list id for now. We will support more in future", "uniqueItems": true, "items": { "type": "string" } }, "query_dsl": { "type": "string", "description": "SQL query which will filter contacts based on the conditions provided" } }, "required": [ "name", "query_dsl" ] }, "segment_update": { "title": "segment_update", "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "Name of the segment." }, "query_dsl": { "type": "string", "description": "SQL query which will filter contacts based on the conditions provided" } } }, "abbv-message": { "title": "Abbv. Message", "type": "object", "properties": { "from_email": { "type": "string" }, "msg_id": { "type": "string" }, "subject": { "type": "string" }, "to_email": { "type": "string" }, "status": { "type": "string", "enum": [ "processed", "delivered", "not_delivered" ] }, "opens_count": { "type": "integer" }, "clicks_count": { "type": "integer" }, "last_event_time": { "type": "string", "description": "iso 8601 format" } }, "required": [ "from_email", "msg_id", "subject", "to_email", "status", "opens_count", "clicks_count", "last_event_time" ], "example": { "from_email": "from@test.com", "msg_id": "abc123", "subject": "anim Duis sint veniam", "to_email": "test@test.com", "status": "processed", "opens_count": 1, "clicks_count": 2, "last_event_time": "2017-10-13T18:56:21Z" } }, "message": { "title": "Message", "type": "object", "properties": { "from_email": { "type": "string", "pattern": "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b" }, "msg_id": { "type": "string", "minLength": 5, "maxLength": 50, "pattern": "^[A-Za-z0-9]+" }, "subject": { "type": "string", "minLength": 3, "maxLength": 255 }, "to_email": { "type": "string", "pattern": "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b" }, "status": { "type": "string", "description": "Quick summary of the status of a message", "enum": [ "processed", "not delivered", "delivered" ] }, "template_id": { "type": "string", "format": "uuid" }, "asm_group_id": { "type": "integer", "minimum": 1 }, "teammate": { "type": "string", "description": "Teammate's username", "minLength": 0, "maxLength": 64, "pattern": "^$|^[A-Za-z0-9]+" }, "api_key_id": { "type": "string", "minLength": 3, "maxLength": 50, "pattern": "^[A-Za-z0-9]+" }, "events": { "type": "array", "description": "List of events related to email message", "items": { "title": "Event", "type": "object", "properties": { "event_name": { "type": "string", "description": "Name of event", "enum": [ "bounced", "opened", "clicked", "processed", "dropped", "delivered", "deferred", "spam_report", "unsubscribe", "group_unsubscribe", "group_resubscribe" ] }, "processed": { "description": "Date of when event occurred", "type": "string" }, "reason": { "type": "string", "description": "Explanation of what caused \"bounced\", \"deferred\", or \"blocked\". Usually contains error message from the server - e.g. message from gmail why mail was deferred", "maxLength": 1024 }, "attempt_num": { "type": "integer", "description": "Used with \"deferred\" events to indicate the attempt number out of 10. One \"deferred\" entry will exists under events array for each time a message was deferred with error message from the server. ", "minimum": 1, "maximum": 10 }, "url": { "type": "string", "description": "Used with \"clicked\" event to indicate which url the user clicked.", "pattern": "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$" }, "bounce_type": { "type": "string", "description": "Use to distinguish between types of bounces", "enum": [ "bounced", "blocked", "expired" ] }, "http_user_agent": { "type": "string", "description": "Client recipient used to click or open message" }, "mx_server": { "type": "string", "description": "For example mx.gmail.com" } }, "required": [ "event_name", "processed", "url", "bounce_type", "http_user_agent", "mx_server" ], "example": { "event_name": "bounced", "processed": "2017-10-13T18:56:21Z", "reason": "some reason", "url": "http://3LX,MU}N=B8'd,K}>bEma{l~!ad%peIF}y>qHfLPWQ$l9b\\!6.1H?$Z9H\"il-_gZD>/JPYsGqH4x4_3v090TCtnFalXGFiAdooDxgrDAYNXShUywSxwYr8gKeyc/4sal4VJ3IxEWsG74V5MYQ0mz27jhy7n5DHsUtApQ6zXHS13uO5vYBlJHpJRfuT6/F5nIpkHre2w3eTtN7M6pg9V5stjnnsavKkzQxyTv15CMSDLFwR_BTZwofhWpyBU7B9ypYL79vT97N3LDZyoaM/fNsOLPIqfGBer_Mx9_StergbQYANyOmOSjR6pZof01ky/ZcNDhpu3CkSl4MTtQ3NMCX780pOKQ5SYIPigyvz9IC9WtrCNcOkTxdOPdY0_4MJU4EuTTPmGvO/14KaJCDjIjgrbIqpzuUEL5mET0t2VeVlwvtnOnlHaBE8sic20ze2E0Xt3ETqXyzVJRjLDKh/LWkW8OVp_xkLBCCW7LQngRukKcOiWjMXeCEhYI9HoZ0RsMEWZC8KzRaHc4OI0uXPD4M9pav1LGrI/_0t_RnBnfnqGKsBJr0kdQi/Y6QN_aeawIqX5hDNIU3MF/wWKVWLS0ZFbDfK6KVv5oAid83EpwKoazAMA8MTfEXvHQLO7k7XYWX1Il3eGXL6/wCA96I1SOabzJkZHo2HsFpIC/VBk52Lnpp0xtDH/OCdlQ5e4PpxXQeklp70LPOndr7QKSYEQNUc48n36ixvTjhgpgO8wHsFFYqGcuBMHg9oaCARppQomiQDWYuVPVDynJHdsM1_gWl4/NSs8Y9PL7DrQXOu0UiFRRE0TUsvgqyUgJzlGjUnRziyYeROO75D0K_3aTtbGbCmhaxecos40a1w0PDCNkFp1W/iHwY7922drhsoM6ShwqqwGpAh5HLuU6Q5gqyckeai6YN7HCh9DdHPhhJcatgtMHZDKfQUBVt9ecUlDgiCFF_OnRX/GpzttcsL8E2FoXL9_eAWvSqjodROqx7MZCA/ORdnR/IssPCYP1kTHTIL5mZxv4UGEpyNjUzt4GdSJJTm0nztltWDYX8_Ezl2JvpLVnGVTJxobb4yQIJhe3n64khbOFyFLKHWEniIolm/AxpZQYmseWlVqrIz3YXU59XaSbTTrdCHNhvwF1ogXiiggN6TZ2B3QY_mBEtAp/SD0ONPVqEUkTNAFWTgnnlv6ZIMdMbTw5uZwtFRlB7qDvQouml9kujGmRu6k7zZMTOwWowRNtpboLUcL2NzkVgK6N1Zi2vq/Nt4NJvM5_l1dpIIbwJv_CIcZQZOqPtRWULa2iVxfmJJQaqgLQPwSHQH1zuRJMhraEsPjqVQRC0pZpSt/24VBDN8y31Ye/y_ekWxMdZCvr978C/WrdcTi29kxjJLyT9BII7BsgT5vLuI2l7ntqRAhAUWMs/h9JR0i8RbX5OfB46q41/TfmSdgi97bCR2HfgflyypXwKhRfKYU2MVpu2Dd90WQUlm7hZV8dSfGusuMj/nPMpRVWcbnvlAdsehJCPbLv6n4qdLSPeoMBo32acAGgu1BwBG8JsBgbH43yYi5X7UdGRWKqm_ZbqaDEKH3ncU/uA8EOJb41VfGho4LUeOi1IeYwVAhFEyO6YbteYZecEubrNFZrWWjZUqhzouzY95TeWU8E4StCXVPKlYPiFiwUSX20kG0lVtDbAy/7u4f4x0cYlFOvI1UN1qoOExmNxnxzQQFeM5exWfW2JrRXq5e0UdAJr4q2o9Y_0WaGfhL/nP6Ei06YajDKr11dK5H0LX/9CGTC37HFZeopyopzP_7fvGFkqIRoGTS48pLaIFz3gwpQNlWXUFCsd/PnRlsqJ3SBQSgp_AQe2cP6iBNy2bJI8lkxwY5YVDDdjxusuCcafdjfs2aUa/4tr_iMnNBnd27GxjQI28_JGJlfbOaajVJOxuPMT4ELpYCfPiFjdSbJyE0/gCwtj0rgDKSLWJnOPJ5TAJ935gCqeIsBhOhfcZX413GdilBZRRYEjCVKfOuWzHZ3GW/8yjyk5e_WMNv5F6xggl07w90DBwpx/Q/iWfncqMuSfoeFeqHQkDL9F5W19j1cGuAcyfIYMAXztHXpgTKh9vZcsLYC7LcgKr4FQj3JjEvtnDG2PjcMjGF/MnbCRCz22Ho410_vE9M1Hpq0wdk_i5DbZKNoSwlPgey9URkpuX146TcDdsx_VWDenCepY5HwMr9CPOY9hzUs/c5AWeUMXk/gvsI81Jkv5rHpEnNBUZXYzfqkwQfffhmrc/StLCtzRRlja8dpsEWdkzoKR9Kdxq1qAs5f0sdrGjVRLTT_s1Q2P59zhA/QmS4bubi64cYot3gSIgdNnkjA2GjCp1ETVa548_U9B6boTKDVmaKJlVIDvqL84RC3WI7Er/8opi2lZ48W83Ur47BRh38oOnI0agrCyZz8bp1w_gfVRlSO8PS0i/l_/qxq5xpLbhPkdxVoyZVsNAZchfnmkIHyIk5IK6EUDXdMR21y6OvKW50ZbooAtk9ymynBj4dAYMsd25RV7FE1I1vRTsiDw52/.E5WC0Ymo2zn.qelSbhzr-4laArYiWP.dwJB6qm_6rs0Rm5UXYaYtUNbh76_jJp_X1xQUCDSgbr2KOkDU0\"Q/-4dV\"Yk3QGg[(O86=Pf\"e17K4'r{)kicofHSXcMmP@>VF^`~4j4F*L/1]tD+Lw!WI!@]*OZm6C`M$u96}*ObEma{l~!ad%peIF}y>qHfLPWQ$l9b\\!6.1H?$Z9H\"il-_gZD>/JPYsGqH4x4_3v090TCtnFalXGFiAdooDxgrDAYNXShUywSxwYr8gKeyc/4sal4VJ3IxEWsG74V5MYQ0mz27jhy7n5DHsUtApQ6zXHS13uO5vYBlJHpJRfuT6/F5nIpkHre2w3eTtN7M6pg9V5stjnnsavKkzQxyTv15CMSDLFwR_BTZwofhWpyBU7B9ypYL79vT97N3LDZyoaM/fNsOLPIqfGBer_Mx9_StergbQYANyOmOSjR6pZof01ky/ZcNDhpu3CkSl4MTtQ3NMCX780pOKQ5SYIPigyvz9IC9WtrCNcOkTxdOPdY0_4MJU4EuTTPmGvO/14KaJCDjIjgrbIqpzuUEL5mET0t2VeVlwvtnOnlHaBE8sic20ze2E0Xt3ETqXyzVJRjLDKh/LWkW8OVp_xkLBCCW7LQngRukKcOiWjMXeCEhYI9HoZ0RsMEWZC8KzRaHc4OI0uXPD4M9pav1LGrI/_0t_RnBnfnqGKsBJr0kdQi/Y6QN_aeawIqX5hDNIU3MF/wWKVWLS0ZFbDfK6KVv5oAid83EpwKoazAMA8MTfEXvHQLO7k7XYWX1Il3eGXL6/wCA96I1SOabzJkZHo2HsFpIC/VBk52Lnpp0xtDH/OCdlQ5e4PpxXQeklp70LPOndr7QKSYEQNUc48n36ixvTjhgpgO8wHsFFYqGcuBMHg9oaCARppQomiQDWYuVPVDynJHdsM1_gWl4/NSs8Y9PL7DrQXOu0UiFRRE0TUsvgqyUgJzlGjUnRziyYeROO75D0K_3aTtbGbCmhaxecos40a1w0PDCNkFp1W/iHwY7922drhsoM6ShwqqwGpAh5HLuU6Q5gqyckeai6YN7HCh9DdHPhhJcatgtMHZDKfQUBVt9ecUlDgiCFF_OnRX/GpzttcsL8E2FoXL9_eAWvSqjodROqx7MZCA/ORdnR/IssPCYP1kTHTIL5mZxv4UGEpyNjUzt4GdSJJTm0nztltWDYX8_Ezl2JvpLVnGVTJxobb4yQIJhe3n64khbOFyFLKHWEniIolm/AxpZQYmseWlVqrIz3YXU59XaSbTTrdCHNhvwF1ogXiiggN6TZ2B3QY_mBEtAp/SD0ONPVqEUkTNAFWTgnnlv6ZIMdMbTw5uZwtFRlB7qDvQouml9kujGmRu6k7zZMTOwWowRNtpboLUcL2NzkVgK6N1Zi2vq/Nt4NJvM5_l1dpIIbwJv_CIcZQZOqPtRWULa2iVxfmJJQaqgLQPwSHQH1zuRJMhraEsPjqVQRC0pZpSt/24VBDN8y31Ye/y_ekWxMdZCvr978C/WrdcTi29kxjJLyT9BII7BsgT5vLuI2l7ntqRAhAUWMs/h9JR0i8RbX5OfB46q41/TfmSdgi97bCR2HfgflyypXwKhRfKYU2MVpu2Dd90WQUlm7hZV8dSfGusuMj/nPMpRVWcbnvlAdsehJCPbLv6n4qdLSPeoMBo32acAGgu1BwBG8JsBgbH43yYi5X7UdGRWKqm_ZbqaDEKH3ncU/uA8EOJb41VfGho4LUeOi1IeYwVAhFEyO6YbteYZecEubrNFZrWWjZUqhzouzY95TeWU8E4StCXVPKlYPiFiwUSX20kG0lVtDbAy/7u4f4x0cYlFOvI1UN1qoOExmNxnxzQQFeM5exWfW2JrRXq5e0UdAJr4q2o9Y_0WaGfhL/nP6Ei06YajDKr11dK5H0LX/9CGTC37HFZeopyopzP_7fvGFkqIRoGTS48pLaIFz3gwpQNlWXUFCsd/PnRlsqJ3SBQSgp_AQe2cP6iBNy2bJI8lkxwY5YVDDdjxusuCcafdjfs2aUa/4tr_iMnNBnd27GxjQI28_JGJlfbOaajVJOxuPMT4ELpYCfPiFjdSbJyE0/gCwtj0rgDKSLWJnOPJ5TAJ935gCqeIsBhOhfcZX413GdilBZRRYEjCVKfOuWzHZ3GW/8yjyk5e_WMNv5F6xggl07w90DBwpx/Q/iWfncqMuSfoeFeqHQkDL9F5W19j1cGuAcyfIYMAXztHXpgTKh9vZcsLYC7LcgKr4FQj3JjEvtnDG2PjcMjGF/MnbCRCz22Ho410_vE9M1Hpq0wdk_i5DbZKNoSwlPgey9URkpuX146TcDdsx_VWDenCepY5HwMr9CPOY9hzUs/c5AWeUMXk/gvsI81Jkv5rHpEnNBUZXYzfqkwQfffhmrc/StLCtzRRlja8dpsEWdkzoKR9Kdxq1qAs5f0sdrGjVRLTT_s1Q2P59zhA/QmS4bubi64cYot3gSIgdNnkjA2GjCp1ETVa548_U9B6boTKDVmaKJlVIDvqL84RC3WI7Er/8opi2lZ48W83Ur47BRh38oOnI0agrCyZz8bp1w_gfVRlSO8PS0i/l_/qxq5xpLbhPkdxVoyZVsNAZchfnmkIHyIk5IK6EUDXdMR21y6OvKW50ZbooAtk9ymynBj4dAYMsd25RV7FE1I1vRTsiDw52/.E5WC0Ymo2zn.qelSbhzr-4laArYiWP.dwJB6qm_6rs0Rm5UXYaYtUNbh76_jJp_X1xQUCDSgbr2KOkDU0\"Q/-4dV\"Yk3QGg[(O86=Pf\"e17K4'r{)kicofHSXcMmP@>VF^`~4j4F*L/1]tD+Lw!WI!@]*OZm6C`M$u96}*O