{
"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 ",
"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 ",
"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 ",
"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 ",
"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 ",
"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 ",
"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 You've found the secret! \n | \n \n \n \n  | \n \n \n \n  | \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? | \n \n \n \n  | \n \n | \n \n \n \n | \n \n \n | \n \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 You've found the secret! \n | \n \n \n \n  | \n \n \n \n  | \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? | \n \n \n \n  | \n \n | \n \n \n \n | \n \n \n | \n \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"
],