diff --git a/Dockerfile b/Dockerfile index 6587fff8..81359dbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,14 @@ -ARG version=latest -FROM openjdk:$version +ARG version=8 +FROM maven:3.9-eclipse-temurin-${version} -# version <= 11 RUN apt-get update \ - && apt-get install -y make maven || true -COPY prism/prism/nginx/cert.crt /usr/local/share/ca-certificates/cert.crt -RUN update-ca-certificates || true + && apt-get install -y --no-install-recommends make \ + && rm -rf /var/lib/apt/lists/* -# version > 11 -RUN yum update -y \ - && yum install -y make wget || true -RUN wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo \ - && yum install -y maven || true -RUN keytool -import -trustcacerts -cacerts -storepass changeit -noprompt \ - -alias api.sendgrid.com -file /usr/local/share/ca-certificates/cert.crt || true +# Trust the mock server's api.sendgrid.com certificate (see mock-server/). +COPY mock-server/nginx/cert.crt /tmp/api.sendgrid.com.crt +RUN keytool -importcert -noprompt -storepass changeit -alias api.sendgrid.com \ + -file /tmp/api.sendgrid.com.crt -keystore "$(find "$JAVA_HOME" -name cacerts | head -1)" WORKDIR /app COPY . . diff --git a/Makefile b/Makefile index 3983b6aa..ee256419 100644 --- a/Makefile +++ b/Makefile @@ -15,10 +15,12 @@ test: test-integ: test -version ?= latest +version ?= 8 +COMPOSE := $(shell docker compose version >/dev/null 2>&1 && echo "docker compose" || echo "docker-compose") test-docker: - curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/HEAD/prism/prism-java.sh -o prism.sh - version=$(version) bash ./prism.sh + version=$(version) $(COMPOSE) -f mock-server/docker-compose.yml up --build --force-recreate \ + --abort-on-container-exit --exit-code-from helper-runner --remove-orphans; \ + status=$$?; version=$(version) $(COMPOSE) -f mock-server/docker-compose.yml down --remove-orphans; exit $$status update-deps: mvn versions:use-latest-releases versions:commit -DallowMajorUpdates=false diff --git a/mock-server/Dockerfile.prism b/mock-server/Dockerfile.prism new file mode 100644 index 00000000..dac986df --- /dev/null +++ b/mock-server/Dockerfile.prism @@ -0,0 +1,19 @@ +# Prism mock of the SendGrid v3 API, used by `make test-docker`. +# Everything is pinned: the base image by digest, the Prism binary by sha256, +# and the spec is vendored (see README.md in this directory). +FROM debian:bookworm-slim@sha256:7c7b2c966bc9ee8cedfeef67e0e279108992c77681fa595db4a9d65c06ccc587 + +ARG PRISM_VERSION=v2.0.17 +ARG PRISM_SHA256=80f37c2aedab2035a20e6025ac552908bce9e5d64a9338a48434e604e5590731 + +RUN apt-get update \ + && apt-get install -y --no-install-recommends curl ca-certificates \ + && curl -fsSL "https://github.com/stoplightio/prism/releases/download/${PRISM_VERSION}/prism_linux_amd64" -o /usr/local/bin/prism \ + && echo "${PRISM_SHA256} /usr/local/bin/prism" | sha256sum -c - \ + && chmod +x /usr/local/bin/prism \ + && apt-get purge -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* + +COPY oai_stoplight.json /oai_stoplight.json + +EXPOSE 4010 +CMD ["prism", "--port", "4010", "mock", "--spec", "/oai_stoplight.json"] diff --git a/mock-server/README.md b/mock-server/README.md new file mode 100644 index 00000000..d8958259 --- /dev/null +++ b/mock-server/README.md @@ -0,0 +1,15 @@ +# Mock SendGrid API for tests + +`make test-docker` runs the test suite against a local mock of `api.sendgrid.com`: + +- **prism**: [Prism](https://github.com/stoplightio/prism) v2.0.17 mocking `oai_stoplight.json`. + The binary's sha256 is checked in `Dockerfile.prism`. +- **nginx**: answers TLS as `api.sendgrid.com` with the self-signed test certificate in + `nginx/` and proxies to prism. The certificate and key exist only for this mock. +- **helper-runner**: the repo's root `Dockerfile`, which trusts that certificate and runs + `make test-integ`. + +`oai_stoplight.json` is vendored from `sendgrid/sendgrid-oai` at commit +`eb7a825bf06dfec7da2622735c5334c0d35da9fa`, the same commit the previous +remote `prism-java.sh` script pinned. These files used to be downloaded at test time +from that repository, which is no longer publicly readable. diff --git a/mock-server/docker-compose.yml b/mock-server/docker-compose.yml new file mode 100644 index 00000000..6254c457 --- /dev/null +++ b/mock-server/docker-compose.yml @@ -0,0 +1,33 @@ +# Runs the test suite against a local mock of api.sendgrid.com: +# helper-runner -> nginx (TLS as api.sendgrid.com) -> prism (mock of the v3 spec) +services: + helper-runner: + build: + context: .. + args: + - version=${version:-8} + command: make test-integ + depends_on: + nginx: + condition: service_healthy + nginx: + image: nginx:1.27-alpine@sha256:65645c7bb6a0661892a8b03b89d0743208a18dd2f3f17a54ef4b76fb8e2f2a10 + networks: + default: + aliases: + - api.sendgrid.com + volumes: + - ./nginx:/etc/nginx:ro + depends_on: + - prism + healthcheck: + # 2xx-4xx means nginx is up and prism answered; 502 means prism isn't ready yet. + test: ["CMD-SHELL", "wget -S -O /dev/null http://127.0.0.1/ 2>&1 | grep -qE '^ HTTP/1\\.[01] [1-4][0-9][0-9]'"] + interval: 2s + timeout: 2s + retries: 30 + prism: + platform: linux/amd64 + build: + context: . + dockerfile: Dockerfile.prism diff --git a/mock-server/nginx/cert.crt b/mock-server/nginx/cert.crt new file mode 100644 index 00000000..4ba1597c --- /dev/null +++ b/mock-server/nginx/cert.crt @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDyDCCArACCQDoRrX2g0xuUDANBgkqhkiG9w0BAQsFADCBpDELMAkGA1UEBhMC +VVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28x +DzANBgNVBAoMBlR3aWxpbzERMA8GA1UECwwIU2VuZEdyaWQxGTAXBgNVBAMMEGFw +aS5zZW5kZ3JpZC5jb20xKTAnBgkqhkiG9w0BCQEWGnRlYW1faW50ZXJmYWNlc0B0 +d2lsaW8uY29tMCAXDTIyMDEwNzAwMzAxOFoYDzIxMjExMjE0MDAzMDE4WjCBpDEL +MAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBG +cmFuY2lzY28xDzANBgNVBAoMBlR3aWxpbzERMA8GA1UECwwIU2VuZEdyaWQxGTAX +BgNVBAMMEGFwaS5zZW5kZ3JpZC5jb20xKTAnBgkqhkiG9w0BCQEWGnRlYW1faW50 +ZXJmYWNlc0B0d2lsaW8uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAmS9xQ4D19jQ2YyuFzN7zk9xRWeOil7bzkOkgFCCqlhPCzuYlMqgD1F7ImcNo +XbFw13s8k/18xWqxBynFgtmniuFm/f4g8iAfeBn35i1g3Bf0bpG9gWn6h/dX3YXb +g0nl0e+bMQG4uD0gccySA/Vt6Y6Tshgu6pVo+yMiWEqQRa0tgqr2WZ8NU0bOrpQz +U9bOrvKxrWvdmIxIYOmptywTXW3vLi63LpE2iy5dPWFO4JCRBc02XZ84B5EhbfVt +ojNbFdtW6urt/VkrWbt18bFcoeM3w6/Hba8MF+z8ONS8QjD9CRXleNKDMVLmvEmW +L0RxO4H1P3O7ar/vPafEDobPGQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQA/MNAr +C+9iCLLn9S2QWXfarI1EAb4AFkGWYtqcvhmLJMqWqzsjEWWpWsSBk/i/kPNzTvNs +XRj8ZPS61lhJw3rRmP/2LW9M4u6mIBHfiBgtWaMhhAjaFA0ALAsJa/8WmAgUfb5V +dR73oc1GJtDTKJgZ3cFaKAaimDIxJNHSjpYADCEkdKoVv1b/JxD8JEzI9NmrU5xd +7T7pG6RVT4xO5flCJM+nO851jUaKVmcKD7lhQe9Z8P0bH+ecFyQDILbOFd8ojBHV +6hSLw4vZCM5bR7iOFBUYzxaKcXl6FJTKaYXD/UrfFXA95YZieGPKYxoF6AkB0I1C +9RcmCQkkJZnCRCJX +-----END CERTIFICATE----- diff --git a/mock-server/nginx/cert.key b/mock-server/nginx/cert.key new file mode 100644 index 00000000..69f0fcb5 --- /dev/null +++ b/mock-server/nginx/cert.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCZL3FDgPX2NDZj +K4XM3vOT3FFZ46KXtvOQ6SAUIKqWE8LO5iUyqAPUXsiZw2hdsXDXezyT/XzFarEH +KcWC2aeK4Wb9/iDyIB94GffmLWDcF/Rukb2BafqH91fdhduDSeXR75sxAbi4PSBx +zJID9W3pjpOyGC7qlWj7IyJYSpBFrS2CqvZZnw1TRs6ulDNT1s6u8rGta92YjEhg +6am3LBNdbe8uLrcukTaLLl09YU7gkJEFzTZdnzgHkSFt9W2iM1sV21bq6u39WStZ +u3XxsVyh4zfDr8dtrwwX7Pw41LxCMP0JFeV40oMxUua8SZYvRHE7gfU/c7tqv+89 +p8QOhs8ZAgMBAAECggEASPrwVD/Bbu3LJ44ZrdReaYhifZfU48D244gdj1lMzDlX +62h8OlkPkgMiQRd2xoR+BTsiTkNLSWaeNpJxFfkKOEFQ5xtGqPQi6f49O71M0y7a +dj8a8OgDwvlVNCXMwgzX4B/uaPewAJ6msXDL8/Tey5Hwzb11xK8wF83SVAwaFgdB +2eY+crgF9biRiRsX+J6uqqHd4RM37IyQ133voTFBho48h3ORgo4WYu5tsHbwKvGC +pNDtvuvuwkvp6JuI0A1hr3j+/5981n+4w+rnyORliJmxjTYUzhrJ3UXjlXd9gInj +6tgKEnyq4j78MRp1VrFTPze3XOgMbhVflpLz22rWsQKBgQDJheFTI255UP+9c82B +KovkEtWNMwZwxiwmxPzapuUsg+OyJ7rNACuT+kRNkbQovC19nVG6NvwWs7A32Jjt +YHBmAepnh1a1p4NXkKEtwe/28nEnoKsv/Iaw7fIffr6gAdnlv8NV0K8WrnCuWUJ7 +qgKrHSqXdf2k/yxdCi8gQDzaPQKBgQDCmGwAS9LCOJWBfn7UkSc9aOf7z6ZDcWJw +smzWJ5zMNEwv4F4D7OO+4JpLoaKyu5jfllXMIELPWfC8J/+RsyDyEe1CED9pxIbJ +NBhfwJtwriolypXrkkCiRBRjG2Jg5NGdRRNjTbqtct83PxX5HcEjk09JFl2FNp7D ++ma0dpxCDQKBgFLVPurnc29WRehfgycGj/2taC3jvU/5hQhii/RsCWMkyyDdh8Df +wwnOIuknbMAZqTEqyv8ZvsCuF069Lw7TRyAGxYzMam28bxY9EqM2RiZhPPWm6vaM +e+iZxZ4AgOZQHHp9OhM59d4C0bo4YkVmejZPhMRA8YMyh8+ucfR1sw2ZAoGADPLp +lOd2wdfUEwbg17JFAzAc58O8k5ZS757f4SxHocsFGtZ6SxaTXRtDCS9bTTtwg8hU +Mz4eU//vJgYfWomp8pHA0PmVzqr2MSNXT9/YOBpO0a72ZPOZe3K+TI4A8OOpEycK +kDwW5P3U3q9C/g290Wk3CG0Fkhy9WdsqxG10Hm0CgYBhw64ATDSZ45KIJUF46HRa +RAY6oO5z2w2BeEpFugkFaMoziQocudeTMvE+QWneYLs7Tdzip+qbNVXJi6jAfpQQ +H3z2Bm34QvnuXuM1oWL2l7o10X35BHR0B6+IyL3Z/PHUusO51S+rNGPyKr63TXYI +Ucx/inqVBb7oeKlSHYmA1w== +-----END PRIVATE KEY----- diff --git a/mock-server/nginx/nginx.conf b/mock-server/nginx/nginx.conf new file mode 100644 index 00000000..7ac954c1 --- /dev/null +++ b/mock-server/nginx/nginx.conf @@ -0,0 +1,18 @@ +events {} +http { + proxy_buffering off; + server { + listen 80; + listen 443 ssl; + + ssl_certificate /etc/nginx/cert.crt; + ssl_certificate_key /etc/nginx/cert.key; + + location / { + proxy_pass http://prism:4010; + proxy_ignore_client_abort on; + } + } + + client_max_body_size 0; +} diff --git a/mock-server/oai_stoplight.json b/mock-server/oai_stoplight.json new file mode 100644 index 00000000..8e4ce52c --- /dev/null +++ b/mock-server/oai_stoplight.json @@ -0,0 +1,30770 @@ +{ + "swagger": "2.0", + "info": { + "version": "3.0", + "title": "SendGrid v3 API Documentation", + "description": "# The SendGrid Web API V3 Documentation\n\nThis is the entirety of the documented v3 endpoints. We have updated all the descriptions, parameters, requests, and responses.\n\n## Authentication \n\nEvery endpoint requires Authentication in the form of an Authorization Header:\n\nAuthorization: Bearer API_KEY" + }, + "host": "api.sendgrid.com", + "basePath": "/v3", + "schemes": [ + "http", + "https" + ], + "securityDefinitions": { + "Authorization": { + "name": "Authorization", + "type": "apiKey", + "in": "header" + } + }, + "paths": { + "/mail/send": { + "post": { + "operationId": "POST_mail-send", + "summary": "v3 Mail Send", + "tags": [ + "Mail Send" + ], + "description": "This 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, please see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).\n\n* Top level parameters are referred to as \"global\".\n* Individual fields within the personalizations array will override any other global, or “message level”, parameters that are defined outside of personalizations.\n \n**SendGrid provides libraries to help you quickly and easily integrate with the v3 Web API in 7 different languages: [C#](https://github.com/sendgrid/sendgrid-csharp), [Go](https://github.com/sendgrid/sendgrid-go), [Java](https://github.com/sendgrid/sendgrid-java), [Node JS](https://github.com/sendgrid/sendgrid-nodejs), [PHP](https://github.com/sendgrid/sendgrid-php), [Python](https://github.com/sendgrid/sendgrid-python), and [Ruby](https://github.com/sendgrid/sendgrid-ruby).**\n\n\nFor more detailed information about how to use the v3 Mail Send endpoint, please visit our [Classroom](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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.", + "uniqueItems": false, + "maxItems": 1000, + "items": { + "type": "object", + "properties": { + "to": { + "type": "array", + "description": "An array of recipients. Each object within this array may contain the name, but must always contain the email, of a recipient.", + "minItems": 1, + "maxItems": 1000, + "items": { + "$ref": "#/definitions/email_object" + } + }, + "cc": { + "type": "array", + "description": "An array of recipients who will receive a copy of your email. Each object within this array may contain the name, but must always contain the email, of a recipient.", + "maxItems": 1000, + "items": { + "$ref": "#/definitions/email_object" + } + }, + "bcc": { + "type": "array", + "description": "An array of recipients who will receive a blind carbon copy of your email. Each object within this array may contain the name, but must always contain the email, of a recipient.", + "maxItems": 1000, + "items": { + "$ref": "#/definitions/email_object" + } + }, + "subject": { + "type": "string", + "description": "The subject of your email. Char length requirements, according to the RFC - 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 specific 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": "A collection of key/value pairs following the pattern \"substitution_tag\":\"value to substitute\". All are assumed to 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.", + "maxProperties": 10000 + }, + "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. May not exceed 10,000 bytes." + }, + "send_at": { + "type": "integer", + "description": "A unix timestamp allowing you to specify when you want your email to be delivered. Scheduling more than 72 hours in advance is forbidden." + } + }, + "required": [ + "to" + ] + } + }, + "from": { + "$ref": "#/definitions/email_object" + }, + "reply_to": { + "$ref": "#/definitions/email_object" + }, + "subject": { + "type": "string", + "description": "The global, or “message level”, subject of your email. This may be overridden by personalizations[x].subject.", + "minLength": 1 + }, + "content": { + "type": "array", + "description": "An array in which you may specify the content of your email. You can include multiple mime types of content, but you must specify at least one mime type. To include more than one mime type, simply 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. For example, “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 in which 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. For example, “text/plain” or “text/html”.", + "minLength": 1 + }, + "filename": { + "type": "string", + "description": "The filename of the attachment." + }, + "disposition": { + "type": "string", + "default": "attachment", + "description": "The content-disposition of the attachment specifying how you would like the attachment to be displayed. For example, “inline” results in the attached file being displayed automatically within the message while “attachment” results in the attached file requiring some action to be taken before it is displayed (e.g. opening or downloading the file).", + "enum": [ + "inline", + "attachment" + ] + }, + "content_id": { + "type": "string", + "description": "The content id for the attachment. 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": "The id of a template that you would like to use. If you use a template that contains a subject and content (either text or html), you do not need to specify those at the personalizations nor message level. " + }, + "sections": { + "type": "object", + "description": "An object of key/value pairs that define block sections of code to be used as substitutions." + }, + "headers": { + "type": "object", + "description": "An object containing key/value pairs of header names and the value to substitute for them. You must ensure these are properly encoded if they contain unicode characters. Must not be one of the reserved headers." + }, + "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": { + "type": "object", + "description": "Values that are specific to the entire send 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 parameter is overridden by personalizations[x].custom_args if that parameter has been defined. Total custom args size may not exceed 10,000 bytes." + }, + "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 personalizations[x].send_at parameter. Scheduling more ta 72 hours in advance is forbidden." + }, + "batch_id": { + "type": "string", + "description": "This ID represents 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, and also enables you to cancel or pause the delivery of that batch. For more information, see https://sendgrid.com/docs/API_Reference/Web_API_v3/cancel_schedule_send.html " + }, + "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": { + "bcc": { + "type": "object", + "description": "This allows you to have a blind carbon copy automatically sent to the specified email address for every email that is sent.", + "properties": { + "enable": { + "type": "boolean", + "description": "Indicates if this setting is enabled." + }, + "email": { + "type": "string", + "description": "The email address that you would like to receive the BCC.", + "format": "email" + } + } + }, + "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.", + "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": "This 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." + } + } + }, + "spam_check": { + "type": "object", + "description": "This allows you to test the content of your email for spam.", + "properties": { + "enable": { + "type": "boolean", + "description": "Indicates if this setting is enabled." + }, + "threshold": { + "type": "integer", + "description": "The threshold used to determine if your content qualifies as spam on a scale from 1 to 10, with 10 being most strict, or most likely to be considered as spam.", + "minimum": 1, + "maximum": 10 + }, + "post_to_url": { + "type": "string", + "description": "An Inbound Parse URL that you would like a copy of your email along with the spam report to be sent to." + } + } + } + } + }, + "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 whether 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 whether the email was opened or not, but including a single pixel image in the body of the content. When the pixel is loaded, we 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.\t" + }, + "utm_content": { + "type": "string", + "description": "Used to differentiate your campaign from advertisements.\t" + }, + "utm_campaign": { + "type": "string", + "description": "The name of the campaign.\t" + } + } + } + } + } + }, + "required": [ + "personalizations", + "from", + "subject", + "content" + ], + "example": { + "personalizations": [ + { + "to": [ + { + "email": "john.doe@example.com", + "name": "John Doe" + } + ], + "subject": "Hello, World!" + } + ], + "from": { + "email": "sam.smith@example.com", + "name": "Sam Smith" + }, + "reply_to": { + "email": "sam.smith@example.com", + "name": "Sam Smith" + }, + "subject": "Hello, World!", + "content": [ + { + "type": "text/html", + "value": "

Hello, world!

" + } + ] + } + } + } + ], + "responses": { + "202": { + "description": "", + "schema": { + "type": "null" + } + }, + "400": { + "description": "", + "schema": { + "$ref": "#/definitions/errors" + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/errors" + } + }, + "413": { + "description": "", + "schema": { + "$ref": "#/definitions/errors" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_mail-send", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "statusCode": 200, + "enabled": false + } + } + } + }, + "/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 [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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", + "null" + ], + "description": "The email address the alert will be sent to.\nExample: test@example.com" + }, + "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." + }, + "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": [] + } + ], + "x-stoplight": { + "id": "POST_alerts", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "get": { + "operationId": "GET_alerts", + "summary": "Retrieve all alerts", + "tags": [ + "Alerts" + ], + "description": "**This endpoint allows you to retieve 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 [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "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": [] + } + ], + "x-stoplight": { + "id": "GET_alerts", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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 [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_alerts-alertid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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 [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).", + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_alerts-alertid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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 [User Guide](https://sendgrid.com/docs/User_Guide/Settings/alerts.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "PATCH_alerts-alertid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/api_keys": { + "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\nThe API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).", + "produces": [ + "application/json" + ], + "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": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_apikeys", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "post": { + "operationId": "create-api-keys", + "summary": "Create API keys", + "tags": [ + "API Keys" + ], + "description": "**This endpoint allows you to create a new random API Key for the user.**\n\nA JSON request body containing a \"name\" property is required. If number of maximum keys is reached, HTTP 403 will be returned.\n\nThere is a limit of 100 API Keys on your account.\n\nThe API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).\n\nSee the [API Key Permissions List](https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/api_key_permissions_list.html) for a list of all available scopes.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + } + }, + "sample": { + "type": "string" + } + }, + "required": [ + "name" + ], + "example": { + "name": "My API Key", + "scopes": [ + "mail.send", + "alerts.create", + "alerts.read" + ], + "sample": "data" + } + } + }, + { + "$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": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "name", + "message": "missing required argument" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "403": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "Cannot create more than 100 API Keys" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "create-api-keys", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 201, + "enabled": false, + "dynamic": false + } + } + } + }, + "/api_keys/{api_key_id}": { + "parameters": [ + { + "name": "api_key_id", + "in": "path", + "description": "The ID of the API Key for which you are requesting information.", + "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.**\n\nIf the API Key ID does not exist an HTTP 404 will be returned.", + "produces": [ + "application/json" + ], + "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" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "Unexpected error in API call. See HTTP response body for details.", + "schema": { + "type": "object" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "unable to find API Key" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_apikeys-apikeyid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "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**\n\nAuthentications using this API Key will fail after this request is made, with some small propogation delay.If the API Key ID does not exist an HTTP 404 will be returned.\n\nThe API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).\n\n## URI Parameters\n\n| URI Parameter | Type | Required? | Description |\n|---|---|---|---|\n|api_key_id |string | required | The ID of the API Key you are deleting.|", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + }, + "examples": { + "application/json": null + } + }, + "404": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "unable to find API Key" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_apikeys-apikeyid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_api_keys-api_key_id", + "summary": "Update API keys", + "tags": [ + "API Keys" + ], + "description": "**This endpoint allows you to update the name of an existing API Key.**\n\nA JSON request body with a \"name\" property is required.\n\nThe API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).\n\n## URI Parameters\n\n| URI Parameter | Type | Required? | Description |\n|---|---|---|---|\n|api_key_id |string | required | The ID of the API Key you are updating.|", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The new name of the API Key." + } + }, + "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" + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_apikeys-apikeyid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "put": { + "operationId": "PUT_api_keys-api_key_id", + "summary": "Update the name & scopes of an API Key", + "tags": [ + "API Keys" + ], + "description": "**This endpoint allows you to update the name and scopes of a given API key.**\n\nA JSON request body with a \"name\" property is required.\nMost provide the list of all the scopes an api key should have.\n\nThe API Keys feature allows customers to be able to generate an API Key credential which can be used for authentication with the SendGrid v3 Web API or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "example": { + "name": "A New Hope", + "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": "A New Hope", + "scopes": [ + "user.profile.read", + "user.profile.update" + ] + } + } + }, + "400": { + "description": "Unexpected error in API call. See HTTP response body for details.", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "expected JSON request body with 'name' property" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "type": "object" + } + }, + "404": { + "description": "Unexpected error in API call. See HTTP response body for details.", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "unable to find API Key to update" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PUT_apikeys-apikeyid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + } + }, + "/suppression/blocks": { + "get": { + "operationId": "GET_suppression-blocks", + "summary": "Retrieve all blocks", + "tags": [ + "Blocks API" + ], + "description": "**This endpoint allows you to retrieve a list of all email addresses that are currently on your blocks list.**\n\nThere are several causes for [blocked](https://sendgrid.com/docs/Glossary/blocks.html) emails: for example, your mail server IP address is on an ISP blacklist, or blocked by an ISP, or if the receiving server flags the message content.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_time", + "in": "query", + "description": "Refers start of the time range in unix timestamp when a blocked email was created (inclusive).", + "type": "integer" + }, + { + "name": "end_time", + "in": "query", + "description": "Refers end of the time range in unix timestamp when a blocked email was created (inclusive).", + "type": "integer" + }, + { + "name": "limit", + "in": "query", + "description": "Limit the number of results to be displayed per page.", + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "The point in the list to begin displaying results.", + "type": "integer" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "created": { + "type": "integer", + "description": "A Unix timestamp indicating when the email address was added to the blocks list." + }, + "email": { + "type": "string", + "description": "The email address that was added to the block list." + }, + "reason": { + "type": "string", + "description": "An explanation for the reason of the block." + }, + "status": { + "type": "string", + "description": "The status of the block." + } + }, + "required": [ + "created", + "email", + "reason", + "status" + ] + } + }, + "examples": { + "application/json": [ + { + "created": 1443651154, + "email": "example@example.com", + "reason": "error dialing remote address: dial tcp 10.57.152.165:25: no route to host", + "status": "4.0.0" + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_suppression-blocks", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_suppression-blocks", + "summary": "Delete blocks", + "tags": [ + "Blocks API" + ], + "description": "**This endpoint allows you to delete all email addresses on your blocks list.**\n\nThere are two options for deleting blocked emails: \n\n1. You can delete all blocked emails by setting `delete_all` to true in the request body. \n2. You can delete some blocked emails by specifying the email addresses in an array in the request body.\n\n[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "delete_all": { + "type": "boolean", + "description": "Indicates if you want to delete all blocked email addresses." + }, + "emails": { + "type": "array", + "description": "The specific blocked email addresses that you want to delete.", + "items": { + "type": "string" + } + } + }, + "example": { + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_suppression-blocks", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + } + }, + "/suppression/blocks/{email}": { + "parameters": [ + { + "name": "email", + "in": "path", + "description": "The email address of the specific block.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_suppression-blocks-email", + "summary": "Retrieve a specific block", + "tags": [ + "Blocks API" + ], + "description": "**This endpoint allows you to retrieve a specific email address from your blocks list.**\n\n[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "created": { + "type": "integer", + "description": "A Unix timestamp indicating when the block was created." + }, + "email": { + "type": "string", + "description": "The email address of the recipient that was blocked." + }, + "reason": { + "type": "string", + "description": "The reason why the email was blocked." + }, + "status": { + "type": "string", + "description": "The status of the block." + } + }, + "required": [ + "created", + "email", + "reason" + ] + } + }, + "examples": { + "application/json": [ + { + "created": 1443651154, + "email": "example@example.com", + "reason": "error dialing remote address: dial tcp 10.57.152.165:25: no route to host", + "status": "4.0.0" + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_suppression-blocks-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_suppression-blocks-email", + "summary": "Delete a specific block", + "tags": [ + "Blocks API" + ], + "description": "**This endpoint allows you to delete a specific email address from your blocks list.**\n\n[Blocks](https://sendgrid.com/docs/Glossary/blocks.html) happen when your message was rejected for a reason related to the message, not the recipient address. This can happen when your mail server IP address has been added to a blacklist or blocked by an ISP, or if the message content is flagged by a filter on the receiving server.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/blocks.html).", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:authorizationHeader:Authorization" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "x-stoplight": { + "id": "DELETE_suppression-blocks-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/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 can be used to authenticate the use of [SendGrid’s v3 Web API](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html), or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). API Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access. For a more detailed explanation of how you can use API Key permissios, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/api_keys.html#-API-Key-Permissions) or [Classroom](https://sendgrid.com/docs/Classroom/Basics/API/api_key_permissions.html).", + "produces": [ + "application/json" + ], + "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" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_scopes", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "statusCode": 200, + "enabled": false + } + } + } + }, + "/suppression/bounces": { + "get": { + "operationId": "GET_suppression-bounces", + "summary": "Retrieve all bounces", + "tags": [ + "Bounces API" + ], + "description": "**This endpoint allows you to retrieve all of your bounces.**\n\nA bounced email is when the message is undeliverable and then returned to the server that sent it. \n\nFor more information see: \n\n* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information\n* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_time", + "in": "query", + "description": "Refers start of the time range in unix timestamp when a bounce was created (inclusive).", + "type": "integer" + }, + { + "name": "end_time", + "in": "query", + "description": "Refers end of the time range in unix timestamp when a bounce was created (inclusive).", + "type": "integer" + }, + { + "name": "Accept", + "in": "header", + "required": true, + "type": "string", + "default": "application/json" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "created": { + "type": "number" + }, + "email": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "status": { + "type": "string" + } + } + } + }, + "examples": { + "application/json": [ + { + "created": 1250337600, + "email": "example@example.com", + "reason": "550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/answer/6596 o186si2389584ioe.63 - gsmtp ", + "status": "5.1.1" + }, + { + "created": 1250337600, + "email": "example@example.com", + "reason": "550 5.1.1 : Recipient address rejected: User unknown in virtual alias table ", + "status": "5.1.1" + } + ] + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_suppression-bounces", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_suppression-bounces", + "summary": "Delete bounces", + "tags": [ + "Bounces API" + ], + "description": "**This endpoint allows you to delete all of your bounces. You can also use this endpoint to remove a specific email address from your bounce list.**\n\nA bounced email is when the message is undeliverable and then returned to the server that sent it.\n\nFor more information see: \n\n* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information\n* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html)\n* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html)\n\nNote: the `delete_all` and `emails` parameters should be used independently of each other as they have different purposes.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "delete_all": { + "type": "boolean", + "description": "This parameter allows you to delete **every** email in your bounce list. This should not be used with the emails parameter." + }, + "emails": { + "type": "array", + "description": "Delete multiple emails from your bounce list at the same time. This should not be used with the delete_all parameter.", + "items": { + "type": "string" + } + } + }, + "example": { + "delete_all": true, + "emails": [ + "example@example.com", + "example2@example.com" + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_suppression-bounces", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/suppression/bounces/{email}": { + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_suppression-bounces-email", + "summary": "Retrieve a Bounce", + "tags": [ + "Bounces API" + ], + "description": "**This endpoint allows you to retrieve a specific bounce for a given email address.**\n\nA bounced email is when the message is undeliverable and then returned to the server that sent it.\n\nFor more information see: \n\n* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information\n* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html)\n* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "created": { + "type": "integer" + }, + "email": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "status": { + "type": "string" + } + } + } + }, + "examples": { + "application/json": [ + { + "created": 1443651125, + "email": "bounce1@test.com", + "reason": "550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/answer/6596 o186si2389584ioe.63 - gsmtp ", + "status": "5.1.1" + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_suppression-bounces-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_suppression-bounces-email", + "summary": "Delete a bounce", + "tags": [ + "Bounces API" + ], + "description": "**This endpoint allows you to remove an email address from your bounce list.**\n\nA bounced email is when the message is undeliverable and then returned to the server that sent it. This endpoint allows you to delete a single email addresses from your bounce list. \n\nFor more information see: \n\n* [User Guide > Bounces](https://sendgrid.com/docs/User_Guide/Suppressions/bounces.html) for more information\n* [Glossary > Bounces](https://sendgrid.com/docs/Glossary/Bounces.html)\n* [Classroom > List Scrubbing Guide](https://sendgrid.com/docs/Classroom/Deliver/list_scrubbing.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "email_address", + "in": "query", + "description": "The email address you would like to remove from the bounce list.", + "required": true, + "type": "string", + "format": "email" + }, + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_suppression-bounces-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/campaigns": { + "post": { + "operationId": "POST_campaigns", + "summary": "Create a Campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to create a campaign.**\n\nOur Marketing Campaigns API lets you create, manage, send, and schedule campaigns.\n\nNote: In order to send or schedule the campaign, you will be required to provide a subject, sender ID, content (we suggest both html and plain text), and at least one list or segment ID. This information is not required when you create a campaign.\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/campaign_request", + "example": { + "title": "March Newsletter", + "subject": "New Products for Spring!", + "sender_id": 124451, + "list_ids": [ + 110, + 124 + ], + "segment_ids": [ + 110 + ], + "categories": [ + "spring line" + ], + "suppression_group_id": 42, + "custom_unsubscribe_url": "", + "ip_pool": "marketing", + "html_content": "

Check out our spring line!

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

Check out our spring line!

", + "plain_content": "Check out our spring line!", + "status": "Draft" + } + } + }, + "400": { + "description": "\"title\": \"title can't be blank\"\n\"title\": \"title is too long (maximum is 100 characters)\"\n\"categories\": \"categories exceeds 10 category limit\"\n\"html_content\": \"html_content exceeds the 1MB limit\"\n\"plain_content\": \"plain_content exceeds the 1MB limit\"\n\"sender_id\": \"sender_id does not exist\"\n\"sender_id\": \"sender_id is not a verified sender identity\"\n\"list_ids\": \"list_ids do not all exist\"\n\"segment_ids\": \"segment_ids do not all exist\"\n\"ip_pool\": \"The ip pool you provided is invalid\"\n\"suppression_group_id\": \"suppression_group_id does not exist\"\n\"unsubscribes\": \"Either suppression_group_id or custom_unsubscribe_url may be set/used, but not both. Please remove one before setting the other.\"\n\"\": \"The JSON you have submitted cannot be parsed.\"\n\"\": \"You've reached your limit of 250 campaigns. Please delete one or more and try again.\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "title", + "message": "title can't be blank" + }, + { + "field": "title", + "message": "title is too long (maximum is 100 characters)" + }, + { + "field": "categories", + "message": "categories exceeds 10 category limit" + }, + { + "field": "html_content", + "message": "html_content exceeds the 1MB limit" + }, + { + "field": "plain_content", + "message": "plain_content exceeds the 1MB limit" + }, + { + "field": "sender_id", + "message": "sender_id does not exist" + }, + { + "field": "sender_id", + "message": "sender_id is not a verified sender identity" + }, + { + "field": "list_ids", + "message": "list_ids do not all exist" + }, + { + "field": "segment_ids", + "message": "segment_ids do not all exist" + }, + { + "field": "ip_pool", + "message": "The ip pool you provided is invalid" + }, + { + "field": "suppression_group_id", + "message": "suppression_group_id does not exist" + }, + { + "field": "unsubscribes", + "message": "Either suppression_group_id or custom_unsubscribe_url may be set/used, but not both. Please remove one before setting the other." + }, + { + "field": null, + "message": "The JSON you have submitted cannot be parsed." + }, + { + "field": null, + "message": "You've reached your limit of 250 campaigns. Please delete one or more and try again." + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_campaigns", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + }, + "get": { + "operationId": "GET_campaigns", + "summary": "Retrieve all Campaigns", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to retrieve a list of all of your campaigns.**\n\nReturns campaigns in reverse order they were created (newest first).\n\nReturns an empty array if no campaigns exist.\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "The number of results you would like to receive at a time.", + "type": "integer", + "default": 10 + }, + { + "name": "offset", + "in": "query", + "description": "The index of the first campaign to return, where 0 is the first campaign.", + "type": "integer", + "default": 0 + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "result": { + "type": "array", + "items": { + "type": "object", + "properties": { + "categories": { + "type": "array", + "items": { + "type": "string" + } + }, + "custom_unsubscribe_url": { + "type": "string" + }, + "html_content": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "ip_pool": { + "type": "string" + }, + "list_ids": { + "type": "array", + "items": { + "type": "integer" + } + }, + "plain_content": { + "type": "string" + }, + "segment_ids": { + "type": "array", + "items": { + "type": "integer" + } + }, + "sender_id": { + "type": "integer" + }, + "status": { + "type": "string" + }, + "subject": { + "type": "string" + }, + "suppression_group_id": { + "type": "integer" + }, + "title": { + "type": "string" + } + } + } + } + } + }, + "examples": { + "application/json": { + "result": [ + { + "categories": [ + "spring line" + ], + "custom_unsubscribe_url": "", + "html_content": "

Check out our spring line!

", + "id": 986724, + "ip_pool": "marketing", + "list_ids": [ + 110 + ], + "plain_content": "Check out our spring line!", + "segment_ids": [ + 110 + ], + "sender_id": 124451, + "status": "Draft", + "subject": "New Products for Spring!", + "suppression_group_id": 42, + "title": "March Newsletter" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_campaigns", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/campaigns/{campaign_id}": { + "parameters": [ + { + "name": "campaign_id", + "in": "path", + "description": "The id of the campaign you would like to retrieve.", + "required": true, + "type": "integer" + } + ], + "get": { + "operationId": "GET_campaigns-campaign_id", + "summary": "Retrieve a single campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to retrieve a specific campaign.**\n\nOur Marketing Campaigns API lets you create, manage, send, and schedule campaigns.\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "categories": { + "type": "array", + "items": { + "type": "string" + } + }, + "custom_unsubscribe_url": { + "type": "string" + }, + "html_content": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "ip_pool": { + "type": "string" + }, + "list_ids": { + "type": "array", + "items": { + "type": "integer" + } + }, + "plain_content": { + "type": "string" + }, + "segment_ids": { + "type": "array", + "items": { + "type": "integer" + } + }, + "sender_id": { + "type": "integer" + }, + "status": { + "type": "string" + }, + "subject": { + "type": "string" + }, + "suppression_group_id": { + "type": "integer" + }, + "title": { + "type": "string" + } + } + }, + "examples": { + "application/json": { + "categories": [ + "spring line" + ], + "custom_unsubscribe_url": "", + "html_content": "

Check out our spring line!

", + "id": 986724, + "ip_pool": "marketing", + "list_ids": [ + 110 + ], + "plain_content": "Check out our spring line!", + "segment_ids": [ + 110 + ], + "sender_id": 124451, + "status": "Draft", + "subject": "New Products for Spring!", + "suppression_group_id": 42, + "title": "March Newsletter" + } + } + }, + "401": { + "description": "", + "schema": { + "type": "object" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "type": "object" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_campaigns-campaignid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_campaigns-campaign_id", + "summary": "Delete a Campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to delete a specific campaign.**\n\nOur Marketing Campaigns API lets you create, manage, send, and schedule campaigns.\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + } + }, + "401": { + "description": "", + "schema": { + "type": "object" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_campaigns-campaignid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + }, + "patch": { + "operationId": "PATCH_campaigns-campaign_id", + "summary": "Update a Campaign", + "tags": [ + "Campaigns API" + ], + "description": "Update a campaign. This is especially useful if you only set up the campaign using POST /campaigns, but didn't set many of the parameters.\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "title": "Update a Campaign request", + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "The title of the campaign." + }, + "subject": { + "type": "string", + "description": "The subject line for your campaign." + }, + "categories": { + "type": "array", + "description": "The categories you want to tag on this campaign.", + "items": { + "type": "string" + } + }, + "html_content": { + "type": "string", + "description": "The HTML content of this campaign." + }, + "plain_content": { + "type": "string", + "description": "The plain content of this campaign." + } + }, + "required": [ + "title", + "subject", + "categories", + "html_content", + "plain_content" + ], + "example": { + "title": "May Newsletter", + "subject": "New Products for Summer!", + "categories": [ + "summer line" + ], + "html_content": "

Check out our summer line!

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

Check out our summer line!

", + "plain_content": "Check out our summer line!", + "status": "Draft" + } + } + }, + "400": { + "description": "\"title\": \"title can't be blank\"\n\"title\": \"title is too long (maximum is 100 characters)\"\n\"categories\": \"categories exceeds 10 category limit\"\n\"html_content\": \"html_content exceeds the 1MB limit\"\n\"plain_content\": \"plain_content exceeds the 1MB limit\"\n\"sender_id\": \"sender_id does not exist\"\n\"sender_id\": \"sender_id is not a verified sender identity\"\n\"list_ids\": \"list_ids do not all exist\"\n\"segment_ids\": \"segment_ids do not all exist\"\n\"ip_pool\": \"The ip pool you provided is invalid\"\n\"suppression_group_id\": \"suppression_group_id does not exist\"\n\"unsubscribes\": \"Either suppression_group_id or custom_unsubscribe_url may be set/used, but not both. Please remove one before setting the other.\"\n\"\": \"The JSON you have submitted cannot be parsed.\"", + "schema": { + "type": "object" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "title", + "message": "title can't be blank" + }, + { + "field": "title", + "message": "title is too long (maximum is 100 characters)" + }, + { + "field": "categories", + "message": "categories exceeds 10 category limit" + }, + { + "field": "html_content", + "message": "html_content exceeds the 1MB limit" + }, + { + "field": "plain_content", + "message": "plain_content exceeds the 1MB limit" + }, + { + "field": "sender_id", + "message": "sender_id does not exist" + }, + { + "field": "sender_id", + "message": "sender_id is not a verified sender identity" + }, + { + "field": "list_ids", + "message": "list_ids do not all exist" + }, + { + "field": "segment_ids", + "message": "segment_ids do not all exist" + }, + { + "field": "ip_pool", + "message": "The ip pool you provided is invalid" + }, + { + "field": "suppression_group_id", + "message": "suppression_group_id does not exist" + }, + { + "field": "unsubscribes", + "message": "Either suppression_group_id or custom_unsubscribe_url may be set/used, but not both. Please remove one before setting the other." + }, + { + "field": null, + "message": "The JSON you have submitted cannot be parsed." + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "403": { + "description": "\"\": \"You may only update a campaign when it is in draft mode.\"", + "schema": { + "type": "object" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "You may only update a campaign when it is in draft mode." + } + ] + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_campaigns-campaignid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + } + }, + "/campaigns/{campaign_id}/schedules/now": { + "parameters": [ + { + "name": "campaign_id", + "in": "path", + "required": true, + "type": "integer" + } + ], + "post": { + "operationId": "POST_campaigns-campaign_id-schedules-now", + "summary": "Send a Campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to immediately send a campaign at the time you make the API call.**\n\nNormally a POST would have a request body, but since this endpoint is telling us to send a resource that is already created, a request body is not needed.\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "title": "Send a Campaign response", + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "status": { + "type": "string" + } + }, + "required": [ + "id", + "status" + ] + }, + "examples": { + "application/json": { + "id": 1234, + "status": "Scheduled" + } + } + }, + "400": { + "description": "\"subject\": \"subject can't be blank\"\n\"sender_id\": \"sender_id can't be blank\"\n\"plain_content\": \"plain_content can't be blank, please provide plain text or html content\"\n\"list_ids\": \"You must select at least 1 segment or 1 list to send to.\"\n\"unsubscribe_tag\": \"An [unsubscribe] tag in both your html and plain content is required to send a campaign.\"\n\"suppression_group_id\": \"Either a suppression_group_id or custom_unsubscribe_url is required to send a campaign.\"\n\"\": \"You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "subject", + "message": "subject can't be blank" + }, + { + "field": "sender_id", + "message": "sender_id can't be blank" + }, + { + "field": "plain_content", + "message": "plain_content can't be blank, please provide plain text or html content" + }, + { + "field": "list_id", + "message": "You must select at least 1 segment or 1 list to send to." + }, + { + "field": "unsubscribe_tag", + "message": "An [unsubscribe] tag in both your html and plain content is required to send a campaign." + }, + { + "field": "suppression_group_id", + "message": "Either a suppression_group_id or custom_unsubscribe_url is required to send a campaign." + }, + { + "field": null, + "message": "You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "403": { + "description": "\"\": \"You may only send a campaign when it is in draft mode.\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "You may only send a campaign when it is in draft mode." + } + ] + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_campaigns-campaignid-schedules-now", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/campaigns/{campaign_id}/schedules": { + "parameters": [ + { + "name": "campaign_id", + "in": "path", + "required": true, + "type": "integer" + } + ], + "post": { + "operationId": "POST_campaigns-campaign_id-schedules", + "summary": "Schedule a Campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to schedule a specific date and time for your campaign to be sent.**\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "title": "Schedule a Campaign request", + "type": "object", + "properties": { + "send_at": { + "type": "integer", + "description": "The unix timestamp for the date and time you would like your campaign to be sent out." + } + }, + "required": [ + "send_at" + ], + "example": { + "send_at": 1489771528 + } + } + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "title": "Schedule a Campaign response", + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The campaign ID." + }, + "send_at": { + "type": "integer", + "description": "The date time you scheduled your campaign to be sent." + }, + "status": { + "type": "string", + "description": "The status of your campaign.", + "enum": [ + "Scheduled" + ] + } + }, + "required": [ + "id", + "send_at", + "status" + ] + }, + "examples": { + "application/json": { + "id": 1234, + "send_at": 1489771528, + "status": "Scheduled" + } + } + }, + "400": { + "description": "\"subject\": \"subject can't be blank\"\n\"sender_id\": \"sender_id can't be blank\"\n\"plain_content\": \"plain_content can't be blank, please provide plain text or html content\"\n\"list_ids\": \"You must select at least 1 segment or 1 list to send to.\"\n\"send_at\": \"Please choose a future time for sending your campaign.\"\n\"unsubscribe_tag\": \"An [unsubscribe] tag in both your html and plain content is required to send a campaign.\"\n\"suppression_group_id\": \"Either a suppression_group_id or custom_unsubscribe_url is required to send a campaign.\"\n\"\": \"The JSON you have submitted cannot be parsed.\"\n\"\":\"You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "subject", + "message": "subject can't be blank" + }, + { + "field": "sender_id", + "message": "sender_id can't be blank" + }, + { + "field": "plain_content", + "message": "plain_content can't be blank, please provide plain text or html content" + }, + { + "field": "list_id", + "message": "You must select at least 1 segment or 1 list to send to." + }, + { + "field": "unsubscribe_tag", + "message": "An [unsubscribe] tag in both your html and plain content is required to send a campaign." + }, + { + "field": "suppression_group_id", + "message": "Either a suppression_group_id or custom_unsubscribe_url is required to send a campaign." + }, + { + "field": null, + "message": "You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "403": { + "description": "\"\": \"You cannot POST to a campaign that has already sent or scheduled. However you can update a scheduled campaign with a PATCH.\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "You cannot POST to a campaign that has already sent or scheduled. However you can update a scheduled campaign with a PATCH." + } + ] + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_campaigns-campaignid-schedules", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_campaigns-campaign_id-schedules", + "summary": "Update a Scheduled Campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows to you change the scheduled time and date for a campaign to be sent.**\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "title": "Update a Scheduled Campaign request", + "type": "object", + "properties": { + "send_at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "send_at" + ], + "example": { + "send_at": 1489451436 + } + } + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "title": "Update a Scheduled Campaign response", + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The campaign ID" + }, + "send_at": { + "type": "integer", + "description": "The unix timestamp to send the campaign." + }, + "status": { + "type": "string", + "description": "The status of the schedule." + } + }, + "required": [ + "id", + "send_at", + "status" + ] + } + }, + "400": { + "description": "\"\": \"The JSON you have submitted cannot be parsed.\"\n\"send_at\": \"Please choose a future time for sending your campaign.\"\n\"\":\"You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "send_at", + "message": "Please choose a future time for sending your campaign." + }, + { + "field": null, + "message": "The JSON you have submitted cannot be parsed." + }, + { + "field": null, + "message": "You do not have enough credits to send this campaign. Upgrade your plan to send https://app.sendgrid.com/settings/billing" + } + ] + } + } + }, + "403": { + "description": "\"send_at\": \"You cannot update the send_at value of non-scheduled campaign.\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "send_at", + "message": "You cannot update the send_at value of non-scheduled campaign." + } + ] + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_campaigns-campaignid-schedules", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + }, + "get": { + "operationId": "GET_campaigns-campaign_id-schedules", + "summary": "View Scheduled Time of a Campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to retrieve the date and time that the given campaign has been scheduled to be sent.**\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "", + "schema": { + "title": "View Scheduled Time of a Campaign response", + "type": "object", + "properties": { + "send_at": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "send_at" + ] + }, + "examples": { + "application/json": { + "send_at": 1490778528 + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_campaigns-campaignid-schedules", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_campaigns-campaign_id-schedules", + "summary": "Unschedule a Scheduled Campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to unschedule a campaign that has already been scheduled to be sent.**\n\nA successful unschedule will return a 204.\nIf the specified campaign is in the process of being sent, the only option is to cancel (a different method).\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + } + }, + "403": { + "description": "\"\": \"This campaign is already In Progress.\"\n\"\": \"This campaign is already Sent.\"\n\"\": \"This campaign is already Paused.\"\n\"\": \"This campaign is already Canceled.\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "This campaign is already In Progress." + }, + { + "field": null, + "message": "This campaign is already Sent." + }, + { + "field": null, + "message": "This campaign is already Paused." + }, + { + "field": null, + "message": "This campaign is already Canceled." + } + ] + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_campaigns-campaignid-schedules", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + } + }, + "/campaigns/{campaign_id}/schedules/test": { + "parameters": [ + { + "name": "campaign_id", + "in": "path", + "required": true, + "type": "integer" + } + ], + "post": { + "operationId": "POST_campaigns-campaign_id-schedules-test", + "summary": "Send a Test Campaign", + "tags": [ + "Campaigns API" + ], + "description": "**This endpoint allows you to send a test campaign.**\n\nTo send to multiple addresses, use an array for the JSON \"to\" value [\"one@address\",\"two@address\"]\n\nFor more information:\n\n* [User Guide > Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "to": { + "type": "string", + "description": "The email address that should receive the test campaign.", + "format": "email" + } + }, + "required": [ + "to" + ], + "example": { + "to": "your.email@example.com" + } + } + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "title": "Send a Test Campaign request", + "type": "object", + "properties": { + "to": { + "type": "string" + } + }, + "required": [ + "to" + ] + } + }, + "400": { + "description": "\"\": \"The JSON you have submitted cannot be parsed.\"\n\"to\": \"Please provide an email address to which the test should be sent.\"\n\"to\": \"You can only send tests to 10 addresses at a time.\"\n\"subject\": \"Please add a subject to your campaign before sending a test.\"\n\"plain_content\": \"Plain content and html content can't both be blank. Please set one of these values before sending a test.\"\n\"sender_id\": \"Please assign a sender identity to your campaign before sending a test.\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "send_at", + "message": "Please choose a future time for sending your campaign." + }, + { + "field": null, + "message": "The JSON you have submitted cannot be parsed." + }, + { + "field": null, + "message": "You do not have enough credits to send this campaign. Upgrade your plan to send more: https://app.sendgrid.com/settings/billing" + } + ] + } + } + }, + "404": { + "description": "\"\": \"not found\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_campaigns-campaignid-schedules-test", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + } + }, + "/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. This batch ID can be associated with scheduled sends via the mail/send endpoint.**\n\nIf you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at anytime up to 10 minutes before the schedule date, you can cancel all of the mail/send requests that have this batch ID by calling the Cancel Scheduled Send endpoint. \n\nMore Information:\n\n* [Scheduling Parameters > Batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_batch_id" + }, + "examples": { + "application/json": { + "batch_id": "YOUR_BATCH_ID" + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_mail-batch", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/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\nIf you set the SMTPAPI header `batch_id`, it allows you to then associate multiple scheduled mail/send requests together with the same ID. Then at anytime up to 10 minutes before the schedule date, you can cancel all of the mail/send requests that have this batch ID by calling the Cancel Scheduled Send endpoint. \n\nMore Information:\n\n* [Scheduling Parameters > Batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_batch_id" + }, + "examples": { + "application/json": { + "batch_id": "HkJ5yLYULb7Rj8GKSx7u025ouWVlMgAi" + } + } + }, + "400": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "invalid batch id" + } + ] + } + } + }, + "401": { + "description": "Unexpected error in API call. See HTTP response body for details.", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mail-batch-batchid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/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 an email that has been scheduled to be sent.**\n\nIf the maximum number of cancellations/pauses are added, HTTP 400 will\nbe returned.\n\nThe Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + } + } + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/user_scheduled_send_status" + } + }, + "400": { + "description": "\"\" : \"max limit reached\"\n\"batch_id\" : \"invalid batch id\"\n\"batch_id\" : \"a status for this batch id exists, try PATCH to update the status\"", + "schema": { + "type": "object" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "max limit reached" + }, + { + "field": "batch_id", + "message": "invalid batch id" + }, + { + "field": "batch_id", + "message": "a status for this batch id exists, try PATCH to update the status" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "type": "object" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_user-scheduledsends", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "get": { + "operationId": "GET_user-scheduled_sends", + "summary": "Retrieve all scheduled sends", + "tags": [ + "Cancel Scheduled Sends" + ], + "description": "**This endpoint allows you to retrieve all cancel/paused scheduled send information.**\n\nThe Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/user_scheduled_send_status" + } + }, + "examples": { + "application/json": [ + { + "batch_id": "YzJlNTkxMmEtOWM3Ny0xMWU1LTkwM2UtNTI1NDAwNmQzZmYzLTVlM2NhNWIwYg", + "status": "cancel" + }, + { + "batch_id": "UtNTI1NDAwNmQzZmYzLTVlM2NhNWIwYgYzJlNTkxMmEtOWM3Ny0xMWU1LTkwM2", + "status": "cancel" + } + ] + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_user-scheduledsends", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + } + }, + "/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`.**\n\nThe Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.", + "produces": [ + "application/json" + ], + "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" + } + ] + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_user-scheduledsends-batchid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_user-scheduled_sends-batch_id", + "summary": "Update user scheduled send information", + "tags": [ + "Cancel Scheduled Sends" + ], + "description": "**This endpoint allows you to update the status of a scheduled send for the given `batch_id`.**\n\nThe Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + } + } + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + } + }, + "400": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "status", + "message": "status must be either cancel or pause" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"\" : \"batch id not found\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "batch id not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_user-scheduledsends-batchid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_user-scheduled_sends-batch_id", + "summary": "Delete a cancellation or pause of a scheduled send", + "tags": [ + "Cancel Scheduled Sends" + ], + "description": "**This endpoint allows you to delete the cancellation/pause of a scheduled send.**\n\nThe Cancel Scheduled Sends feature allows the customer to cancel a scheduled send based on a Batch ID included in the SMTPAPI header. Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "batch id not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_user-scheduledsends-batchid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/categories": { + "get": { + "operationId": "GET_categories", + "summary": "Retrieve all categories", + "tags": [ + "Categories" + ], + "description": "**This endpoint allows you to retrieve a list of all of your categories.**\n\nCategories can help organize your email analytics by enabling you to “tag” emails by type or broad topic. You can define your own custom categories. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "The number of categories to display per page.", + "type": "integer", + "default": 50 + }, + { + "name": "category", + "in": "query", + "description": "Allows you to perform a prefix search on this particular category.", + "type": "string" + }, + { + "name": "offset", + "in": "query", + "description": "The point in the list that you would like to begin displaying results.", + "type": "integer", + "default": 0 + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "category": { + "type": "string", + "description": "A category used to group emails by broad topic." + } + }, + "required": [ + "category" + ] + } + }, + "examples": { + "application/json": [ + { + "category": "category 1" + }, + { + "category": "category 2" + } + ] + } + }, + "400": { + "description": "", + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "description": "The error returned.", + "items": { + "type": "object", + "properties": { + "field": { + "type": "string" + }, + "message": { + "type": "string", + "description": "A message explaining why your categories could not be retrieved." + } + }, + "required": [ + "field", + "message" + ] + } + } + } + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "sort_by", + "message": "invalid sort value" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_categories", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/categories/stats/sums": { + "get": { + "operationId": "GET_categories-stats-sums", + "summary": "Retrieve sums of email stats for each category [Needs: Stats object defined, has category ID?]", + "tags": [ + "Categories" + ], + "description": "**This endpoint allows you to retrieve the total sum of each email statistic for every category over the given date range.**\n\nIf you do not define any query parameters, this endpoint will return a sum for each category in groups of 10.\n\nCategories allow you to group your emails together according to broad topics that you define. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "sort_by_metric", + "in": "query", + "description": "The metric that you want to sort by. Must be a single metric.", + "required": false, + "type": "string", + "default": "delivered" + }, + { + "name": "sort_by_direction", + "in": "query", + "description": "The direction you want to sort.", + "required": false, + "type": "string", + "default": "desc", + "enum": [ + "desc", + "asc" + ] + }, + { + "name": "start_date", + "in": "query", + "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", + "required": true, + "type": "string" + }, + { + "name": "end_date", + "in": "query", + "description": "The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD.", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "description": "Limits the number of results returned.", + "required": false, + "type": "integer", + "default": 5 + }, + { + "name": "offset", + "in": "query", + "description": "The point in the list to begin retrieving results.", + "required": false, + "type": "integer", + "default": 0 + }, + { + "name": "aggregated_by", + "in": "query", + "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", + "required": false, + "type": "string", + "enum": [ + "day", + "week", + "month" + ] + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/category_stats" + }, + "examples": { + "application/json": { + "date": "2015-01-01", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 20, + "deferred": 0, + "delivered": 20, + "invalid_emails": 0, + "opens": 20, + "processed": 0, + "requests": 20, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 20, + "unique_opens": 20, + "unsubscribe_drops": 0, + "unsubscribes": 20 + }, + "name": "cat1", + "type": "category" + }, + { + "metrics": { + "blocks": 1, + "bounce_drops": 0, + "bounces": 0, + "clicks": 19, + "deferred": 0, + "delivered": 19, + "invalid_emails": 0, + "opens": 19, + "processed": 0, + "requests": 20, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 19, + "unique_opens": 19, + "unsubscribe_drops": 0, + "unsubscribes": 19 + }, + "name": "cat2", + "type": "category" + }, + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 5, + "deferred": 0, + "delivered": 5, + "invalid_emails": 0, + "opens": 5, + "processed": 0, + "requests": 5, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 5, + "unique_opens": 5, + "unsubscribe_drops": 0, + "unsubscribes": 5 + }, + "name": "cat3", + "type": "category" + }, + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 6, + "deferred": 0, + "delivered": 5, + "invalid_emails": 0, + "opens": 6, + "processed": 0, + "requests": 5, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 5, + "unique_opens": 5, + "unsubscribe_drops": 0, + "unsubscribes": 6 + }, + "name": "cat4", + "type": "category" + }, + { + "metrics": { + "blocks": 10, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 10, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + }, + "name": "cat5", + "type": "category" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_categories-stats-sums", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/categories/stats": { + "get": { + "operationId": "GET_categories-stats", + "summary": "Retrieve Email Statistics for Categories", + "tags": [ + "Categories" + ], + "description": "**This endpoint allows you to retrieve all of your email statistics for each of your categories.**\n\nIf you do not define any query parameters, this endpoint will return a sum for each category in groups of 10.\n\nCategories allow you to group your emails together according to broad topics that you define. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/categories.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_date", + "in": "query", + "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD", + "required": true, + "type": "string" + }, + { + "name": "end_date", + "in": "query", + "description": "The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD.", + "required": false, + "type": "string" + }, + { + "name": "categories", + "in": "query", + "description": "The individual categories that you want to retrieve statistics for. You may include up to 10 different categories.", + "required": true, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "description": "The number of results to include.", + "required": false, + "type": "integer", + "default": 500, + "maximum": 500 + }, + { + "name": "offset", + "in": "query", + "description": "The number of results to skip.", + "required": false, + "type": "integer" + }, + { + "name": "aggregated_by", + "in": "query", + "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", + "required": false, + "type": "string", + "enum": [ + "day", + "week", + "month" + ] + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/category_stats" + } + }, + "examples": { + "application/json": [ + { + "date": "2015-10-01", + "stats": [ + { + "type": "category", + "name": "docs", + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + }, + { + "type": "category", + "name": "mattscategory", + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + }, + { + "date": "2015-11-01", + "stats": [ + { + "type": "category", + "name": "docs", + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + }, + { + "type": "category", + "name": "mattscategory", + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_categories-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/contactdb/custom_fields": { + "post": { + "operationId": "POST_contactdb-custom_fields", + "summary": "Create a Custom Field", + "tags": [ + "Contacts API - Custom Fields" + ], + "description": "**This endpoint allows you to create a custom field.**\n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "example": { + "name": "pet", + "type": "text" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "examples": { + "application/json": { + "id": 1, + "name": "pet", + "type": "text" + } + } + }, + "400": { + "description": "\"\" : \"Returned if request body is invalid JSON\"\n\"type\" : \"Returned if custom field type is invalid or not provided\"\n\"name\" : \"Returned if custom field name is not provided\"", + "schema": { + "$ref": "#/definitions/errors" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "Returned if request body is invalid JSON" + }, + { + "field": "type", + "message": "Returned if custom field type is invalid or not provided" + }, + { + "field": "name", + "message": "Returned if custom field name is not provided" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_contactdb-customfields", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "get": { + "operationId": "GET_contactdb-custom_fields", + "summary": "Retrieve all custom fields", + "tags": [ + "Contacts API - Custom Fields" + ], + "description": "**This endpoint allows you to retrieve all custom fields.** \n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "title": "List All Custom Fields response", + "type": "object", + "properties": { + "custom_fields": { + "type": "array", + "items": { + "$ref": "#/definitions/contactdb_custom_field_with_id" + } + } + }, + "required": [ + "custom_fields" + ] + }, + "examples": { + "application/json": { + "custom_fields": [ + { + "id": 6234, + "name": "age", + "type": "number" + }, + { + "id": 6233, + "name": "country", + "type": "text" + }, + { + "id": 6235, + "name": "favorite_color", + "type": "text" + }, + { + "id": 6239, + "name": "fname", + "type": "text" + }, + { + "id": 6240, + "name": "lname", + "type": "text" + }, + { + "id": 49439, + "name": "pet", + "type": "text" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-customfields", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/contactdb/custom_fields/{custom_field_id}": { + "parameters": [ + { + "name": "custom_field_id", + "in": "path", + "description": "The ID of the custom field that you want to retrieve.", + "required": true, + "type": "integer" + } + ], + "get": { + "operationId": "GET_contactdb-custom_fields-custom_field_id", + "summary": "Retrieve a Custom Field", + "tags": [ + "Contacts API - Custom Fields" + ], + "description": "**This endpoint allows you to retrieve a custom field by ID.**\n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/contactdb_custom_field_with_id" + }, + "examples": { + "application/json": { + "id": 1, + "name": "pet", + "type": "text" + } + } + }, + "400": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "invalid id" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"custom_field_id\" : \"Returned if custom_field_id does not exist\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "Custom field ID does not exist" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-customfields-customfieldid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_contactdb-custom_fields-custom_field_id", + "summary": "Delete a Custom Field", + "tags": [ + "Contacts API - Custom Fields" + ], + "description": "**This endpoint allows you to delete a custom field by ID.**\n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "message": "Custom Field delete is processing." + } + } + }, + "400": { + "description": "\"id\" : \"Returned if custom_field_id is not valid\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "Custom field in use by one or more segment conditions" + }, + { + "message": "Custom field ID does not exist" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"custom_field_id\" : \"Returned if custom_field_id does not exist\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "Custom field ID does not exist" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_contactdb-customfields-customfieldid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/contactdb/reserved_fields": { + "get": { + "operationId": "GET_contactdb-reserved_fields", + "summary": "Retrieve reserved fields", + "tags": [ + "Contacts API - Custom Fields" + ], + "description": "**This endpoint allows you to list all fields that are reserved and can't be used for custom field names.**\n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "title": "List fields that are reserved and can't be used for custom field names. response", + "type": "object", + "properties": { + "reserved_fields": { + "type": "array", + "description": "The reserved fields that are already set up within custom fields.", + "items": { + "$ref": "#/definitions/contactdb_custom_field" + } + } + }, + "required": [ + "reserved_fields" + ] + }, + "examples": { + "application/json": { + "reserved_fields": [ + { + "name": "first_name", + "type": "text" + }, + { + "name": "last_name", + "type": "text" + }, + { + "name": "email", + "type": "text" + }, + { + "name": "created_at", + "type": "date" + }, + { + "name": "updated_at", + "type": "date" + }, + { + "name": "last_emailed", + "type": "date" + }, + { + "name": "last_clicked", + "type": "date" + }, + { + "name": "last_opened", + "type": "date" + }, + { + "name": "my_custom_field", + "type": "text" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-reservedfields", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_contactdb-lists", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + }, + "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.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-lists", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_contactdb-lists", + "summary": "Delete Multiple lists", + "tags": [ + "Contacts API - Lists" + ], + "description": "**This endpoint allows you to delete multiple recipient lists.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "list id was invalid" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_contactdb-lists", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "invalid id" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"list_id\" : \"Returned if list_id does not exist\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "List ID does not exist" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-lists-listid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "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.**\n\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "invalid id" + } + ] + } + } + }, + "404": { + "description": "\"list_id\" : \"Returned if list_id does not exist\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "List ID does not exist" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_contactdb-lists-listid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "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.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"list_id\" : \"Returned if list_id does not exist\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "List not found: 5" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_contactdb-lists-listid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.** \n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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" + }, + { + "$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:ErrorResponse" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-lists-listid-recipients", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "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.\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "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:ErrorResponse" + }, + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"list_id\": \"Returned if list_id does not exist\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "list_id", + "message": "list_id does not exist" + }, + { + "field": "recipient_id", + "message": "recipient_id does not exist" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_contactdb-lists-listid-recipients", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$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:ErrorResponse" + }, + "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:ErrorResponse" + }, + "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:ErrorResponse" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "POST_contactdb-lists-listid-recipients-recipientid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + }, + "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.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "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:ErrorResponse" + }, + "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:ErrorResponse" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "DELETE_contactdb-lists-listid-recipients-recipientid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/contactdb/status": { + "get": { + "operationId": "GET_contactdb-status", + "summary": "Get Contact Upload Status", + "tags": [ + "Contacts API - Recipients" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:authorizationHeader:Authorization" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "status": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "value": { + "type": "string" + } + } + } + } + } + }, + "examples": { + "application/json": { + "status": [ + { + "id": "worker_delay", + "value": "delayed" + }, + { + "id": "worker_delay_seconds", + "value": "75.0" + } + ] + } + } + } + }, + "x-stoplight": { + "id": "GET_contactdb-status", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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 Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "Request body is not valid json" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_contactdb-recipients", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "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.\n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "Request body is not valid json" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_contactdb-recipients", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + }, + "delete": { + "operationId": "DELETE_contactdb-recipients", + "summary": "Delete Recipient", + "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.\n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "No recipient ids provided" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_contactdb-recipients", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "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.\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-recipients", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-recipients-recipientid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + }, + "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\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "recipient not found" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "recipient_id is not valid" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_contactdb-recipients-recipientid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "recipient ID is invalid" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "recipient id not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-recipients-recipientid-lists", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-recipients-billablecount", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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.**\n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-recipients-count", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/contactdb/recipients/search": { + "get": { + "operationId": "GET_contactdb-recipients-search", + "summary": "Retrieve recipients matching search criteria", + "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.\n\nThe contactdb is a database of your contacts for [SendGrid Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html).", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-recipients-search", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/contactdb/segments": { + "post": { + "operationId": "POST_contactdb-segments", + "summary": "Create a Segment", + "tags": [ + "Contacts API - Segments" + ], + "description": "**This endpoint allows you to create a segment.**\n\nAll recipients in your contactdb will be added or removed automatically depending on whether they match the criteria for this segment.\n\nList Id:\n\n* Send this to segment from an existing list\n* Don't send this in order to segment from your entire contactdb.\n\nValid operators for create and update depend on the type of the field you are segmenting: \n\n* **Dates:** \"eq\", \"ne\", \"lt\" (before), \"gt\" (after) \n* **Text:** \"contains\", \"eq\" (is - matches the full field), \"ne\" (is not - matches any field where the entire field is not the condition value) \n* **Numbers:** \"eq\", \"lt\", \"gt\" \n* **Email Clicks and Opens:** \"eq\" (opened), \"ne\" (not opened) \n\nSegment conditions using \"eq\" or \"ne\" for email clicks and opens should provide a \"field\" of either *clicks.campaign_identifier* or *opens.campaign_identifier*. The condition value should be a string containing the id of a completed campaign. \n\nSegments may contain multiple condtions, joined by an \"and\" or \"or\" in the \"and_or\" field. The first condition in the conditions list must have an empty \"and_or\", and subsequent conditions must all specify an \"and_or\".\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.\n\nFor more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/contactdb_segments", + "example": { + "name": "Last Name Miller", + "list_id": 4, + "conditions": [ + { + "field": "last_name", + "value": "Miller", + "operator": "eq", + "and_or": "" + }, + { + "field": "last_clicked", + "value": "01/02/2015", + "operator": "gt", + "and_or": "and" + }, + { + "field": "clicks.campaign_identifier", + "value": "513", + "operator": "eq", + "and_or": "or" + } + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/contactdb_segments_with_id" + }, + "examples": { + "application/json": { + "id": 1, + "name": "Last Name Miller", + "list_id": 4, + "conditions": [ + { + "field": "last_name", + "value": "Miller", + "operator": "eq", + "and_or": "" + }, + { + "field": "last_clicked", + "value": "01/02/2015", + "operator": "gt", + "and_or": "and" + }, + { + "field": "clicks.campaign_identifier", + "value": "513", + "operator": "eq", + "and_or": "or" + } + ], + "recipient_count": 0 + } + } + }, + "400": { + "description": "\"name\" : \"Returned if the name is not valid\"\n\"list_id\" : \"Returned if the list_id is not valid\"\n\"and_or\" : \"Returned if and_or and set value is not passed into the request body\"\n\"and_or\" : \"Returned if and_or is set on the only condition passed\"\n\"and_or\" : \"Returned if and_or is set on all conditions\"\n\"and_or\" : \"Returned if and_or is not set on more than one condition and less than all conditions\"\n\"operator\" : \"Returned if operator and set value is not passed into the request body\"\n\"value\" : \"Returned if value and set value is not passed into the request body\"\n\"field\" : \"Returned if field and set value is not passed into the request body\"\n\"\" : \"Returned if request body is not valid json\"\n\"\" : \"Returned if invalid value is passed into one of the request body parameters\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "request body is not valid json" + }, + { + "message": "invalid value is passed into one of the request body parameters" + }, + { + "field": "field", + "message": "field and set value is not passed into the request body" + }, + { + "field": "value", + "message": "value and set value is not passed into the request body" + }, + { + "field": "operator", + "message": "operator and set value is not passed into the request body" + }, + { + "field": "and_or", + "message": "and_or is not set on more than one condition and less than all conditions" + }, + { + "field": "and_or", + "message": "and_or is set on all conditions" + }, + { + "field": "and_or", + "message": "and_or is set on the only condition passed" + }, + { + "field": "and_or", + "message": "and_or and set value is not passed into the request body" + }, + { + "field": "list_id", + "message": "the list_id is not valid" + }, + { + "field": "name", + "message": "the name is not valid" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_contactdb-segments", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "get": { + "operationId": "GET_contactdb-segments", + "summary": "Retrieve all segments", + "tags": [ + "Contacts API - Segments" + ], + "description": "**This endpoint allows you to retrieve all of your segments.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.\n\nFor more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "title": "List All Segments response", + "type": "object", + "properties": { + "segments": { + "type": "array", + "items": { + "$ref": "#/definitions/contactdb_segments" + } + } + }, + "required": [ + "segments" + ] + }, + "examples": { + "application/json": { + "segments": [ + { + "id": 1234, + "name": "Age segments < 25", + "conditions": [ + { + "field": "age", + "value": "25", + "operator": "lt" + } + ], + "recipient_count": 8 + }, + { + "id": 2345, + "name": "email address - gmail", + "conditions": [ + { + "field": "email", + "value": "@gmail.com", + "operator": "contains" + } + ], + "recipient_count": 0 + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-segments", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + } + }, + "/contactdb/segments/{segment_id}": { + "parameters": [ + { + "name": "segment_id", + "in": "path", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_contactdb-segments-segment_id", + "summary": "Retrieve a segment", + "tags": [ + "Contacts API - Segments" + ], + "description": "**This endpoint allows you to retrieve a single segment with the given ID.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.\n\nFor more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "segment_id", + "in": "query", + "description": "The ID of the segment you want to request.", + "required": true, + "type": "integer" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/contactdb_segments" + }, + "examples": { + "application/json": { + "id": 1, + "name": "Last Name Miller", + "list_id": 4, + "conditions": [ + { + "field": "last_name", + "value": "Miller", + "operator": "eq", + "and_or": "" + } + ], + "recipient_count": 1 + } + } + }, + "400": { + "description": "\"segment_id\" : \"Returned if segment_id is not valid\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "if segment_id is not valid" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"segment_id\" : \"Returned if segment_id does not exist\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "segment_id not found" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-segments-segmentid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + }, + "patch": { + "operationId": "PATCH_contactdb-segments-segment_id", + "summary": "Update a segment", + "tags": [ + "Contacts API - Segments" + ], + "description": "**This endpoint allows you to update a segment.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.\n\nFor more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "segment_id", + "in": "query", + "description": "The ID of the segment you are updating.", + "type": "string" + }, + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "list_id": { + "type": "number", + "description": "The list ID you would like this segment to be built from." + }, + "conditions": { + "type": "array", + "description": "The conditions by which this segment should be created.", + "items": { + "$ref": "#/definitions/contactdb_segments_conditions" + } + } + }, + "required": [ + "name" + ], + "example": { + "name": "The Millers", + "list_id": 5, + "conditions": [ + { + "field": "last_name", + "value": "Miller", + "operator": "eq", + "and_or": "" + } + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/contactdb_segments" + }, + "examples": { + "application/json": { + "id": 5, + "name": "The Millers", + "list_id": 5, + "conditions": [ + { + "field": "last_name", + "value": "Miller", + "operator": "eq", + "and_or": "" + } + ], + "recipient_count": 1 + } + } + }, + "400": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "request body is not valid json" + }, + { + "message": "invalid value is passed into one of the request body parameters" + }, + { + "segment_id": "segment_id", + "message": "segment id is not valid" + }, + { + "field": "field", + "message": "field and set value is not passed into the request body" + }, + { + "field": "value", + "message": "value and set value is not passed into the request body" + }, + { + "field": "operator", + "message": "operator and set value is not passed into the request body" + }, + { + "field": "and_or", + "message": "and_or is not set on more than one condition and less than all conditions" + }, + { + "field": "and_or", + "message": "and_or is set on all conditions" + }, + { + "field": "and_or", + "message": "and_or is set on the only condition passed" + }, + { + "field": "and_or", + "message": "and_or and set value is not passed into the request body" + }, + { + "field": "list_id", + "message": "the list_id is not valid" + }, + { + "field": "name", + "message": "the name is not valid" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_contactdb-segments-segmentid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "dynamic": false, + "enabled": false + } + } + }, + "delete": { + "operationId": "DELETE_contactdb-segments-segment_id", + "summary": "Delete a segment", + "tags": [ + "Contacts API - Segments" + ], + "description": "**This endpoint allows you to delete a segment from your recipients database.**\n\nYou also have the option to delete all the contacts from your Marketing Campaigns recipient database who were in this segment.\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.\n\nFor more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "delete_contacts", + "in": "query", + "description": "True to delete all contacts matching the segment in addition to deleting the segment", + "type": "boolean" + }, + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + } + }, + "400": { + "description": "\"segment_id\" : \"Returned if segment_id is not valid\"\n\"delete_contacts\" : \"Returned if delete_contacts is not a valid boolean\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "segment_id", + "message": "Returned if segment_id is not valid" + }, + { + "field": "delete_contacts", + "message": "Returned if delete_contacts is not a valid boolean" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"segment_id\" : \"Returned if segment_id does not exist\"", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "segment_id", + "message": "segment_id does not exist" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_contactdb-segments-segmentid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + } + }, + "/contactdb/segments/{segment_id}/recipients": { + "parameters": [ + { + "name": "segment_id", + "in": "path", + "description": "The ID of the segment from which you want to retrieve recipients.", + "required": true, + "type": "integer" + } + ], + "get": { + "operationId": "GET_contactdb-segments-segment_id-recipients", + "summary": "Retrieve recipients on a segment", + "tags": [ + "Contacts API - Segments" + ], + "description": "**This endpoint allows you to retrieve all of the recipients in a segment with the given ID.**\n\nThe Contacts API helps you manage your [Marketing Campaigns](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/index.html) recipients.\n\nFor more information about segments in Marketing Campaigns, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/lists.html#-Create-a-Segment).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "page", + "in": "query", + "type": "integer" + }, + { + "name": "page_size", + "in": "query", + "type": "integer" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "title": "List Recipients On a Segment response", + "type": "object", + "properties": { + "recipients": { + "type": "array", + "items": { + "$ref": "#/definitions/contactdb_recipient" + } + } + }, + "required": [ + "recipients" + ] + }, + "examples": { + "application/json": { + "recipients": [ + { + "created_at": 1422313607, + "email": "jones@example.com", + "first_name": null, + "id": "YUBh", + "last_clicked": null, + "last_emailed": null, + "last_name": "Jones", + "last_opened": null, + "updated_at": 1422313790, + "custom_fields": [ + { + "id": 23, + "name": "pet", + "value": "Indiana", + "type": "text" + } + ] + } + ] + } + } + }, + "400": { + "description": "\"page\" : \"Returned if page is not a valid integer\"\n\"page\" : \"Returned if page is less than 1\"\n\"page_size\" : \"Returned if page_size is not a valid integer\"", + "schema": { + "type": "object" + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "\"segment_id\" : \"Returned if segment_id is not valid\"\n\"segment_id\" : \"Returned if segment_id does not exist\"", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_contactdb-segments-segmentid-recipients", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/suppression/invalid_emails": { + "get": { + "operationId": "GET_suppression-invalid_emails", + "summary": "Retrieve all invalid emails", + "tags": [ + "Invalid Emails API" + ], + "description": "**This endpoint allows you to retrieve a list of all invalid email addresses.**\n\nAn invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipient’s mail server.\n\nExamples include addresses without the “@” sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_time", + "in": "query", + "description": "Refers start of the time range in unix timestamp when an invalid email was created (inclusive).", + "type": "integer" + }, + { + "name": "end_time", + "in": "query", + "description": "Refers end of the time range in unix timestamp when an invalid email was created (inclusive).", + "type": "integer" + }, + { + "name": "limit", + "in": "query", + "description": "Limit the number of results to be displayed per page.", + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "Paging offset. The point in the list to begin displaying results.", + "type": "integer" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "description": "The list of invalid email addresses.", + "items": { + "type": "object", + "properties": { + "created": { + "type": "integer", + "description": "A Unix timestamp indicating when the email address was added to the invalid emails list." + }, + "email": { + "type": "string", + "description": "The email address that was marked as invalid." + }, + "reason": { + "type": "string", + "description": "The reason that the email address was marked as invalid." + } + }, + "required": [ + "created", + "email", + "reason" + ] + } + }, + "examples": { + "application/json": [ + { + "created": 1449953655, + "email": "user1@example.com", + "reason": "Mail domain mentioned in email address is unknown" + }, + { + "created": 1449939373, + "email": "user1@example.com", + "reason": "Mail domain mentioned in email address is unknown" + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_suppression-invalidemails", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_suppression-invalid_emails", + "summary": "Delete invalid emails", + "tags": [ + "Invalid Emails API" + ], + "description": "**This endpoint allows you to remove email addresses from your invalid email address list.**\n\nThere are two options for deleting invalid email addresses: \n\n1) You can delete all invalid email addresses by setting `delete_all` to true in the request body.\n2) You can delete some invalid email addresses by specifying certain addresses in an array in the request body.\n\nAn invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipient’s mail server.\n\nExamples include addresses without the “@” sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "delete_all": { + "type": "boolean", + "description": "Indicates if you want to remove all email address from the invalid emails list." + }, + "emails": { + "type": "array", + "description": "The list of specific email addresses that you want to remove.", + "items": { + "type": "string" + } + } + }, + "example": { + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_suppression-invalidemails", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/suppression/invalid_emails/{email}": { + "parameters": [ + { + "name": "email", + "in": "path", + "description": "The specific email address of the invalid email entry that you want to retrieve.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_suppression-invalid_emails-email", + "summary": "Retrieve a specific invalid email", + "tags": [ + "Invalid Emails API" + ], + "description": "**This endpoint allows you to retrieve a specific invalid email addresses.**\n\nAn invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipient’s mail server.\n\nExamples include addresses without the “@” sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:authorizationHeader:Authorization" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "created": { + "type": "integer", + "description": "A Unix timestamp indicating when the email address was added to the invalid emails list." + }, + "email": { + "type": "string", + "description": "The email address that was marked as invalid." + }, + "reason": { + "type": "string", + "description": "A reason explaining why the email address was marked as invalid." + } + }, + "required": [ + "created", + "email", + "reason" + ] + } + }, + "examples": { + "application/json": [ + { + "created": 1454433146, + "email": "test1@example.com", + "reason": "Mail domain mentioned in email address is unknown" + } + ] + } + } + }, + "x-stoplight": { + "id": "GET_suppression-invalidemails-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_suppression-invalid_emails-email", + "summary": "Delete a specific invalid email", + "tags": [ + "Invalid Emails API" + ], + "description": "**This endpoint allows you to remove a specific email address from the invalid email address list.**\n\nAn invalid email occurs when you attempt to send email to an address that is formatted in a manner that does not meet internet email format standards or the email does not exist at the recipient’s mail server.\n\nExamples include addresses without the “@” sign or addresses that include certain special characters and/or spaces. This response can come from our own server or the recipient mail server.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/invalid_emails.html).", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:authorizationHeader:Authorization" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "x-stoplight": { + "id": "DELETE_suppression-invalidemails-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/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.**\n\nIP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.\n\nFor more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).", + "produces": [ + "application/json" + ], + "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", + "items": { + "type": "object", + "properties": { + "allowed": { + "type": "boolean" + }, + "auth_method": { + "type": "string" + }, + "first_at": { + "type": "integer" + }, + "ip": { + "type": "string" + }, + "last_at": { + "type": "integer" + }, + "location": { + "type": "string" + } + } + } + } + } + }, + "examples": { + "application/json": { + "result": [ + { + "allowed": false, + "auth_method": "basic", + "first_at": 1444087966, + "ip": "1.1.1.1", + "last_at": 1444406672, + "location": "Australia" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_accesssettings-activity", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "statusCode": 200, + "enabled": false + } + } + } + }, + "/access_settings/whitelist": { + "get": { + "operationId": "GET_access_settings-whitelist", + "summary": "Retrieve a list of currently whitelisted IPs", + "tags": [ + "IP Access Management" + ], + "description": "**This endpoint allows you to retrieve a list of IP addresses that are currently whitelisted.**\n\nIP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.\n\nFor more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "result": { + "type": "array", + "description": "An array listing all of your whitelisted IPs.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID of the whitelisted IP." + }, + "ip": { + "type": "string", + "description": "The whitelisted IP." + }, + "created_at": { + "type": "integer", + "description": "A Unix timestamp indicating when the IP was whitelisted." + }, + "updated_at": { + "type": "integer", + "description": "A Unix timestamp indicating when the IPs whitelisting status was most recently updated." + } + }, + "required": [ + "id", + "ip", + "created_at", + "updated_at" + ] + } + } + }, + "required": [ + "result" + ] + }, + "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 + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_accesssettings-whitelist", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "post": { + "operationId": "POST_access_settings-whitelist", + "summary": "Add one or more IPs to the whitelist", + "tags": [ + "IP Access Management" + ], + "description": "**This endpoint allows you to add one or more IP addresses to your IP whitelist.**\n\nWhen adding an IP to your whitelist, include the IP address in an array. You can whitelist one IP at a time, or you can whitelist multiple IPs at once.\n\nIP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.\n\nFor more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "ips": { + "type": "array", + "description": "An array containing the IP(s) you want to whitelist.", + "items": { + "type": "object", + "properties": { + "ip": { + "type": "string", + "description": "An IP address that you want to whitelist." + } + }, + "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": { + "type": "object", + "properties": { + "result": { + "type": "array", + "description": "An array listing all of your whitelisted IPs.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID of the whitelisted IP." + }, + "ip": { + "type": "string", + "description": "The whitelisted IP." + }, + "created_at": { + "type": "integer", + "description": "A Unix timestamp indicating when the IP was whitelisted." + }, + "updated_at": { + "type": "integer", + "description": "A Unix timestamp indicating when the IPs whitelisting status was most recently updated." + } + }, + "required": [ + "id", + "ip", + "created_at", + "updated_at" + ] + } + } + }, + "required": [ + "result" + ] + }, + "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 + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_accesssettings-whitelist", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "delete": { + "operationId": "DELETE_access_settings-whitelist", + "summary": "Remove one or more IPs from the whitelist", + "tags": [ + "IP Access Management" + ], + "description": "**This endpoint allows you to remove one or more IPs from your IP whitelist.**\n\nYou can remove one IP at a time, or you can remove multiple IP addresses.\n\nIP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.\n\nFor more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).", + "produces": [ + "application/json" + ], + "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 whitelist.", + "items": { + "type": "integer" + } + } + }, + "example": { + "ids": [ + 1, + 2, + 3 + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_accesssettings-whitelist", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/access_settings/whitelist/{rule_id}": { + "parameters": [ + { + "name": "rule_id", + "in": "path", + "description": "The ID of the whitelisted IP address that you want to retrieve.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_access_settings-whitelist-rule_id", + "summary": "Retrieve a specific whitelisted IP", + "tags": [ + "IP Access Management" + ], + "description": "**This endpoint allows you to retreive a specific IP address that has been whitelisted.**\n\nYou must include the ID for the specific IP address you want to retrieve in your call.\n\nIP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.\n\nFor more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID of the IP address." + }, + "ip": { + "type": "string", + "description": "The IP address." + }, + "created_at": { + "type": "integer", + "description": "A Unix timestamp indicating when the IP was whitelisted." + }, + "updated_at": { + "type": "integer", + "description": "A Unix timestamp indicating when the IP address was last updated." + } + }, + "required": [ + "id", + "ip", + "created_at", + "updated_at" + ] + }, + "examples": { + "application/json": { + "id": 1, + "ip": "192.168.1.1", + "created_at": 1441824715, + "updated_at": 1441824715 + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_accesssettings-whitelist-ruleid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "delete": { + "operationId": "DELETE_access_settings-whitelist-rule_id", + "summary": "Remove a specific IP from the whitelist", + "tags": [ + "IP Access Management" + ], + "description": "**This endpoint allows you to remove a specific IP address from your IP whitelist.**\n\nWhen removing a specific IP address from your whitelist, you must include the ID in your call.\n\nIP Access Management allows you to control which IP addresses can be used to access your account, either through the User Interface or the API. There is no limit to the number of IP addresses that you can add to your whitelist. It is possible to remove your own IP address from the whitelist, thus preventing yourself from accessing your account.\n\nFor more information, please see our [User Guide](http://sendgrid.com/docs/User_Guide/Settings/ip_access_management.html).", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_accesssettings-whitelist-ruleid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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/errors" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "one or more subusers do not belong to this user" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_ips", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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 whitelabel 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.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "ip", + "in": "query", + "description": "The IP address to get", + "type": "string" + }, + { + "name": "exclude_whitelabels", + "in": "query", + "description": "Should we exclude 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 has been whitelabeled." + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_ips", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_ips-remaining", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_ips-assigned", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.", + "produces": [ + "application/json" + ], + "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 has been whitelabeled." + } + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_ips-ipaddress", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + } + }, + "/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\n**Each user can create up to 10 different IP pools.**\n\nIP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.\n\nIP pools can only be used with whitelabeled IP addresses.\n\nIf an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + }, + "examples": { + "application/json": { + "name": "marketing" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_ips-pools", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "get": { + "operationId": "GET_ips-pools", + "summary": "Retrieve all IP pools.", + "tags": [ + "IP Pools" + ], + "description": "**This endpoint allows you to retreive all of your IP pools.**\n\nIP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.\n\nIP pools can only be used with whitelabeled IP addresses.\n\nIf an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ip_pool" + } + }, + "examples": { + "application/json": [ + { + "name": "marketing" + }, + { + "name": "transactional" + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_ips-pools", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + } + }, + "/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 from.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_ips-pools-pool_name", + "summary": "Retrieve all IPs in a specified pool.", + "tags": [ + "IP Pools" + ], + "description": "**This endpoint allows you to list all of the IP addresses that are in a specific IP pool.**\n\nIP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.\n\nIP pools can only be used with whitelabeled IP addresses.\n\nIf an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "pool_name": { + "type": "string", + "description": "The name of the IP pool.", + "maxLength": 64 + }, + "ips": { + "type": "array", + "description": "The list of IP addresses that belong to this IP pool.", + "items": { + "type": "string" + } + } + }, + "required": [ + "pool_name" + ] + } + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_ips-pools-poolname", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "put": { + "operationId": "PUT_ips-pools-pool_name", + "summary": "Update an IP pool’s name.", + "tags": [ + "IP Pools" + ], + "description": "**This endpoint allows you to update the name of an IP pool.**\n\nIP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.\n\nIP pools can only be used with whitelabeled IP addresses.\n\nIf an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "PUT_ips-pools-poolname", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "dynamic": false, + "enabled": false + } + } + }, + "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.**\n\nIP Pools allow you to group your dedicated SendGrid IP addresses together. For example, you could create separate pools for your transactional and marketing email. When sending marketing emails, specify that you want to use the marketing IP pool. This allows you to maintain separate reputations for your different email traffic.\n\nIP pools can only be used with whitelabeled IP addresses.\n\nIf an IP pool is NOT specified for an email, it will use any IP available, including ones in pools.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + } + ], + "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": [] + } + ], + "x-stoplight": { + "id": "DELETE_ips-pools-poolname", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/ips/pools/{pool_name}/ips": { + "parameters": [ + { + "name": "pool_name", + "in": "path", + "description": "The name of the IP pool that you want to add an IP address to.", + "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\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.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "ip": { + "type": "string", + "description": "The IP address that you want to add to an IP 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 list of 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 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": [] + } + ], + "x-stoplight": { + "id": "POST_ips-pools-poolname-ips", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/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 are removing.", + "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.**\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.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + } + ], + "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": [] + } + ], + "x-stoplight": { + "id": "DELETE_ips-pools-poolname-ips-ip", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/ips/warmup": { + "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.**\n\nSendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup.\n\nFor more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/ip_warmup_response" + }, + "examples": { + "application/json": [ + { + "ip": "0.0.0.0", + "start_date": 1409616000 + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_ips-warmup", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "post": { + "operationId": "POST_ips-warmup", + "summary": "Add an IP to warmup", + "tags": [ + "IP Warmup" + ], + "description": "**This endpoint allows you to enter an IP address into warmup mode.**\n\nSendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup.\n\nFor more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "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": [] + } + ], + "x-stoplight": { + "id": "POST_ips-warmup", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/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 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\nSendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup.\n\nFor more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/ip_warmup_response" + } + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_ips-warmup-ipaddress", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_ips-warmup-ip_address", + "summary": "Remove an IP from warmup", + "tags": [ + "IP Warmup" + ], + "description": "**This endpoint allows you to remove an IP address from warmup mode.**\n\nSendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour, with the limit determined by how long the IP address has been in warmup. See the [warmup schedule](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_warmup_schedule.html) for more details on how SendGrid limits your email traffic for IPs in warmup.\n\nFor more general information about warming up IPs, please see our [Classroom](https://sendgrid.com/docs/Classroom/Deliver/Delivery_Introduction/warming_up_ips.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "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": [] + } + ], + "x-stoplight": { + "id": "DELETE_ips-warmup-ipaddress", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/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\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 whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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", + "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." + } + }, + "required": [ + "email" + ] + }, + "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", + "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": [] + } + ], + "x-stoplight": { + "id": "POST_senders", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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.**\n\nSender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_v3-senders", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/senders/{sender_id}": { + "parameters": [ + { + "name": "sender_id", + "in": "path", + "description": "The ID of the sender identity that you want to update.", + "required": true, + "type": "integer" + } + ], + "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. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.\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.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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", + "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." + } + } + }, + "address": { + "type": "string", + "description": "The physical address of the sender identity." + }, + "address_2": { + "type": "string", + "description": "Additional sender identity address information." + }, + "city": { + "type": "string", + "description": "The city of the sender identity." + }, + "state": { + "type": "string", + "description": "The state of the sender identity." + }, + "zip": { + "type": "string", + "description": "The zipcode of the sender identity." + }, + "country": { + "type": "string", + "description": "The country of the sender identity." + } + }, + "example": { + "nickname": "My Sender ID", + "from": { + "email": "from@example.com", + "name": "Example INC" + }, + "reply_to": { + "email": "replyto@example.com", + "name": "Example INC" + }, + "address": "123 Elm St.", + "address_2": "Apt. 456", + "city": "Denver", + "state": "Colorado", + "zip": "80202", + "country": "United States" + } + } + }, + { + "$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": [] + } + ], + "x-stoplight": { + "id": "PATCH_v3-senders-sender_id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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.**\n\nSender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "DELETE_v3-senders-sender_id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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.**\n\nSender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_v3-senders-sender_id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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.**\n\nSender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "POST_v3-senders-sender_id-resend_verification", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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. See the [SMTP Ports User Guide](https://sendgrid.com/docs/Classroom/Basics/Email_Infrastructure/smtp_ports.html) for more information on opportunistic TLS.\n\n**Note:** If either setting is enabled and the recipient does not support TLS or have a valid certificate, we drop the message and send a block event with “TLS required but not supported” as the description.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "require_tls": { + "type": "boolean", + "description": "Indicates if the recipient is required to support TLS." + }, + "require_valid_cert": { + "type": "boolean", + "description": "Indicates if the recipient is required to have a valid certificate." + } + }, + "required": [ + "require_tls", + "require_valid_cert" + ] + }, + "examples": { + "application/json": { + "require_tls": false, + "require_valid_cert": false + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_user-settings-enforcedtls", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_user-settings-enforced_tls", + "summary": "Update Enforced TLS settings", + "tags": [ + "Settings - Enforced TLS" + ], + "description": "**This endpoint allows you to update 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. See the [SMTP Ports User Guide](https://sendgrid.com/docs/Classroom/Basics/Email_Infrastructure/smtp_ports.html) for more information on opportunistic TLS.\n\n**Note:** If either setting is enabled and the recipient does not support TLS or have a valid certificate, we drop the message and send a block event with “TLS required but not supported” as the description.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "require_tls": { + "type": "boolean", + "description": "Indicates if you want to require your recipients to support TLS. " + }, + "require_valid_cert": { + "type": "boolean", + "description": "Indicates if you want to require your recipients to have a valid certificate." + } + }, + "example": { + "require_tls": true, + "require_valid_cert": false + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "require_tls": { + "type": "boolean", + "description": "Indicates if your recipients are required to support TLS." + }, + "require_valid_cert": { + "type": "boolean", + "description": "Indicates if your recipients are required to have a valid certificate." + } + }, + "required": [ + "require_tls", + "require_valid_cert" + ] + }, + "examples": { + "application/json": { + "require_tls": true, + "require_valid_cert": false + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_user-settings-enforcedtls", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/user/webhooks/parse/settings": { + "post": { + "operationId": "POST_user-webhooks-parse-settings", + "summary": "Create a parse setting", + "tags": [ + "Settings - Inbound Parse" + ], + "description": "**This endpoint allows you to create a new inbound parse setting.**\n\nThe inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the content, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/parse-setting", + "example": { + "hostname": "myhostname.com", + "url": "http://email.myhosthame.com", + "spam_check": true, + "send_raw": false + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/parse-setting" + }, + "examples": { + "application/json": { + "url": "http://email.myhostname.com", + "hostname": "myhostname.com", + "spam_check": false, + "send_raw": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_user-webhooks-parse-settings", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "get": { + "operationId": "GET_user-webhooks-parse-settings", + "summary": "Retrieve all parse settings", + "tags": [ + "Settings - Inbound Parse" + ], + "description": "**This endpoint allows you to retrieve all of your current inbound parse settings.**\n\nThe inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "result": { + "type": "array", + "description": "The list of your current inbound parse settings.", + "items": { + "$ref": "#/definitions/parse-setting" + } + } + } + }, + "examples": { + "application/json": { + "result": [ + { + "url": "http://mydomain.com/parse", + "hostname": "mail.mydomain.com", + "spam_check": true, + "send_raw": true + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_user-webhooks-parse-settings", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "statusCode": 200, + "enabled": false + } + } + } + }, + "/user/webhooks/parse/settings/{hostname}": { + "parameters": [ + { + "name": "hostname", + "in": "path", + "description": "The hostname associated with the inbound parse setting that you would like to retrieve.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_user-webhooks-parse-settings-hostname", + "summary": "Retrieve a specific parse setting", + "tags": [ + "Settings - Inbound Parse" + ], + "description": "**This endpoint allows you to retrieve a specific inbound parse setting.**\n\nThe inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/parse-setting" + }, + "examples": { + "application/json": { + "url": "http://mydomain.com/parse", + "hostname": "mail.mydomain.com", + "spam_check": true, + "send_raw": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_user-webhooks-parse-settings-hostname", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "patch": { + "operationId": "PATCH_user-webhooks-parse-settings-hostname", + "summary": "Update a parse setting", + "tags": [ + "Settings - Inbound Parse" + ], + "description": "**This endpoint allows you to update a specific inbound parse setting.**\n\nThe inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/parse-setting", + "example": { + "url": "http://newdomain.com/parse", + "spam_check": false, + "send_raw": true + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/parse-setting" + }, + "examples": { + "application/json": { + "url": "http://mydomain.com/parse", + "hostname": "mail.mydomain.com", + "spam_check": true, + "send_raw": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_user-webhooks-parse-settings-hostname", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "statusCode": 200, + "enabled": false + } + } + }, + "delete": { + "operationId": "DELETE_user-webhooks-parse-settings-hostname", + "summary": "Delete a parse setting", + "tags": [ + "Settings - Inbound Parse" + ], + "description": "**This endpoint allows you to delete a specific inbound parse setting.**\n\nThe inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).", + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_user-webhooks-parse-settings-hostname", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "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": "BCC", + "enabled": false, + "name": "bcc", + "description": "Automatically BCC an address for every e-mail sent." + }, + { + "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." + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/mail_settings/bcc": { + "get": { + "operationId": "GET_mail_settings-bcc", + "summary": "Retrieve all BCC mail settings", + "tags": [ + "Settings - Mail" + ], + "description": "**This endpoint allows you to retrieve your current BCC mail settings.**\n\nWhen the BCC mail setting is enabled, SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field, if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_bcc" + }, + "examples": { + "application/json": { + "email": "example@example.com", + "enabled": false + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-bcc", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_mail_settings-bcc", + "summary": "Update BCC mail settings", + "tags": [ + "Settings - Mail" + ], + "description": "**This endpoint allows you to update your current BCC mail settings.**\n\nWhen the BCC mail setting is enabled, SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field, if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/mail_settings_patch", + "example": { + "enabled": false, + "email": "email@example.com" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_patch" + }, + "examples": { + "application/json": { + "email": "example@example.com", + "enabled": false + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-bcc", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/mail_settings/address_whitelist": { + "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 whitelists a specified email address or domain for which mail should never be suppressed. For example, you own the domain “example.com,” and one or more of your recipients use email@example.com addresses, by placing example.com in the address whitelist setting, all bounces, blocks, and unsubscribes logged for that domain will be ignored and sent as if under normal sending conditions.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_address_whitelabel" + }, + "examples": { + "application/json": { + "enabled": false, + "list": [ + "example.com" + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-addresswhitelist", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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\nThe address whitelist setting whitelists a specified email address or domain for which mail should never be suppressed. For example, you own the domain “example.com,” and one or more of your recipients use email@example.com addresses, by placing example.com in the address whitelist setting, all bounces, blocks, and unsubscribes logged for that domain will be ignored and sent as if under normal sending conditions.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-addresswhitelist", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/mail_settings/footer": { + "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 the text and HTML bodies. Use the embedded HTML editor and plain text entry fields to create the content of the footers to be inserted into your emails.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_footer" + }, + "examples": { + "application/json": { + "enabled": true, + "html_content": "Example HTML content", + "plain_content": "Example plain content" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-footer", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "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 the text and HTML bodies. Use the embedded HTML editor and plain text entry fields to create the content of the footers to be inserted into your emails.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/mail_settings_footer", + "example": { + "enabled": true, + "html_content": "...", + "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": "Example HTML content", + "plain_content": "Example plain content" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-footer", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/mail_settings/forward_spam": { + "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 an email address to which spam reports will be forwarded.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_forward_spam" + }, + "examples": { + "application/json": { + "email": "", + "enabled": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-forwardspam", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "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 an email address to which spam reports will be forwarded.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/mail_settings_forward_spam", + "example": { + "email": "", + "enabled": false + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_forward_spam" + }, + "examples": { + "application/json": { + "email": "", + "enabled": false + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-forwardspam", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/mail_settings/plain_content": { + "get": { + "operationId": "GET_mail_settings-plain_content", + "summary": "Retrieve plain content mail settings", + "tags": [ + "Settings - Mail" + ], + "description": "**This endpoint allows you to retrieve your current Plain Content mail settings.**\n\nThe plain content setting will automatically convert any plain text emails that you send to HTML before sending.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if the Plain Content mail setting is enabled." + } + } + }, + "examples": { + "application/json": { + "enabled": false + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-plaincontent", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "patch": { + "operationId": "PATCH_mail_settings-plain_content", + "summary": "Update plain content mail settings", + "tags": [ + "Settings - Mail" + ], + "description": "**This endpoint allows you to update your current Plain Content mail settings.**\n\nThe plain content setting will automatically convert any plain text emails that you send to HTML before sending.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "The new setting you would like to use for your Plain Content mail setting." + } + }, + "example": { + "enabled": false + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if your Plain Content mail setting is enabled." + } + } + }, + "examples": { + "application/json": { + "enabled": false + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-plaincontent", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/mail_settings/spam_check": { + "get": { + "operationId": "GET_mail_settings-spam_check", + "summary": "Retrieve spam check mail settings", + "tags": [ + "Settings - Mail" + ], + "description": "**This endpoint allows you to retrieve your current Spam Checker mail settings.**\n\nThe spam checker filter notifies you when emails are detected that exceed a predefined spam threshold.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_spam_check" + }, + "examples": { + "application/json": { + "enabled": false, + "max_score": 6, + "url": "http://example.com" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-spamcheck", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_mail_settings-spam_check", + "summary": "Update spam check mail settings", + "tags": [ + "Settings - Mail" + ], + "description": "**This endpoint allows you to update your current spam checker mail settings.**\n\nThe spam checker filter notifies you when emails are detected that exceed a predefined spam threshold.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if you want the spam check mail setting to be enabled or not." + }, + "url": { + "type": "string", + "description": "The Inbound Parse URL where you would like your spam reports to be sent to." + }, + "max_score": { + "type": "integer", + "default": 5, + "description": "The new max score, or spam threshold that you would like to set for the spam checker.", + "minimum": 1, + "maximum": 10 + } + }, + "example": { + "enabled": true, + "url": "url", + "max_score": 5 + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_spam_check" + }, + "examples": { + "application/json": { + "enabled": false, + "max_score": 6, + "url": "http://example.com" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-spamcheck", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/mail_settings/template": { + "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 [transactional templates](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). \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.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "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" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-template", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "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 [transactional templates](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html). \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.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-template", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/mail_settings/bounce_purge": { + "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 purge settings.**\n\nThis setting allows you to set a schedule for SendGrid to automatically delete contacts from your soft and hard bounce suppression lists.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "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": 1234, + "hard_bounces": null + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-bouncepurge", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "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 purge settings.**\n\nThis setting allows you to set a schedule for SendGrid to automatically delete contacts from your soft and hard bounce suppression lists.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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": null, + "soft_bounces": null + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-bouncepurge", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/mail_settings/forward_bounce": { + "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\nActivating this setting allows you to specify an email address to which bounce reports are forwarded.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_forward_bounce" + }, + "examples": { + "application/json": { + "enabled": false, + "email": null + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailsettings-forwardbounce", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "statusCode": 200, + "enabled": false + } + } + }, + "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\nActivating this setting allows you to specify an email address to which bounce reports are forwarded.\n\nMail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrid’s [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/mail_settings_forward_bounce", + "example": { + "enabled": true, + "email": "example@example.com" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/mail_settings_forward_bounce" + }, + "examples": { + "application/json": { + "email": "", + "enabled": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_mailsettings-forwardbounce", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/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 [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html).", + "produces": [ + "application/json" + ], + "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" + } + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_partnersettings", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "statusCode": 200, + "enabled": false + } + } + } + }, + "/partner_settings/new_relic": { + "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 [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html).\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 [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html).", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/partner_settings_new_relic" + }, + "examples": { + "application/json": { + "enable_subuser_statistics": false, + "enabled": true, + "license_key": "" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_partnersettings-newrelic", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "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 [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html).\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 [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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 + } + } + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/partner_settings_new_relic" + }, + "examples": { + "application/json": { + "enable_subuser_statistics": true, + "enabled": true, + "license_key": "" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_partnersettings-newrelic", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/tracking_settings": { + "get": { + "operationId": "GET_tracking_settings", + "summary": "Retrieve Tracking Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to retrieve a list of all tracking settings that you can enable on your account.**\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "produces": [ + "application/json" + ], + "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 you want to begin retrieving 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 tracking settings.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the event being tracked." + }, + "title": { + "type": "string", + "description": "The title of the tracking setting." + }, + "description": { + "type": "string", + "description": "A description about the event that is being tracked." + }, + "enabled": { + "type": "boolean", + "description": "Indicates if this tracking setting is currently enabled." + } + } + } + } + } + }, + "examples": { + "application/json": { + "result": [ + { + "name": "open", + "title": "Open Tracking", + "description": "lorem ipsum... .", + "enabled": true + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_trackingsettings", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + } + }, + "/tracking_settings/click": { + "get": { + "operationId": "GET_tracking_settings-click", + "summary": "Retrieve Click Track Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to retrieve your current click tracking setting.**\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "enable_text": { + "type": "boolean", + "description": "Indicates if click tracking is enabled for plain text emails." + }, + "enabled": { + "type": "boolean", + "description": "Indicates if click tracking is enabled or disabled." + } + }, + "required": [ + "enable_text", + "enabled" + ] + }, + "examples": { + "application/json": { + "enable_text": false, + "enabled": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_trackingsettings-click", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "statusCode": 200, + "enabled": false + } + } + }, + "patch": { + "operationId": "PATCH_tracking_settings-click", + "summary": "Update Click Tracking Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to change your current click tracking setting. You can enable, or disable, click tracking using this endpoint.**\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "The setting you want to use for click tracking." + } + }, + "example": { + "enabled": true + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "enable_text": { + "type": "boolean", + "description": "Indicates if click tracking is enabled for plain text emails" + }, + "enabled": { + "type": "boolean", + "description": "The new setting new setting for click tracking." + } + }, + "required": [ + "enable_text", + "enabled" + ] + }, + "examples": { + "application/json": { + "enable_text": false, + "enabled": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_trackingsettings-click", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/tracking_settings/google_analytics": { + "get": { + "operationId": "GET_tracking_settings-google_analytics", + "summary": "Retrieve Google Analytics Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to retrieve your current setting for Google Analytics.**\n\nFor more information about using Google Analytics, please refer to [Google’s URL Builder](https://support.google.com/analytics/answer/1033867?hl=en) and their article on [\"Best Practices for Campaign Building\"](https://support.google.com/analytics/answer/1037445).\n\nWe default the settings to Google’s recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/google_analytics_demystified_ga_statistics_vs_sg_statistics.html).\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/google_analytics_settings" + }, + "examples": { + "application/json": { + "enabled": true, + "utm_campaign": "", + "utm_content": "lotsandlotsofcontent", + "utm_medium": "", + "utm_source": "", + "utm_term": "" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_trackingsettings-googleanalytics", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_tracking_settings-google_analytics", + "summary": "Update Google Analytics Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to update your current setting for Google Analytics.**\n\nFor more information about using Google Analytics, please refer to [Google’s URL Builder](https://support.google.com/analytics/answer/1033867?hl=en) and their article on [\"Best Practices for Campaign Building\"](https://support.google.com/analytics/answer/1037445).\n\nWe default the settings to Google’s recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/google_analytics_demystified_ga_statistics_vs_sg_statistics.html).\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/google_analytics_settings", + "example": { + "enabled": true, + "utm_source": "sendgrid.com", + "utm_medium": "email", + "utm_term": "", + "utm_content": "", + "utm_campaign": "website" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/google_analytics_settings" + }, + "examples": { + "application/json": { + "enabled": true, + "utm_campaign": "", + "utm_content": "lotsandlotsofcontent", + "utm_medium": "", + "utm_source": "", + "utm_term": "" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_trackingsettings-googleanalytics", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/tracking_settings/open": { + "get": { + "operationId": "GET_tracking_settings-open", + "summary": "Get Open Tracking Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to retrieve your current settings for open tracking.**\n\nOpen Tracking adds an invisible image at the end of the email which can track email opens. If the email recipient has images enabled on their email client, a request to SendGrid’s server for the invisible image is executed and an open event is logged. These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if open tracking is enabled." + } + }, + "required": [ + "enabled" + ] + }, + "examples": { + "application/json": { + "enabled": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_trackingsettings-open", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_tracking_settings-open", + "summary": "Update Open Tracking Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to update your current settings for open tracking.**\n\nOpen Tracking adds an invisible image at the end of the email which can track email opens. If the email recipient has images enabled on their email client, a request to SendGrid’s server for the invisible image is executed and an open event is logged. These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "The new status that you want to set for open tracking." + } + }, + "example": { + "enabled": true + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if open tracking is enabled." + } + }, + "required": [ + "enabled" + ] + }, + "examples": { + "application/json": { + "enabled": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_trackingsettings-open", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/tracking_settings/subscription": { + "get": { + "operationId": "GET_tracking_settings-subscription", + "summary": "Retrieve Subscription Tracking Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to retrieve your current settings for subscription tracking.**\n\nSubscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/subscription_tracking_settings" + }, + "examples": { + "application/json": { + "enabled": true, + "html_content": "

Something something unsubscribe <% %> something something

\n", + "landing": "

subscribehere

\n", + "plain_content": "Something something unsubscribe <% %> something something", + "replace": "thetag", + "url": "" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_trackingsettings-subscription", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_tracking_settings-subscription", + "summary": "Update Subscription Tracking Settings", + "tags": [ + "Settings - Tracking" + ], + "description": "**This endpoint allows you to update your current settings for subscription tracking.**\n\nSubscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.\n\nYou can track a variety of the actions your recipients may take when interacting with your emails including opening your emails, clicking on links in your emails, and subscribing to (or unsubscribing from) your emails.\n\nFor more information about tracking, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/tracking.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/subscription_tracking_settings", + "example": { + "enabled": true, + "landing": "landing page html", + "url": "url", + "replace": "replacement tag", + "html_content": "html content", + "plain_content": "text content" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/subscription_tracking_settings" + }, + "examples": { + "application/json": { + "enabled": true, + "landing": "landing page html", + "url": "url", + "replace": "replacement tag", + "html_content": "html content", + "plain_content": "text content" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_trackingsettings-subscription", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/suppression/spam_reports": { + "get": { + "operationId": "GET_suppression-spam_reports", + "summary": "Retrieve all spam reports", + "tags": [ + "Spam Reports API" + ], + "description": "**This endpoint allows you to retrieve all spam reports.**\n\n[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_time", + "in": "query", + "description": "Refers start of the time range in unix timestamp when a spam report was created (inclusive).", + "type": "integer" + }, + { + "name": "end_time", + "in": "query", + "description": "Refers end of the time range in unix timestamp when a spam report was created (inclusive).", + "type": "integer" + }, + { + "name": "limit", + "in": "query", + "description": "Limit the number of results to be displayed per page.", + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "Paging offset. The point in the list to begin displaying results.", + "type": "integer" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "created": { + "type": "integer", + "description": "A Unix timestamp indicating when the spam report was made." + }, + "email": { + "type": "string", + "description": "The email address of the recipient who marked your message as spam." + }, + "ip": { + "type": "string", + "description": "The IP address that the message was sent on." + } + }, + "required": [ + "created", + "email", + "ip" + ] + } + }, + "examples": { + "application/json": [ + { + "created": 1443651141, + "email": "user1@example.com", + "ip": "10.63.202.100" + }, + { + "created": 1443651154, + "email": "user2@example.com", + "ip": "10.63.202.100" + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_suppression-spamreports", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_suppression-spam_reports", + "summary": "Delete spam reports", + "tags": [ + "Spam Reports API" + ], + "description": "**This endpoint allows you to delete your spam reports.**\n\nThere are two options for deleting spam reports: \n\n1) You can delete all spam reports by setting \"delete_all\" to true in the request body. \n2) You can delete some spam reports by specifying the email addresses in an array in the request body.\n\n[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "delete_all": { + "type": "boolean", + "description": "Indicates if you want to delete all email addresses on the spam report list." + }, + "emails": { + "type": "array", + "description": "A list of specific email addresses that you want to remove from the spam report list.", + "items": { + "type": "string" + } + } + }, + "example": { + "delete_all": false, + "emails": [ + "example1@example.com", + "example2@example.com" + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_suppression-spamreports", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + } + }, + "/suppression/spam_reports/{email}": { + "parameters": [ + { + "name": "email", + "in": "path", + "description": "The email address of a specific spam report that you want to retrieve.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_suppression-spam_reports-email", + "summary": "Retrieve a specific spam report", + "tags": [ + "Spam Reports API" + ], + "description": "**This endpoint allows you to retrieve a specific spam report.**\n\n[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "created": { + "type": "integer", + "description": "A Unix timestamp that indicates when the recipient marked your message as spam." + }, + "email": { + "type": "string", + "description": "The email address of the recipient that marked your message as spam." + }, + "ip": { + "type": "string", + "description": "The IP address that the message was sent from." + } + }, + "required": [ + "created", + "email", + "ip" + ] + } + }, + "examples": { + "application/json": [ + { + "created": 1454433146, + "email": "test1@example.com", + "ip": "10.89.32.5" + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_suppression-spamreports-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "dynamic": false, + "enabled": false + } + } + }, + "delete": { + "operationId": "DELETE_suppression-spam_reports-email", + "summary": "Delete a specific spam report", + "tags": [ + "Spam Reports API" + ], + "description": "**This endpoint allows you to delete a specific spam report.**\n\n[Spam reports](https://sendgrid.com/docs/Glossary/spam_reports.html) happen when a recipient indicates that they think your email is [spam](https://sendgrid.com/docs/Glossary/spam.html) and then their email provider reports this to SendGrid.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/spam_reports.html).", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_suppression-spamreports-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/stats": { + "get": { + "operationId": "GET_stats", + "summary": "Retrieve global email statistics", + "tags": [ + "Stats" + ], + "description": "**This endpoint allows you to retrieve all of your global email statistics between a given date range.**\n\nParent accounts will see aggregated stats for their account and all subuser accounts. Subuser accounts will only see their own stats.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "The number of results to return.", + "required": false, + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "The point in the list to begin retrieving results.", + "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": "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" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date the stats were gathered." + }, + "stats": { + "type": "array", + "description": "The individual email activity stats.", + "items": { + "type": "object", + "properties": { + "metrics": { + "type": "object", + "properties": { + "blocks": { + "type": "integer", + "description": "The number of emails that were not allowed to be delivered by ISPs." + }, + "bounce_drops": { + "type": "integer", + "description": "The number of emails that were dropped because of a bounce." + }, + "bounces": { + "type": "integer", + "description": "The number of emails that bounced instead of being delivered." + }, + "clicks": { + "type": "integer", + "description": "The number of links that were clicked in your emails." + }, + "deferred": { + "type": "integer", + "description": "The number of emails that temporarily could not be delivered. " + }, + "delivered": { + "type": "integer", + "description": "The number of emails SendGrid was able to confirm were actually delivered to a recipient." + }, + "invalid_emails": { + "type": "integer", + "description": "The number of recipients who had malformed email addresses or whose mail provider reported the address as invalid." + }, + "opens": { + "type": "integer", + "description": "The total number of times your emails were opened by recipients." + }, + "processed": { + "type": "integer", + "description": "Requests from your website, application, or mail client via SMTP Relay or the API that SendGrid processed." + }, + "requests": { + "type": "integer", + "description": "The number of emails that were requested to be delivered." + }, + "spam_report_drops": { + "type": "integer", + "description": "The number of emails that were dropped due to a recipient previously marking your emails as spam." + }, + "spam_reports": { + "type": "integer", + "description": "The number of recipients who marked your email as spam." + }, + "unique_clicks": { + "type": "integer", + "description": "The number of unique recipients who clicked links in your emails." + }, + "unique_opens": { + "type": "integer", + "description": "The number of unique recipients who opened your emails." + }, + "unsubscribe_drops": { + "type": "integer", + "description": "The number of emails dropped due to a recipient unsubscribing from your emails." + }, + "unsubscribes": { + "type": "integer", + "description": "The number of recipients who unsubscribed from your emails." + } + } + } + } + } + } + }, + "required": [ + "date", + "stats" + ] + } + }, + "examples": { + "application/json": [ + { + "date": "2015-11-03", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + }, + { + "date": "2015-11-04", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + }, + { + "date": "2015-11-05", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + }, + { + "date": "2015-11-06", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + }, + { + "date": "2015-11-07", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + }, + { + "date": "2015-11-08", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + }, + { + "date": "2015-11-09", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + } + } + ] + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/geo/stats": { + "get": { + "operationId": "GET_geo-stats", + "summary": "Retrieve email statistics by country and state/province.", + "tags": [ + "Stats" + ], + "description": "**This endpoint allows you to retrieve your email statistics segmented by country and state/province.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "How many results to include on each page.", + "required": false, + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "How many results to exclude.", + "required": false, + "type": "integer" + }, + { + "name": "aggregated_by", + "in": "query", + "description": "How you would like the statistics to be grouped. Must be either \"day\", \"week\", or \"month\".", + "required": false, + "type": "string", + "enum": [ + "day", + "week", + "month" + ] + }, + { + "name": "start_date", + "in": "query", + "description": "The starting date of the statistics to retrieve. Must be in format YYYY-MM-DD", + "required": true, + "type": "string" + }, + { + "name": "end_date", + "in": "query", + "description": "The end date of the statistics to retrieve. ", + "required": false, + "type": "string", + "default": "The date the request is made." + }, + { + "name": "country", + "in": "query", + "description": "The country you would like to see statistics for. Currently only supported for US and CA.", + "required": false, + "type": "string", + "enum": [ + "US", + "CA" + ] + }, + { + "$ref": "#/parameters/trait:authorizationHeader:Authorization" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/advanced_stats_country" + } + }, + "examples": { + "application/json": [ + { + "date": "2015-10-11", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-12", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-13", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-14", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-15", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-16", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-17", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-18", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-19", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-20", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-21", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 1, + "unique_clicks": 0, + "unique_opens": 1 + } + } + ] + }, + { + "date": "2015-10-22", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-23", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-24", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-25", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-26", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-27", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-28", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-29", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-30", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-31", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-01", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-02", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-03", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-04", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-05", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-06", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-07", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-08", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-09", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-10", + "stats": [ + { + "type": "province", + "name": "TX", + "metrics": { + "clicks": 0, + "opens": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + } + ] + } + } + }, + "x-stoplight": { + "id": "GET_geo-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/devices/stats": { + "get": { + "operationId": "GET_devices-stats", + "summary": "Retrieve email statistics by device type.", + "tags": [ + "Stats" + ], + "description": "**This endpoint allows you to retrieve your email statistics segmented by the device type.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\n## Available Device Types\n| **Device** | **Description** | **Example** |\n|---|---|---|\n| Desktop | Email software on desktop computer. | I.E., Outlook, Sparrow, or Apple Mail. |\n| Webmail |\tA web-based email client. | I.E., Yahoo, Google, AOL, or Outlook.com. |\n| Phone | A smart phone. | iPhone, Android, Blackberry, etc.\n| Tablet | A tablet computer. | iPad, android based tablet, etc. |\n| Other | An unrecognized device. |\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "end_date", + "in": "query", + "description": "The end date of the statistics to retrieve. Defaults to today.", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "description": "How many results to include on each page.", + "required": false, + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "How many results to exclude.", + "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" + }, + { + "name": "start_date", + "in": "query", + "description": "The starting date of the statistics to retrieve.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/advanced_stats_opens" + } + }, + "examples": { + "application/json": [ + { + "date": "2015-10-11", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-12", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-13", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-14", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-15", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-16", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-17", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-18", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-19", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-20", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-21", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 1, + "unique_opens": 1 + } + } + ] + }, + { + "date": "2015-10-22", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-23", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-24", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-25", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-26", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 2, + "unique_opens": 2 + } + } + ] + }, + { + "date": "2015-10-27", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-28", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-29", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-30", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-31", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-01", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-02", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-03", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-04", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-05", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-06", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-07", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-08", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-09", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-10", + "stats": [ + { + "type": "device", + "name": "Webmail", + "metrics": { + "opens": 0, + "unique_opens": 0 + } + } + ] + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_devices-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/clients/stats": { + "get": { + "operationId": "GET_clients-stats", + "summary": "Retrieve email statistics by client type.", + "tags": [ + "Stats" + ], + "description": "**This endpoint allows you to retrieve your email statistics segmented by client type.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_date", + "in": "query", + "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", + "required": true, + "type": "string" + }, + { + "name": "end_date", + "in": "query", + "description": "The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD.", + "required": false, + "type": "string" + }, + { + "name": "aggregated_by", + "in": "query", + "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", + "required": false, + "type": "string", + "enum": [ + "day", + "week", + "month" + ] + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/advanced_stats_opens" + } + }, + "examples": { + "application/json": [ + { + "date": "2014-10-01", + "stats": [ + { + "metrics": { + "opens": 1, + "unique_opens": 1 + }, + "name": "Gmail", + "type": "client" + } + ] + }, + { + "date": "2014-10-02", + "stats": [ + { + "metrics": { + "opens": 0, + "unique_opens": 0 + }, + "name": "Gmail", + "type": "client" + } + ] + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_clients-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/clients/{client_type}/stats": { + "parameters": [ + { + "name": "client_type", + "in": "path", + "description": "Specifies the type of client to retrieve stats for. Must be either \"phone\", \"tablet\", \"webmail\", or \"desktop\".", + "required": true, + "type": "string", + "enum": [ + "phone", + "tablet", + "webmail", + "desktop" + ] + } + ], + "get": { + "operationId": "GET_clients-client_type-stats", + "summary": "Retrieve stats by a specific client type.", + "tags": [ + "Stats" + ], + "description": "**This endpoint allows you to retrieve your email statistics segmented by a specific client type.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\n## Available Client Types\n- phone\n- tablet\n- webmail\n- desktop\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_date", + "in": "query", + "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", + "required": true, + "type": "string" + }, + { + "name": "end_date", + "in": "query", + "description": "The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD.", + "required": false, + "type": "string" + }, + { + "name": "aggregated_by", + "in": "query", + "description": "How to group the statistics. Must be either \"day\", \"week\", or \"month\".", + "required": false, + "type": "string", + "enum": [ + "day", + "week", + "month" + ] + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/advanced_stats_opens" + } + }, + "examples": { + "application/json": [ + { + "date": "2014-10-01", + "stats": [ + { + "metrics": { + "opens": 1, + "unique_opens": 1 + }, + "name": "Gmail", + "type": "client" + } + ] + }, + { + "date": "2014-10-02", + "stats": [ + { + "metrics": { + "opens": 0, + "unique_opens": 0 + }, + "name": "Gmail", + "type": "client" + } + ] + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_clients-clienttype-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/mailbox_providers/stats": { + "get": { + "operationId": "GET_mailbox_providers-stats", + "summary": "Retrieve email statistics by mailbox provider.", + "tags": [ + "Stats" + ], + "description": "**This endpoint allows you to retrieve your email statistics segmented by recipient mailbox provider.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "The number of results to include on each page.", + "required": false, + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "The number of results to exclude.", + "required": false, + "type": "integer" + }, + { + "name": "aggregated_by", + "in": "query", + "description": "How to group the stats. Must be either \"day\", \"wee\", or \"month\".", + "required": false, + "type": "string", + "enum": [ + "day", + "week", + "month" + ] + }, + { + "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": "mailbox_providers", + "in": "query", + "description": "The mail box providers to get statistics for. You can include up to 10 by including this parameter multiple times.", + "required": false, + "type": "string" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/advanced_stats_mailbox_provider" + } + }, + "examples": { + "application/json": [ + { + "date": "2015-10-11", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-12", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-13", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-14", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-15", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-16", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-17", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-18", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-19", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-20", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-21", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 1, + "drops": 0, + "opens": 1, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 1 + } + } + ] + }, + { + "date": "2015-10-22", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-23", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-24", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-25", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-26", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 2, + "drops": 0, + "opens": 2, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 2 + } + } + ] + }, + { + "date": "2015-10-27", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-28", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-29", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-30", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-10-31", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-01", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-02", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-03", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-04", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-05", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-06", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-07", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-08", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-09", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + }, + { + "date": "2015-11-10", + "stats": [ + { + "type": "mailbox_provider", + "name": "Gmail", + "metrics": { + "blocks": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "drops": 0, + "opens": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0 + } + } + ] + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_mailboxproviders-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/browsers/stats": { + "get": { + "operationId": "GET_browsers-stats", + "summary": "Retrieve email statistics by browser.", + "tags": [ + "Stats" + ], + "description": "**This endpoint allows you to retrieve your email statistics segmented by browser type.**\n\n**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.\n\nAdvanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_date", + "in": "query", + "description": "The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.", + "required": true, + "type": "string" + }, + { + "name": "end_date", + "in": "query", + "description": "The end date of the statistics to retrieve. Defaults to today.", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "description": "The number of results to include on each page.", + "required": false, + "type": "string" + }, + { + "name": "offset", + "in": "query", + "description": "The number of results to exclude.", + "required": false, + "type": "string" + }, + { + "name": "aggregated_by", + "in": "query", + "description": "How to group the stats. Must be either \"day\", \"week\", or \"month\".", + "required": false, + "type": "string", + "enum": [ + "day", + "week", + "month" + ] + }, + { + "name": "browsers", + "in": "query", + "description": "The browsers to get statistics for. You can include up to 10 different browsers by including this parameter multiple times.", + "required": false, + "type": "string" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/advanced_stats_clicks" + } + }, + "examples": { + "application/json": [ + { + "date": "2014-10-01", + "stats": [ + { + "metrics": { + "clicks": 0, + "unique_clicks": 0 + }, + "name": "Chrome", + "type": "browser" + }, + { + "metrics": { + "clicks": 1, + "unique_clicks": 1 + }, + "name": "Firefox", + "type": "browser" + } + ] + }, + { + "date": "2014-10-02", + "stats": [ + { + "metrics": { + "clicks": 0, + "unique_clicks": 0 + }, + "name": "Chrome", + "type": "browser" + }, + { + "metrics": { + "clicks": 1, + "unique_clicks": 1 + }, + "name": "Firefox", + "type": "browser" + } + ] + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_browsers-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/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. You can choose to retrieve specific subusers as well as limit the results that come back from the API.\n\nFor more information about Subusers:\n\n* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)\n* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html)", + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_subusers", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + }, + "post": { + "operationId": "POST_subusers", + "summary": "Create Subuser", + "tags": [ + "Subusers API" + ], + "description": "This endpoint allows you to retrieve a list of all of your subusers. You can choose to retrieve specific subusers as well as limit the results that come back from the API.\n\nFor more information about Subusers:\n\n* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)\n* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "username exists" + }, + { + "message": "unable to validate IPs at this time" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "403": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "POST_subusers", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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.\n\nFor more information about Subusers:\n\n* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)\n* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "invalid username" + }, + { + "message": "no fields provided" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "unable to enable user" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_subusers-subusername", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + }, + "delete": { + "operationId": "DELETE_subusers-subuser_name", + "summary": "Delete a subuser", + "tags": [ + "Subusers API" + ], + "description": "This endpoint allows you to delete a subuser. This is a permanent action, once deleted a subuser cannot be retrieved.\n\nFor more information about Subusers:\n\n* [User Guide > Subusers](https://sendgrid.com/docs/User_Guide/Settings/Subusers/index.html)\n* [Classroom > How do I add more subusers to my account?](https://sendgrid.com/docs/Classroom/Basics/Account/how_do_i_add_more_subusers_to_my_account.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_subusers-subusername", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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": [ + "Subusers API" + ], + "description": "Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails.", + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/monitor" + }, + "examples": { + "application/json": { + "email": "example@example.com", + "frequency": 500 + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "No monitor settings for this user" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_subusers-subusername-monitor", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "post": { + "operationId": "POST_subusers-subuser_name-monitor", + "summary": "Create monitor settings", + "tags": [ + "Subusers API" + ], + "description": "Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "User already has a monitor" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_subusers-subusername-monitor", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + }, + "put": { + "operationId": "PUT_subusers-subuser_name-monitor", + "summary": "Update Monitor Settings for a subuser", + "tags": [ + "Subusers API" + ], + "description": "Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": "email", + "message": "Email is required" + } + ] + } + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PUT_subusers-subusername-monitor", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_subusers-subuser_name-monitor", + "summary": "Delete monitor settings", + "tags": [ + "Subusers API" + ], + "description": "Subuser monitor settings allow you to receive a sample of an outgoing message by a specific customer at a specific frequency of emails.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:authorizationHeader:Authorization" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object", + "properties": {} + } + }, + "401": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + }, + "404": { + "description": "", + "schema": { + "$ref": "#/definitions/global:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "No monitor settings for this user" + } + ] + } + } + } + }, + "x-stoplight": { + "id": "DELETE_subusers-subusername-monitor", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/subusers/reputations": { + "get": { + "operationId": "GET_subusers-reputations", + "summary": "Retrieve Subuser Reputations", + "tags": [ + "Subusers API" + ], + "description": "Subuser 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 effect your sender rating.\n\nThis endpoint allows you to request the reputations for your subusers.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_subusers-reputations", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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": "Each 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 their own, or multiple, IP addresses as well. \n\nMore information:\n\n* [How to request more IPs](https://sendgrid.com/docs/Classroom/Basics/Account/adding_an_additional_dedicated_ip_to_your_account.html)\n* [IPs can be whitelabeled](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/ips.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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" + ] + } + }, + { + "$ref": "#/parameters/trait:authorizationHeader:Authorization" + } + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "x-stoplight": { + "id": "PUT_subusers-subusername-ips", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/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": [ + "Subusers API" + ], + "description": "**This endpoint allows you to retrive the monthly email statistics for a specific subuser.**\n\nWhile you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats for your subusers. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.\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`.\n\nFor more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html).", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_subusers-subusername-stats-monthly", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/subusers/stats/monthly": { + "get": { + "operationId": "GET_subusers-stats-monthly", + "summary": "Retrieve monthly stats for all subusers", + "tags": [ + "Subusers API" + ], + "description": "**This endpoint allows you to retrieve the monthly email statistics for all subusers over the given date range.**\n\nWhile you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats for your subusers. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.\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`.\n\nFor more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html).", + "produces": [ + "application/json" + ], + "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" + }, + { + "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": [] + } + ], + "x-stoplight": { + "id": "GET_subusers-stats-monthly", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/subusers/stats/sums": { + "get": { + "operationId": "GET_subusers-stats-sums", + "summary": " Retrieve the totals for each email statistic metric for all subusers.", + "tags": [ + "Subusers API" + ], + "description": "**This endpoint allows you to retrieve the total sums of each email statistic metric for all subusers over the given date range.**\n\n\nWhile you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.\n\nFor more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html).", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_subusers-stats-sums", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/subusers/stats": { + "get": { + "operationId": "GET_subusers-stats", + "summary": "Retrieve email statistics for your subusers.", + "tags": [ + "Subusers API" + ], + "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.\n\nWhile you can always view the statistics for all email activity on your account, subuser statistics enable you to view specific segments of your stats. Emails sent, bounces, and spam reports are always tracked for subusers. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.\n\nFor more information, see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/subuser.html).", + "produces": [ + "application/json" + ], + "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/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": [] + } + ], + "x-stoplight": { + "id": "GET_subusers-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/suppression/unsubscribes": { + "get": { + "operationId": "GET_suppression-unsubscribes", + "summary": "Retrieve all global suppressions", + "tags": [ + "Suppressions - Global Suppressions" + ], + "description": "**This endpoint allows you to retrieve a list of all email address that are globally suppressed.**\n\nA global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "start_time", + "in": "query", + "description": "Refers start of the time range in unix timestamp when an unsubscribe email was created (inclusive).", + "type": "integer" + }, + { + "name": "end_time", + "in": "query", + "description": "Refers end of the time range in unix timestamp when an unsubscribe email was created (inclusive).", + "type": "integer" + }, + { + "name": "limit", + "in": "query", + "description": "The number of results to display on each page.", + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "The point in the list of results to begin displaying global suppressions.", + "type": "integer" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "created": { + "type": "integer", + "description": "A Unix timestamp indicating when the recipient was added to the global suppression list." + }, + "email": { + "type": "string", + "description": "The email address of the recipient who is globally suppressed." + } + }, + "required": [ + "created", + "email" + ] + } + }, + "examples": { + "application/json": [ + { + "created": 1443651141, + "email": "user1@example.com" + }, + { + "created": 1443651154, + "email": "user2@example.com" + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_suppression-unsubscribes", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + } + }, + "/asm/suppressions/global": { + "post": { + "operationId": "POST_asm-suppressions-global", + "summary": "Add recipient addresses to the global suppression group.", + "tags": [ + "Suppressions - Global Suppressions" + ], + "description": "**This endpoint allows you to add one or more email addresses to the global suppressions group.**\n\nA global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "recipient_emails": { + "type": "array", + "description": "The email address, or addresses, that you want to add to the global suppressions group.", + "items": { + "type": "string" + } + } + }, + "example": { + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "type": "object", + "properties": { + "recipient_emails": { + "type": "array", + "description": "The email addresses that are globally suppressed", + "items": { + "type": "string" + } + } + }, + "required": [ + "recipient_emails" + ] + }, + "examples": { + "application/json": { + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_asm-suppressions-global", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/asm/suppressions/global/{email}": { + "parameters": [ + { + "name": "email", + "in": "path", + "description": "The email address of the global suppression you want to retrieve. Or, if you want to check if an email address is on the global suppressions list, enter that email address here.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_asm-suppressions-global-email", + "summary": "Retrieve a Global Suppression", + "tags": [ + "Suppressions - Global Suppressions" + ], + "description": "**This endpoint allows you to retrieve a global suppression. You can also use this endpoint to confirm if an email address is already globally suppresed.**\n\nIf the email address you include in the URL path parameter `{email}` is alreayd globally suppressed, the response will include that email address. If the address you enter for `{email}` is not globally suppressed, an empty JSON object `{}` will be returned.\n\nA global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "title": "Retrieve a Global Suppression response", + "type": "object", + "properties": { + "recipient_email": { + "type": "string", + "description": "The email address that is globally suppressed. This will be an empty object if the email address you included in your call is not globally suppressed." + } + }, + "required": [ + "recipient_email" + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_asm-suppressions-global-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + }, + "delete": { + "operationId": "DELETE_asm-suppressions-global-email", + "summary": "Delete a Global Suppression", + "tags": [ + "Suppressions - Global Suppressions" + ], + "description": "**This endpoint allows you to remove an email address from the global suppressions group.**\n\nA global suppression (or global unsubscribe) is an email address of a recipient who does not want to receive any of your messages. A globally suppressed recipient will be removed from any email you send. For more information, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Suppressions/global_unsubscribes.html).", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_asm-suppressions-global-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/asm/groups/{group_id}/suppressions": { + "parameters": [ + { + "name": "group_id", + "in": "path", + "description": "The id of the unsubscribe group that you are adding suppressions to.", + "required": true, + "type": "string" + } + ], + "post": { + "operationId": "POST_asm-groups-group_id-suppressions", + "summary": "Add suppressions to a suppression group", + "tags": [ + "Suppressions - Suppressions" + ], + "description": "**This endpoint allows you to add email addresses to an unsubscribe group.**\n\nIf you attempt to add suppressions to a group that has been deleted or does not exist, the suppressions will be added to the global suppressions list.\n\nSuppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "recipient_emails": { + "type": "array", + "description": "The email address that you want to add to the unsubscribe group.", + "items": { + "type": "string" + } + } + }, + "required": [ + "recipient_emails" + ], + "example": { + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "type": "object", + "properties": { + "recipient_emails": { + "type": "array", + "description": "The email address that were added to the suppressions list.", + "items": { + "type": "string" + } + } + }, + "required": [ + "recipient_emails" + ] + }, + "examples": { + "application/json": { + "recipient_emails": [ + "test1@example.com", + "test2@example.com" + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_asm-groups-groupid-suppressions", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "get": { + "operationId": "GET_asm-groups-group_id-suppressions", + "summary": "Retrieve all suppressions for a suppression group", + "tags": [ + "Suppressions - Suppressions" + ], + "description": "**This endpoint allows you to retrieve all suppressed email addresses belonging to the given group.**\n\nSuppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "description": "The list of email addresses belonging to the given suppression group.", + "items": { + "type": "string" + } + }, + "examples": { + "application/json": [ + "example@example.com", + "example2@example.com" + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_asm-groups-groupid-suppressions", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/asm/groups/{group_id}/suppressions/{email}": { + "parameters": [ + { + "name": "group_id", + "in": "path", + "description": "The id of the suppression group that you are removing an email address from.", + "required": true, + "type": "string" + }, + { + "name": "email", + "in": "path", + "description": "The email address that you want to remove from the suppression group.", + "required": true, + "type": "string" + } + ], + "delete": { + "operationId": "DELETE_asm-groups-group_id-suppressions-email", + "summary": "Delete a suppression from a suppression group", + "tags": [ + "Suppressions - Suppressions" + ], + "description": "**This endpoint allows you to remove a suppressed email address from the given suppression group.**\n\nSuppressions are recipient email addresses that are added to [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html). Once a recipient's address is on the suppressions list for an unsubscribe group, they will not receive any emails that are tagged with that unsubscribe group.", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_asm-groups-groupid-suppressions-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": 204, + "dynamic": false + } + } + } + }, + "/asm/suppressions": { + "get": { + "operationId": "GET_asm-suppressions", + "summary": "Retrieve all suppressions", + "tags": [ + "Suppressions - Suppressions" + ], + "description": "**This endpoint allows you to retrieve a list of all suppressions.**\n\nSuppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "The email address that was suppressed." + }, + "group_id": { + "type": "integer", + "description": "The id of the suppression group that this email address belongs to." + }, + "group_name": { + "type": "string", + "description": "The name of the suppression group that this email address belongs to." + }, + "created_at": { + "type": "integer", + "description": "A UNIX timestamp indicating when the suppression was created." + } + }, + "required": [ + "email", + "group_id", + "group_name", + "created_at" + ] + } + }, + "examples": { + "application/json": [ + { + "email": "test1@example.com", + "group_id": 1, + "group_name": "Weekly News", + "created_at": 1410986704 + }, + { + "email": "test1@example.com", + "group_id": 2, + "group_name": "Daily News", + "created_at": 1411493671 + }, + { + "email": "test2@example.com", + "group_id": 2, + "group_name": "Daily News", + "created_at": 1411493671 + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_asm-suppressions", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/asm/suppressions/{email}": { + "parameters": [ + { + "name": "email", + "in": "path", + "description": "The email address that you want to search suppression groups for.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_asm-suppressions-email", + "summary": "Retrieve all suppression groups for an email address", + "tags": [ + "Suppressions - Suppressions" + ], + "description": "**This endpoint returns the list of all groups that the given email address has been unsubscribed from.**\n\nSuppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "suppressions": { + "type": "array", + "description": "The array of suppression groups.", + "items": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "The description of the suppression group." + }, + "id": { + "type": "integer", + "description": "The id of the suppression group." + }, + "is_default": { + "type": "boolean", + "description": "Indicates if the suppression group is set as the default." + }, + "name": { + "type": "string", + "description": "The name of the suppression group." + }, + "suppressed": { + "type": "boolean", + "description": "Indicates if the given email address is suppressed for this group." + } + }, + "required": [ + "description", + "id", + "is_default", + "name", + "suppressed" + ] + } + } + }, + "required": [ + "suppressions" + ] + }, + "examples": { + "application/json": { + "suppressions": [ + { + "description": "Optional description.", + "id": 1, + "is_default": true, + "name": "Weekly News", + "suppressed": true + }, + { + "description": "Some daily news.", + "id": 2, + "is_default": true, + "name": "Daily News", + "suppressed": true + }, + { + "description": "An old group.", + "id": 2, + "is_default": false, + "name": "Old News", + "suppressed": false + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_asm-suppressions-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/asm/groups/{group_id}/suppressions/search": { + "parameters": [ + { + "name": "group_id", + "in": "path", + "description": "The ID of the suppression group that you would like to search.", + "required": true, + "type": "string" + } + ], + "post": { + "operationId": "POST_asm-groups-group_id-suppressions-search", + "summary": "Search for suppressions within a group", + "tags": [ + "Suppressions - Suppressions" + ], + "description": "**This endpoint allows you to search a suppression group for multiple suppressions.**\n\nWhen given a list of email addresses and a group ID, this endpoint will return only the email addresses that have been unsubscribed from the given group.\n\nSuppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "recipient_emails": { + "type": "array", + "description": "The list of email address that you want to search the suppression group for.", + "items": { + "type": "string" + } + } + }, + "required": [ + "recipient_emails" + ], + "example": { + "recipient_emails": [ + "exists1@example.com", + "exists2@example.com", + "doesnotexists@example.com" + ] + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "recipient_emails": { + "type": "array", + "description": "The email address from your search that do exist in the suppression group.", + "items": { + "type": "string" + } + } + }, + "required": [ + "recipient_emails" + ] + }, + "examples": { + "application/json": { + "recipient_emails": [ + "exists1@example.com", + "exists2@example.com" + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_asm-groups-groupid-suppressions-search", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/asm/groups": { + "get": { + "operationId": "GET_asm-groups", + "summary": "Retrieve information about multiple suppression groups", + "tags": [ + "Suppressions - Unsubscribe Groups" + ], + "description": "**This endpoint allows you to retrieve information about multiple suppression groups.**\n\nThis endpoint will return information for each group ID that you include in your request. To add a group ID to your request, simply append `&id=` followed by the group ID.\n\nSuppressions are a list of email addresses that will not receive content sent under a given [group](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html).\n\nSuppression groups, or [unsubscribe groups](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html), allow you to label a category of content that you regularly send. This gives your recipients the ability to opt out of a specific set of your email. For example, you might define a group for your transactional email, and one for your marketing email so that your users can continue recieving your transactional email witout having to receive your marketing content.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "id", + "in": "query", + "description": "The ID of a suppression group that you want to retrieve information for.", + "type": "integer" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/suppression_group" + } + }, + "examples": { + "application/json": [ + { + "id": 100, + "name": "Newsletters", + "description": "Our monthly newsletter.", + "last_email_sent_at": null, + "is_default": true, + "unsubscribes": 400 + }, + { + "id": 101, + "name": "Alerts", + "description": "Emails triggered by user-defined rules.", + "last_email_sent_at": null, + "is_default": false, + "unsubscribes": 1 + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_asm-groups", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "post": { + "operationId": "POST_asm-groups", + "summary": "Create a new suppression group", + "tags": [ + "Suppressions - Unsubscribe Groups" + ], + "description": "**This endpoint allows you to create a new suppression group.**\n\nSuppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.\n\nThe **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.\n\nEach user can create up to 25 different suppression groups.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name that you would like to use for your new suppression group.", + "maxLength": 30 + }, + "description": { + "type": "string", + "description": "A brief description of your new suppression group.", + "maxLength": 100 + }, + "is_default": { + "type": "boolean", + "description": "Indicates if you would like this to be your default suppression group." + } + }, + "required": [ + "name", + "description" + ], + "example": { + "name": "Product Suggestions", + "description": "Suggestions for products our users might like.", + "is_default": true + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID of the suppression group." + }, + "name": { + "type": "string", + "description": "The name of the suppression group." + }, + "description": { + "type": "string", + "description": "A brief description of the suppression group." + }, + "is_default": { + "type": "boolean", + "description": "Indicates if this is the default suppression group." + } + }, + "required": [ + "id", + "name", + "description", + "is_default" + ] + }, + "examples": { + "application/json": { + "id": 103, + "name": "Product Suggestions", + "description": "Suggestions for products our users might like.", + "is_default": false + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_asm-groups", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/asm/groups/{group_id}": { + "parameters": [ + { + "name": "group_id", + "in": "path", + "description": "The ID of the suppression group you would like to retrieve.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_asm-groups-group_id", + "summary": "Get information on a single suppression group.", + "tags": [ + "Suppressions - Unsubscribe Groups" + ], + "description": "**This endpoint allows you to retrieve a single suppression group.**\n\nSuppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.\n\nThe **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.\n\nEach user can create up to 25 different suppression groups.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "The description of the suppression group." + }, + "id": { + "type": "integer", + "description": "The ID of the suppression group." + }, + "is_default": { + "type": "boolean", + "description": "Indicates if this is the default suppression group." + }, + "last_email_sent_at": { + "type": "null", + "description": "A unix timestamp indicating the last time this group was assigned to an email." + }, + "name": { + "type": "string", + "description": "The name of the suppression group." + }, + "unsubscribes": { + "type": "integer", + "description": "The number of unsubscribes, or suppressions, in this group." + } + } + }, + "examples": { + "application/json": { + "description": "Our monthly newsletter.", + "id": 100, + "is_default": true, + "last_email_sent_at": null, + "name": "Newsletters", + "unsubscribes": 400 + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_asm-groups-groupid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_asm-groups-group_id", + "summary": "Update a suppression group.", + "tags": [ + "Suppressions - Unsubscribe Groups" + ], + "description": "**This endpoint allows you to update or change a suppression group.**\n\nSuppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.\n\nThe **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.\n\nEach user can create up to 25 different suppression groups.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the suppression group." + }, + "name": { + "type": "string", + "description": "The name of the suppression group. Each group created by a user must have a unique name.", + "maxLength": 30 + }, + "description": { + "type": "string", + "description": "The description of the suppression group.", + "maxLength": 100 + }, + "is_default": { + "type": "boolean", + "description": "Indicates if the suppression group is set as the default group." + } + }, + "required": [ + "name" + ], + "example": { + "id": 103, + "name": "Item Suggestions", + "description": "Suggestions for items our users might like." + } + } + }, + { + "$ref": "#/parameters/trait:authorizationHeader:Authorization" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/suppression_group" + }, + "examples": { + "application/json": { + "id": 103, + "name": "Item Suggestions", + "description": "Suggestions for items our users might like." + } + } + } + }, + "x-stoplight": { + "id": "PATCH_asm-groups-groupid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_asm-groups-group_id", + "summary": "Delete a suppression group.", + "tags": [ + "Suppressions - Unsubscribe Groups" + ], + "description": "**This endpoint allows you to delete a suppression group.**\n\nYou can only delete groups that have not been attached to sent mail in the last 60 days. If a recipient uses the \"one-click unsubscribe\" option on an email associated with a deleted group, that recipient will be added to the global suppression list.\n\nSuppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.\n\nThe **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.\n\nEach user can create up to 25 different suppression groups.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_asm-groups-groupid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": 204, + "dynamic": false + } + } + } + }, + "/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\n**Note:** The Response Header's 'link' parameter will include pagination info. For example:\n\nlink: ```; rel=\"first\"; title=\"1\", ; rel=\"last\"; title=\"2\", ; rel=\"prev\"; title=\"1\"```", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_v3-scopes-requests", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "DELETE_v3-scopes-requests-request_id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "PATCH_v3-scopes-requests-approve-id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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 invite.\n\n**Note:** Teammate invitations will expire after 7 days. Resending an invite will reset the expiration date.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "POST_v3-teammates-pending-token-resend", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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\n**Note:** Each teammate invitation is valid for 7 days. Users may resend the invite to refresh the expiration date.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_v3-teammates-pending", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "" + }, + "404": { + "description": "", + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "field": { + "type": "string" + } + } + } + } + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_v3-teammates-pending-token", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/teammates": { + "post": { + "operationId": "POST_v3-teammates", + "summary": "Invite teammate", + "tags": [ + "Teammates" + ], + "description": "This endpoint allows you to send a teammate invitation via email with a predefined set of scopes, or permissions.\n\n**Note:** A teammate invite will expire after 7 days, but you may resend the invite at any time to reset the expiration date.\n\nEssentials, [Legacy Lite](https://sendgrid.com/docs/Classroom/Basics/Billing/legacy_lite_plan.html), and Free Trial users may create up to one teammate per account. There are no limits for how many teammates a Pro or higher account may create.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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 + } + } + } + ], + "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": [] + } + ], + "x-stoplight": { + "id": "POST_v3-teammates", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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\n**Note:** The Response Header will include pagination info. For example:\n\nlink: ```; rel=\"first\"; title=\"1\", ; rel=\"last\"; title=\"2\", ; rel=\"prev\"; title=\"1\"```", + "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 + } + ], + "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" + } + } + } + } + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_v3-teammates", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/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.", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_v3-teammates-username", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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.**", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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 + } + } + } + ], + "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": [] + } + ], + "x-stoplight": { + "id": "PATCH_v3-teammates-username", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "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.**", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "DELETE_v3-teammates-username", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/templates": { + "post": { + "operationId": "POST_templates", + "summary": "Create a transactional template.", + "tags": [ + "Transactional Templates" + ], + "description": "**This endpoint allows you to create a transactional template.**\n\nEach user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.\n\nTransactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name for the new transactional template.", + "maxLength": 100 + } + }, + "required": [ + "name" + ], + "example": { + "name": "example_name" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/transactional_template" + }, + "examples": { + "application/json": { + "id": "733ba07f-ead1-41fc-933a-3976baa23716", + "name": "example_name", + "versions": [] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_templates", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "get": { + "operationId": "GET_templates", + "summary": "Retrieve all transactional templates.", + "tags": [ + "Transactional Templates" + ], + "description": "**This endpoint allows you to retrieve all transactional templates.**\n\nEach user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.\n\nTransactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/transactional_template" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_templates", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/templates/{template_id}": { + "parameters": [ + { + "name": "template_id", + "in": "path", + "description": "The id of the transactional template you want to retrieve.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_templates-template_id", + "summary": "Retrieve a single transactional template.", + "tags": [ + "Transactional Templates" + ], + "description": "**This endpoint allows you to retrieve a single transactional template.**\n\nEach user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.\n\nTransactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/transactional_template" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_templates-templateid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + }, + "patch": { + "operationId": "PATCH_templates-template_id", + "summary": "Edit a transactional template.", + "tags": [ + "Transactional Templates" + ], + "description": "**This endpoint allows you to edit a transactional template.**\n\nEach user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.\n\nTransactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the transactional template.", + "maxLength": 100 + } + }, + "example": { + "name": "new_example_name" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/transactional_template" + }, + "examples": { + "application/json": { + "id": "733ba07f-ead1-41fc-933a-3976baa23716", + "name": "new_example_name", + "versions": [] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_templates-templateid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + }, + "delete": { + "operationId": "DELETE_templates-template_id", + "summary": "Delete a template.", + "tags": [ + "Transactional Templates" + ], + "description": "**This endpoint allows you to delete a transactional template.**\n\nEach user can create up to 300 different transactional templates. Transactional templates are specific to accounts and subusers. Templates created on a parent account will not be accessible from the subuser accounts.\n\nTransactional templates are templates created specifically for transactional email and are not to be confused with [Marketing Campaigns templates](https://sendgrid.com/docs/User_Guide/Marketing_Campaigns/templates.html). For more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_templates-templateid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/templates/{template_id}/versions": { + "parameters": [ + { + "name": "template_id", + "in": "path", + "required": true, + "type": "string" + } + ], + "post": { + "operationId": "POST_templates-template_id-versions", + "summary": "Create a new transactional template version.", + "tags": [ + "Transactional Templates Versions" + ], + "description": "**This endpoint allows you to create a new version of a template.**\n\nEach transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.\n\nFor more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/transactional_template_version", + "example": { + "template_id": "ddb96bbc-9b92-425e-8979-99464621b543", + "active": 1, + "name": "example_version_name", + "html_content": "<%body%>", + "plain_content": "<%body%>", + "subject": "<%subject%>" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The id of the new transactional template version." + }, + "updated_at": { + "type": "string", + "description": "The date and time that this transactional template version was updated." + }, + "Transactional Template Version": { + "$ref": "#/definitions/transactional_template_version" + } + }, + "required": [ + "id", + "updated_at" + ] + }, + "examples": { + "application/json": { + "id": "8aefe0ee-f12b-4575-b5b7-c97e21cb36f3", + "template_id": "ddb96bbc-9b92-425e-8979-99464621b543", + "active": 1, + "name": "example_version_name", + "html_content": "<%body%>", + "plain_content": "<%body%>", + "subject": "<%subject%>", + "updated_at": "2014-03-19 18:56:33" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_templates-templateid-versions", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/templates/{template_id}/versions/{version_id}/activate": { + "parameters": [ + { + "name": "template_id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "version_id", + "in": "path", + "required": true, + "type": "string" + } + ], + "post": { + "operationId": "POST_templates-template_id-versions-version_id-activate", + "summary": "Activate a transactional template version.", + "tags": [ + "Transactional Templates Versions" + ], + "description": "**This endpoint allows you to activate a version of one of your templates.**\n\nEach transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.\n\n\nFor more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| template_id | string | The ID of the original template |\n| version_id | string | The ID of the template version |", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the template version." + }, + "updated_at": { + "type": "string", + "description": "The date and time that the version was last updated." + }, + "Transactional Template Version": { + "$ref": "#/definitions/transactional_template_version" + } + }, + "required": [ + "id", + "updated_at" + ] + }, + "examples": { + "application/json": { + "id": "8aefe0ee-f12b-4575-b5b7-c97e21cb36f3", + "template_id": "e3a61852-1acb-4b32-a1bc-b44b3814ab78", + "active": 1, + "name": "example_version_name", + "html_content": "<%body%>", + "plain_content": "<%body%>", + "subject": "<%subject%>", + "updated_at": "2014-06-12 11:33:00" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_templates-templateid-versions-versionid-activate", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/templates/{template_id}/versions/{version_id}": { + "parameters": [ + { + "name": "template_id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "version_id", + "in": "path", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_templates-template_id-versions-version_id", + "summary": "Retrieve a specific transactional template version.", + "tags": [ + "Transactional Templates Versions" + ], + "description": "**This endpoint allows you to retrieve a specific version of a template.**\n\nEach transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.\n\nFor more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| template_id | string | The ID of the original template |\n| version_id | string | The ID of the template version |", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the template version." + }, + "updated_at": { + "type": "string", + "description": "The date and time that the template version was last updated." + }, + "Transactional Template Version": { + "$ref": "#/definitions/transactional_template_version" + } + }, + "required": [ + "id", + "updated_at" + ] + }, + "examples": { + "application/json": { + "id": "5997fcf6-2b9f-484d-acd5-7e9a99f0dc1f", + "template_id": "d51480ca-ca3f-465c-bc3e-ceb71d73c38d", + "active": 1, + "name": "version 1 name", + "html_content": "<%body%>", + "plain_content": "<%body%>", + "subject": "<%subject%>", + "updated_at": "2014-03-19 18:56:33" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_templates-templateid-versions-versionid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + }, + "patch": { + "operationId": "PATCH_templates-template_id-versions-version_id", + "summary": "Edit a transactional template version.", + "tags": [ + "Transactional Templates Versions" + ], + "description": "**This endpoint allows you to edit a version of one of your transactional templates.**\n\nEach transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.\n\nFor more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| template_id | string | The ID of the original template |\n| version_id | string | The ID of the template version |", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "active": { + "type": "integer", + "description": "Indicates if the template version is active." + }, + "name": { + "type": "string", + "description": "The name of the template version." + }, + "html_content": { + "type": "string", + "description": "The HTML content of the template version." + }, + "plain_content": { + "type": "string", + "description": "The text/plain content of the template version." + }, + "subject": { + "type": "string", + "description": "The subject of the template version." + } + }, + "example": { + "active": 1, + "name": "updated_example_name", + "html_content": "<%body%>", + "plain_content": "<%body%>", + "subject": "<%subject%>" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the template version." + }, + "updated_at": { + "type": "string", + "description": "The date and time that the template version was last updated." + }, + "Transactional Template Version": { + "$ref": "#/definitions/transactional_template_version" + } + }, + "required": [ + "id", + "updated_at" + ] + }, + "examples": { + "application/json": { + "id": "5997fcf6-2b9f-484d-acd5-7e9a99f0dc1f", + "template_id": "d51480ca-ca3f-465c-bc3e-ceb71d73c38d", + "active": 1, + "name": "version 1 name", + "html_content": "<%body%>", + "plain_content": "<%body%>", + "subject": "<%subject%>", + "updated_at": "2014-03-19 18:56:33" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_templates-templateid-versions-versionid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + }, + "delete": { + "operationId": "DELETE_templates-template_id-versions-version_id", + "summary": "Delete a transactional template version.", + "tags": [ + "Transactional Templates Versions" + ], + "description": "**This endpoint allows you to delete one of your transactional template versions.**\n\nEach transactional template can have multiple versions, each version with its own subject and content. Each user can have up to 300 versions across across all templates.\n\nFor more information about transactional templates, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Transactional_Templates/index.html).\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| template_id | string | The ID of the original template |\n| version_id | string | The ID of the template version |", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "null" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_templates-templateid-versions-versionid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "dynamic": false, + "enabled": false + } + } + } + }, + "/user/profile": { + "get": { + "operationId": "GET_user-profile", + "summary": "Get a user's profile", + "tags": [ + "Users API" + ], + "description": "Keeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.\n\nFor more information about your user profile:\n\n* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_user-profile", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "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\nKeeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.\n\nFor more information about your user profile:\n\n* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)\n\nIt should be noted that any one or more of the parameters can be updated via the PATCH /user/profile endpoint. The only requirement is that you include at least one when you PATCH.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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:ErrorResponse" + }, + "examples": { + "application/json": { + "errors": [ + { + "field": null, + "message": "authorization required" + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_user-profile", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/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.\n\nKeeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.\n\nFor more information about your user profile:\n\n* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_user-account", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/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.**\n\nKeeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.\n\nFor more information about your user profile:\n\n* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)", + "produces": [ + "application/json" + ], + "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." + } + }, + "required": [ + "email" + ] + }, + "examples": { + "application/json": { + "email": "test@example.com" + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_user-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "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.**\n\nKeeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.\n\nFor more information about your user profile:\n\n* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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." + } + }, + "required": [ + "email" + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PUT_user-email", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/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.**\n\nKeeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.\n\nFor more information about your user profile:\n\n* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_user-username", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "put": { + "operationId": "PUT_user-username", + "summary": "Update your username", + "tags": [ + "Users API" + ], + "description": "**This endpoint allows you to update the username for your account.**\n\nKeeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.\n\nFor more information about your user profile:\n\n* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "PUT_user-username", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + } + }, + "/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\nYour monthly credit allotment limits the number of emails you may send before incurring overage charges. For more information about credits and billing, please visit our [Clssroom](https://sendgrid.com/docs/Classroom/Basics/Billing/billing_info_and_faqs.html).", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "GET_user-credits", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/user/password": { + "put": { + "operationId": "PUT_user-password", + "summary": "Update your password", + "tags": [ + "Users API" + ], + "description": "**This endpoint allows you to update your password.**\n\nKeeping your user profile up to date is important. This will help SendGrid to verify who you are as well as contact you should we need to.\n\nFor more information about your user profile:\n\n* [SendGrid Account Settings](https://sendgrid.com/docs/User_Guide/Settings/account.html)", + "produces": [ + "application/json" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "PUT_user-password", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/user/webhooks/event/settings": { + "get": { + "operationId": "GET_user-webhooks-event-settings", + "summary": "Retrieve Event Webhook settings", + "tags": [ + "Webhooks" + ], + "description": "**This endpoint allows you to retrieve your current event webhook settings.**\n\nIf an event type is marked as `true`, then the event webhook will include information about that event.\n\nSendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.\n\nCommon uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/event_webhook_settings" + }, + "examples": { + "application/json": { + "enabled": true, + "url": "url", + "group_resubscribe": true, + "delivered": true, + "group_unsubscribe": true, + "spam_report": true, + "bounce": true, + "deferred": true, + "unsubscribe": true, + "processed": true, + "open": true, + "click": true, + "dropped": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_user-webhooks-event-settings", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + }, + "patch": { + "operationId": "PATCH_user-webhooks-event-settings", + "summary": "Update Event Notification Settings", + "tags": [ + "Webhooks" + ], + "description": "**This endpoint allows you to update your current event webhook settings.**\n\nIf an event type is marked as `true`, then the event webhook will include information about that event.\n\nSendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.\n\nCommon uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/event_webhook_settings", + "example": { + "enabled": true, + "url": "url", + "group_resubscribe": true, + "delivered": true, + "group_unsubscribe": true, + "spam_report": true, + "bounce": true, + "deferred": true, + "unsubscribe": true, + "processed": true, + "open": true, + "click": true, + "dropped": true + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/event_webhook_settings" + }, + "examples": { + "application/json": { + "enabled": true, + "url": "url", + "group_resubscribe": true, + "delivered": true, + "group_unsubscribe": true, + "spam_report": true, + "bounce": true, + "deferred": true, + "unsubscribe": true, + "processed": true, + "open": true, + "click": true, + "dropped": true + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_user-webhooks-event-settings", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "statusCode": 200, + "dynamic": false + } + } + } + }, + "/user/webhooks/event/test": { + "post": { + "operationId": "POST_user-webhooks-event-test", + "summary": "Test Event Notification Settings", + "tags": [ + "Webhooks" + ], + "description": "**This endpoint allows you to test your event webhook by sending a fake event notification post to the provided URL.**\n\nSendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.\n\nCommon uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL where you would like the test notification to be sent." + } + }, + "example": { + "url": "url" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "POST_user-webhooks-event-test", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": false, + "statusCode": 200 + } + } + } + }, + "/user/webhooks/parse/stats": { + "get": { + "operationId": "GET_user-webhooks-parse-stats", + "summary": "Retrieves Inbound Parse Webhook statistics.", + "tags": [ + "Webhooks" + ], + "description": "**This endpoint allows you to retrieve the statistics for your Parse Webhook useage.**\n\nSendGrid's Inbound Parse Webhook allows you to parse the contents and attachments of incomming emails. The Parse API can then POST the parsed emails to a URL that you specify. The Inbound Parse Webhook cannot parse messages greater than 20MB in size, including all attachments.\n\nThere are a number of pre-made integrations for the SendGrid Parse Webhook which make processing events easy. You can find these integrations in the [Library Index](https://sendgrid.com/docs/Integrate/libraries.html#-Webhook-Libraries).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "The number of statistics to return on each page.", + "required": false, + "type": "string" + }, + { + "name": "offset", + "in": "query", + "description": "The number of statistics to skip.", + "required": false, + "type": "string" + }, + { + "name": "aggregated_by", + "in": "query", + "description": "How you would like the statistics to by grouped. ", + "required": false, + "type": "string", + "enum": [ + "day", + "week", + "month" + ] + }, + { + "name": "start_date", + "in": "query", + "description": "The starting date of the statistics you want to retrieve. Must be in the format YYYY-MM-DD", + "required": true, + "type": "string" + }, + { + "name": "end_date", + "in": "query", + "description": "The end date of the statistics you want to retrieve. Must be in the format YYYY-MM-DD", + "required": false, + "type": "string", + "default": "The day the request is made." + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date that the stats were collected." + }, + "stats": { + "type": "array", + "description": "The Parse Webhook usage statistics.", + "items": { + "type": "object", + "properties": { + "metrics": { + "type": "object", + "properties": { + "received": { + "type": "number", + "description": "The number of emails received and parsed by the Parse Webhook." + } + }, + "required": [ + "received" + ] + } + } + } + } + }, + "required": [ + "date", + "stats" + ] + } + }, + "examples": { + "application/json": [ + { + "date": "2015-10-11", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-12", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-13", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-14", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-15", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-16", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-17", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-18", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-19", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-20", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-21", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-22", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-23", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-24", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-25", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-26", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-27", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-28", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-29", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-30", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-10-31", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-01", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-02", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-03", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-04", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-05", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-06", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-07", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-08", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-09", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + }, + { + "date": "2015-11-10", + "stats": [ + { + "metrics": { + "received": 0 + } + } + ] + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_user-webhooks-parse-stats", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + } + }, + "/whitelabel/domains": { + "get": { + "operationId": "GET_whitelabel-domains", + "summary": "List all domain whitelabels.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to retrieve a list of all domain whitelabels you have created.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)", + "produces": [ + "application/json" + ], + "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 a whitelabel.", + "type": "string" + }, + { + "name": "domain", + "in": "query", + "description": "Search for domain whitelabels that match the given domain.", + "type": "string" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "The ID of the domain whitelabel." + }, + "user_id": { + "type": "number", + "description": "The ID of the user that this whitelabel will be associated with." + }, + "subdomain": { + "type": "string", + "description": "The subdomain created for this domain whitelabel." + }, + "domain": { + "type": "string", + "description": "The domain that this whitelabel was created for." + }, + "username": { + "type": "string", + "description": "The username that this whitelabel is associated with." + }, + "ips": { + "type": "array", + "description": "The IPs that will be included in the custom SPF record.", + "items": { + "type": "string" + } + }, + "custom_spf": { + "type": "boolean", + "description": "Indicates if this whitelabel has custom SPF." + }, + "default": { + "type": "boolean", + "description": "Indicates if this whitelabel has been set as the default whitelabel." + }, + "legacy": { + "type": "boolean", + "description": "Indicates if this is whitelabel was created with the legacy whitelabel tool." + }, + "automatic_security": { + "type": "boolean", + "description": "Indicates if this whitelabel uses automated security." + }, + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid whitelabel or not." + }, + "dns": { + "type": "object", + "description": "The DNS records for this whitelabel that are used for authenticating the sending domain.", + "properties": { + "mail_server": { + "type": "object", + "description": "Designates which mail server is responsible for accepting messages from a domain.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid DNS record with no conflicts." + }, + "type": { + "type": "string", + "description": "The type of DNS record." + }, + "host": { + "type": "string", + "description": "The domain sending the messages." + }, + "data": { + "type": "string", + "description": "The mail server responsible for accepting messages." + } + } + }, + "subdomain_spf": { + "type": "object", + "description": "The SPF record for the subdomain used to create this whitelabel.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if the SPF record is valid." + }, + "type": { + "type": "string", + "description": "The type of data in the SPF record." + }, + "host": { + "type": "string", + "description": "The domain that this SPF record will be used to authenticate." + }, + "data": { + "type": "string", + "description": "The SPF record." + } + } + }, + "dkim": { + "type": "object", + "description": "The DNS record used when creating the DKIM signature.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if this DNS record is valid." + }, + "type": { + "type": "string", + "description": "The type of DNS record.", + "enum": [ + "cname", + "mx", + "txt" + ] + }, + "host": { + "type": "string", + "description": "The domain that these DNS records will be applied to.", + "format": "hostname" + }, + "data": { + "type": "string", + "description": "The DNS record." + } + } + } + } + } + }, + "required": [ + "id", + "user_id", + "subdomain", + "domain", + "username", + "ips", + "custom_spf", + "default", + "legacy", + "automatic_security", + "valid", + "dns" + ] + } + }, + "examples": { + "application/json": [ + { + "id": 1, + "domain": "example.com", + "subdomain": "mail", + "username": "john@example.com", + "user_id": 7, + "ips": [ + "192.168.1.1", + "192.168.1.2" + ], + "custom_spf": true, + "default": true, + "legacy": false, + "automatic_security": true, + "valid": true, + "dns": { + "mail_cname": { + "host": "mail.example.com", + "type": "cname", + "data": "u7.wl.sendgrid.net", + "valid": true + }, + "spf": { + "host": "example.com", + "type": "txt", + "data": "v=spf1 include:u7.wl.sendgrid.net -all", + "valid": true + }, + "dkim1": { + "host": "s1._domainkey.example.com", + "type": "cname", + "data": "s1._domainkey.u7.wl.sendgrid.net", + "valid": true + }, + "dkim2": { + "host": "s2._domainkey.example.com", + "type": "cname", + "data": "s2._domainkey.u7.wl.sendgrid.net", + "valid": true + } + } + }, + { + "id": 2, + "domain": "example2.com", + "subdomain": "news", + "username": "jane@example2.com", + "user_id": 8, + "ips": [], + "custom_spf": false, + "default": true, + "legacy": false, + "automatic_security": true, + "valid": false, + "dns": { + "mail_server": { + "host": "news.example2.com", + "type": "mx", + "data": "sendgrid.net", + "valid": false + }, + "subdomain_spf": { + "host": "news.example2.com", + "type": "txt", + "data": "v=spf1 include:sendgrid.net ~all", + "valid": false + }, + "domain_spf": { + "host": "example2.com", + "type": "txt", + "data": "v=spf1 include:news.example2.com -all", + "valid": false + }, + "dkim": { + "host": "example2.com", + "type": "txt", + "data": "k=rsa; t=s; p=publicKey", + "valid": false + } + } + } + ] + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-domains", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "post": { + "operationId": "POST_whitelabel-domains", + "summary": "Create a domain whitelabel.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to create a whitelabel for one of your domains.**\n\nIf you are creating a domain whitelabel that you would like a subuser to use, you have two options:\n1. Use the \"username\" parameter. This allows you to create a whitelabel on behalf of your subuser. This means the subuser is able to see and modify the created whitelabel.\n2. Use the Association workflow (see Associate Domain section). This allows you to assign a whitelabel created by the parent to a subuser. This means the subuser will default to the assigned whitelabel, but will not be able to see or modify that whitelabel. However, if the subuser creates their own whitelabel it will overwrite the assigned whitelabel.\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "domain": { + "type": "string", + "description": "Domain being whitelabeled." + }, + "subdomain": { + "type": "string", + "description": "The subdomain to use for this domain whitelabel." + }, + "username": { + "type": "string", + "description": "The username that this whitelabel will be associated with." + }, + "ips": { + "type": "array", + "description": "The IP addresses that will be included in the custom SPF record for this whitelabel.", + "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 domain whitelabels setup for manual security." + }, + "default": { + "type": "boolean", + "description": "Whether to use this whitelabel as the fallback if no domain whitelabels 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." + } + }, + "required": [ + "domain", + "subdomain" + ], + "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/whitelabel::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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-domains", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + } + }, + "/whitelabel/domains/{domain_id}": { + "parameters": [ + { + "name": "domain_id", + "in": "path", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_whitelabel-domains-domain_id", + "summary": "Retrieve a domain whitelabel.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to retrieve a specific domain whitelabel.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/whitelabel::domain" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-domains-domainid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_whitelabel-domains-domain_id", + "summary": "Update a domain whitelabel.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to update the settings for a domain whitelabel.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "default": { + "type": "boolean", + "default": false, + "description": "Indicates whether this domain whitelabel should be considered the default." + }, + "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": { + "title": "Update a Domain response", + "type": "object", + "properties": { + "default false": { + "description": "Inidcates whether this domain whitelabel should be considered the default. Defaults to false.", + "type": "boolean" + }, + "custom_spf false": { + "description": "Indicates whether to generate a custom SPF record for manual security. Defaults to false.", + "type": "boolean" + } + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "PATCH_whitelabel-domains-domainid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + }, + "delete": { + "operationId": "DELETE_whitelabel-domains-domain_id", + "summary": "Delete a domain whitelabel.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to delete a domain whitelabel.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_whitelabel-domains-domainid", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + } + }, + "/whitelabel/domains/default": { + "get": { + "operationId": "GET_whitelabel-domains-default", + "summary": "Get the default domain whitelabel.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to retrieve the default whitelabel for a domain.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| domain | string |The domain to find a default domain whitelabel for. |", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/whitelabel:domain_spf" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-domains-default", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "dynamic": false, + "enabled": null, + "statusCode": null + } + } + } + }, + "/whitelabel/domains/{id}/ips": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "post": { + "operationId": "POST_whitelabel-domains-id-ips", + "summary": "Add an IP to a domain whitelabel.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to add an IP address to a domain whitelabel.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| id | integer | ID of the domain to which you are adding an IP |", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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/whitelabel: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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-domains-id-ips", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/domains/{id}/ips/{ip}": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "ip", + "in": "path", + "required": true, + "type": "string" + } + ], + "delete": { + "operationId": "DELETE_whitelabel-domains-id-ips-ip", + "summary": "Remove an IP from a domain whitelabel.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to remove a domain's IP address from that domain's whitelabel.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| id | integer | ID of the domain whitelabel to delete the IP from. |\n| ip | string | IP to remove from the domain whitelabel. |", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/whitelabel: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": [] + } + ], + "x-stoplight": { + "id": "DELETE_whitelabel-domains-id-ips-ip", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/domains/{id}/validate": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string" + } + ], + "post": { + "operationId": "POST_whitelabel-domains-id-validate", + "summary": "Validate a domain whitelabel.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to validate a domain whitelabel. If it fails, it will return an error message describing why the whitelabel could not be validated.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| id | integer |ID of the domain whitelabel to validate. |", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID of the domain whitelabel." + }, + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid whitelabel." + }, + "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 domain whitelabel.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if this DNS record is valid." + }, + "reason": { + "type": "string", + "description": "The reason this record is invalid." + } + } + }, + "dkim1": { + "type": "object", + "description": "A DNS record for this domain whitelabel.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if the DNS record is valid." + }, + "reason": { + "type": "null" + } + } + }, + "dkim2": { + "type": "object", + "description": "A DNS record for this whitelabel.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if the DNS record is valid." + }, + "reason": { + "type": "null" + } + } + }, + "spf": { + "type": "object", + "description": "The SPF record for the whitelabel.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if the SPF record is valid." + }, + "reason": { + "type": "null" + } + } + } + } + } + } + }, + "examples": { + "application/json": { + "id": 1, + "valid": true, + "validation_results": { + "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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-domains-id-validate", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/domains/subuser": { + "get": { + "operationId": "GET_whitelabel-domains-subuser", + "summary": "List the domain whitelabel associated with the given user.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to retrieve all of the whitelabels that have been assigned to a specific subuser.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nDomain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| username | string | Username of the subuser to find associated whitelabels for. |", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/whitelabel: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": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-domains-subuser", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_whitelabel-domains-subuser", + "summary": "Disassociate a domain whitelabel from a given user.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to disassociate a specific whitelabel from a subuser.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nDomain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)\n\n## URI Parameters\n| URI Parameter | Type | Required? | Description |\n|---|---|---|---|\n| username | string | required | Username for the subuser to find associated whitelabels for. |", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_whitelabel-domains-subuser", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/domains/{domain_id}/subuser": { + "parameters": [ + { + "name": "domain_id", + "in": "path", + "required": true, + "type": "string" + } + ], + "post": { + "operationId": "POST_whitelabel-domains-domain_id-subuser", + "summary": "Associate a domain whitelabel with a given user.", + "tags": [ + "Whitelabel - Domains" + ], + "description": "**This endpoint allows you to associate a specific domain whitelabel with a subuser.**\n\nA domain whitelabel allows you to remove the “via” or “sent on behalf of” message that your recipients see when they read your emails. Whitelabeling a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record.\n\nDomain whitelabels can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's whitelabels. To associate a whitelabel with a subuser, the parent account must first create the whitelabel and validate it. The the parent may then associate the whitelabel via the subuser management tools.\n\nFor more information on whitelabeling, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html)\n\n## URI Parameters\n| URI Parameter | Type | Description |\n|---|---|---|\n| domain_id | integer | ID of the domain whitelabel to associate with the subuser. |", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "Username to associate with the domain whitelabel." + } + }, + "required": [ + "username" + ], + "example": { + "username": "jane@example.com" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/whitelabel: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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-domains-domainid-subuser", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + } + }, + "/whitelabel/ips": { + "get": { + "operationId": "GET_whitelabel-ips", + "summary": "Retrieve all IP whitelabels", + "tags": [ + "Whitelabel - IPs" + ], + "description": "**This endpoint allows you to retrieve all of the IP whitelabels that have been createdy by this account.**\n\nYou may include a search key by using the \"ip\" parameter. This enables you to perform a prefix search for a given IP segment (e.g. \"192.\").\n\nA IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "The number of results to retrieve.", + "type": "integer" + }, + { + "name": "offset", + "in": "query", + "description": "The point in the list of results to begin retrieving IPs from.", + "type": "integer" + }, + { + "name": "ip", + "in": "query", + "description": "The IP segment that you would 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/ip_whitelabel" + } + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-ips", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "post": { + "operationId": "POST_whitelabel-ips", + "summary": "Create an IP whitelabel", + "tags": [ + "Whitelabel - IPs" + ], + "description": "**This endpoint allows you to create an IP whitelabel.**\n\nWhen creating an IP whitelable, you should use the same subdomain that you used when you created a domain whitelabel.\n\nA IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "ip": { + "type": "string", + "description": "The IP address that you want to whitelabel." + }, + "subdomain": { + "type": "string", + "description": "The subdomain that will be used to send emails from the IP. Should be the same as the subdomain used for your domain whitelabel." + }, + "domain": { + "type": "string", + "description": "The root, or sending, domain that will be used to send message from the IP." + } + }, + "required": [ + "ip", + "subdomain", + "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/ip_whitelabel" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-ips", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/ips/{id}": { + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The id of the IP whitelabel that you would like to retrieve.", + "required": true, + "type": "string" + } + ], + "get": { + "operationId": "GET_whitelabel-ips-id", + "summary": "Retrieve an IP whitelabel", + "tags": [ + "Whitelabel - IPs" + ], + "description": "**This endpoint allows you to retrieve an IP whitelabel.**\n\nA IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/ip_whitelabel" + }, + "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" + } + } + } + }, + "404": { + "description": "", + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "description": "The errors preventing the retrieval of the IP whitelabel.", + "items": { + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "A message explaining why the IP whitelabel could not be found." + } + }, + "required": [ + "message" + ] + } + } + }, + "required": [ + "errors" + ] + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "Whitelabel ip not found." + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-ips-id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_whitelabel-ips-id", + "summary": "Delete an IP whitelabel", + "tags": [ + "Whitelabel - IPs" + ], + "description": "**This endpoint allows you to delete an IP whitelabel.**\n\nA IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + }, + "404": { + "description": "", + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "description": "The errors preventing the IP whitelabel from being deleted.", + "items": { + "type": "object", + "properties": { + "message": { + "type": "string", + "description": "A message explaining why the IP whitelabel could not be deleted." + } + } + } + } + } + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "Whitelabel ip not found." + } + ] + } + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_whitelabel-ips-id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": null, + "dynamic": false, + "enabled": null + } + } + } + }, + "/whitelabel/ips/{id}/validate": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "integer" + } + ], + "post": { + "operationId": "POST_whitelabel-ips-id-validate", + "summary": "Validate an IP whitelabel", + "tags": [ + "Whitelabel - IPs" + ], + "description": "**This endpoint allows you to validate an IP whitelabel.**\n\nA IP whitelabel consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the IP whitelabel." + }, + "valid": { + "type": "boolean", + "description": "Indicates if the IP whitelabel 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 IP whitelabel could be validated.", + "enum": [ + true, + false + ] + }, + "reason": { + "type": [ + "null", + "string" + ], + "description": "The reason the IP whitelabel could not be validated. Is null if the whitelabel was validated." + } + }, + "required": [ + "valid", + "reason" + ] + } + } + } + }, + "required": [ + "id", + "valid", + "validation_results" + ] + }, + "examples": { + "application/json": { + "id": 1, + "valid": true, + "validation_results": { + "a_record": { + "valid": true, + "reason": null + } + } + } + } + }, + "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 IP could not be validated." + } + }, + "required": [ + "message" + ] + } + } + }, + "required": [ + "errors" + ] + }, + "examples": { + "application/json": { + "errors": [ + { + "message": "Whitelabel ip 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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-ips-id-validate", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/links": { + "get": { + "operationId": "GET_whitelabel-links", + "summary": "Retrieve all link whitelabels", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to retrieve all link whitelabels.**\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "produces": [ + "application/json" + ], + "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_whitelabel" + } + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-links", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "statusCode": 200, + "enabled": false, + "dynamic": false + } + } + }, + "post": { + "operationId": "POST_whitelabel-links", + "summary": "Create a Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to create a new link whitelabel.**\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "Number of domains to return.", + "type": "integer", + "default": 50 + }, + { + "name": "offset", + "in": "query", + "description": "Paging offset.", + "type": "integer", + "default": 0 + }, + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "domain": { + "type": "string", + "description": "The root domain for your subdomain that you are creating the whitelabel for. This should match your FROM email address." + }, + "subdomain": { + "type": "string", + "description": "The subdomain to create the link whitelabel for. Must be different from the subdomain you used for a domain whitelabel." + }, + "default": { + "type": "boolean", + "description": "Indicates if you want to use this link whitelabel as the fallback, or default, whitelabel.", + "enum": [ + true, + false + ] + } + }, + "required": [ + "domain", + "subdomain" + ], + "example": { + "domain": "example.com", + "subdomain": "mail", + "default": true + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/link_whitelabel" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-links", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/links/{id}": { + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The id of the link whitelabel you want to retrieve.", + "required": true, + "type": "integer" + } + ], + "get": { + "operationId": "GET_whitelabel-links-id", + "summary": "Retrieve a Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to retrieve a specific link whitelabel.**\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/link_whitelabel" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-links-id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "patch": { + "operationId": "PATCH_whitelabel-links-id", + "summary": "Update a Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to update a specific link whitelabel. You can use this endpoint to change a link whitelabel's default status.**\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "object", + "properties": { + "default": { + "type": "boolean", + "description": "Indicates if the link whitelabel is set as the default, or fallback, whitelabel.", + "enum": [ + true, + false + ] + } + }, + "example": { + "default": true + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/link_whitelabel" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "PATCH_whitelabel-links-id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + }, + "delete": { + "operationId": "DELETE_whitelabel-links-id", + "summary": "Delete a Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to delete a link whitelabel.**\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_whitelabel-links-id", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/links/default": { + "get": { + "operationId": "GET_whitelabel-links-default", + "summary": "Retrieve a Default Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to retrieve the default link whitelabel.**\n\nDefault link whitelabel is the actual link whitelabel to be used when sending messages. If there are multiple link whitelabels, the default is determined by the following order:\n
    \n
  • Validated link whitelabels marked as \"default\"
  • \n
  • Legacy link whitelabels (migrated from the whitelabel wizard)
  • \n
  • Default SendGrid link whitelabel (i.e. 100.ct.sendgrid.net)
  • \n
\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "domain", + "in": "query", + "description": "The domain to match against when finding a corresponding link whitelabel.", + "type": "string" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/link_whitelabel" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-links-default", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/links/{id}/validate": { + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The id of the link whitelabel that you want to validate.", + "required": true, + "type": "integer" + } + ], + "post": { + "operationId": "POST_whitelabel-links-id-validate", + "summary": "Validate a Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to validate a link whitelabel.**\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the link whitelabel." + }, + "valid": { + "type": "boolean", + "description": "Indicates if the link whitelabel is valid.", + "enum": [ + true, + false + ] + }, + "validation_results": { + "type": "object", + "description": "The individual validations results for each of the DNS records associated with this link whitelabel.", + "required": [ + "domain_cname" + ], + "properties": { + "domain_cname": { + "type": "object", + "description": "The DNS record generated for the sending domain used for this link whitelabel.", + "required": [ + "valid", + "reason" + ], + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if this DNS record is valid.", + "enum": [ + true, + false + ] + }, + "reason": { + "type": [ + "string", + "null" + ], + "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 link whitelabel.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if the DNS record is valid.", + "enum": [ + true, + false + ] + }, + "reason": { + "type": [ + "null", + "string" + ], + "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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-links-id-validate", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/links/subuser": { + "get": { + "operationId": "GET_whitelabel-links-subuser", + "summary": "Retrieve Associated Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to retrieve the associated link whitelabel for a subuser.**\n\nLink whitelables can be associated with subusers from the parent account. This functionality allows\nsubusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account\nmust first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface.\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "username", + "in": "query", + "description": "The username of the subuser to retrieve associated link whitelabels for.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/link_whitelabel" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "GET_whitelabel-links-subuser", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": false, + "dynamic": false, + "statusCode": 200 + } + } + }, + "delete": { + "operationId": "DELETE_whitelabel-links-subuser", + "summary": "Disassociate a Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to disassociate a link whitelabel from a subuser.**\n\nLink whitelables can be associated with subusers from the parent account. This functionality allows\nsubusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account\nmust first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface.\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "parameters": [ + { + "name": "username", + "in": "query", + "description": "The username of the subuser account that you want to disassociate a link whitelabel from.", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "schema": { + "type": "null" + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "204": { + "description": "", + "schema": { + "type": "object" + } + } + }, + "security": [ + { + "Authorization": [] + } + ], + "x-stoplight": { + "id": "DELETE_whitelabel-links-subuser", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + }, + "/whitelabel/links/{link_id}/subuser": { + "parameters": [ + { + "name": "link_id", + "in": "path", + "description": "The id of the link whitelabel you want to associate.", + "required": true, + "type": "integer" + } + ], + "post": { + "operationId": "POST_whitelabel-links-link_id-subuser", + "summary": "Associate a Link Whitelabel", + "tags": [ + "Whitelabel - Links" + ], + "description": "**This endpoint allows you to associate a link whitelabel with a subuser account.**\n\nLink whitelables can be associated with subusers from the parent account. This functionality allows\nsubusers to send mail using their parent's linke whitelabels. To associate a link whitelabel, the parent account\nmust first create a whitelabel and validate it. The parent may then associate that whitelabel with a subuser via the API or the Subuser Management page in the user interface.\n\nEmail link whitelabels allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net.\n\nFor more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html).", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "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 link whitelabel with." + } + }, + "example": { + "username": "jane@example.com" + } + } + }, + { + "$ref": "#/parameters/trait:onBehalfOfSubuser:on-behalf-of" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/link_whitelabel" + }, + "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": [] + } + ], + "x-stoplight": { + "id": "POST_whitelabel-links-linkid-subuser", + "beforeScript": null, + "afterScript": null, + "public": true, + "mock": { + "enabled": null, + "statusCode": null, + "dynamic": false + } + } + } + } + }, + "parameters": { + "trait:authorizationHeader:Authorization": { + "name": "Authorization", + "in": "header", + "required": true, + "type": "string", + "default": "Bearer <>" + }, + "trait:onBehalfOfSubuser:on-behalf-of": { + "name": "on-behalf-of", + "in": "header", + "type": "string", + "default": "subuser_" + } + }, + "definitions": { + "mail_settings_spam_check": { + "title": "Mail Settings: Spam Check", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if your Spam Checker mail setting is enabled." + }, + "max_score": { + "type": "integer", + "default": 5, + "description": "The spam threshold. Can range from 1 to 10. The lower the number, the more strict the filtering.", + "minimum": 1, + "maximum": 10 + }, + "url": { + "type": "string", + "description": "The inbound parse URL where you would like the spam messages to be sent to." + } + }, + "required": [ + "enabled" + ], + "example": { + "enabled": false, + "max_score": 6, + "url": "http://example.com" + }, + "x-stoplight": { + "id": "mail_settings_spam_check", + "name": "Mail Settings: Spam Check", + "public": true + } + }, + "suppression_group_unsubscribes": { + "title": "Suppressions: Suppression Group with Unsubscribes", + "allOf": [ + { + "$ref": "#/definitions/suppression_group" + }, + { + "properties": { + "unsubscribes": { + "type": "integer", + "description": "The unsubscribes associated with this group." + } + }, + "required": [ + "unsubscribes" + ] + } + ], + "type": "object", + "x-stoplight": { + "id": "suppression_group_unsubscribes", + "name": "Suppressions: Suppression Group with Unsubscribes", + "public": true + } + }, + "partner_settings_new_relic": { + "title": "Partner Settings: New Relic", + "type": "object", + "properties": { + "enable_subuser_statistics": { + "type": "boolean", + "description": "Indicates if your subuser statistics will be sent to your New Relic Dashboard." + }, + "enabled": { + "type": "boolean", + "description": "Indicates if this setting is enabled. " + }, + "license_key": { + "type": "string", + "description": "The license key provided with your New Relic account." + } + }, + "required": [ + "enabled", + "license_key" + ], + "x-stoplight": { + "id": "partner_settings_new_relic", + "name": "Partner Settings: New Relic", + "public": true + } + }, + "subscription_tracking_settings": { + "title": "Settings: Subscription Tracking", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if subscription tracking is enabled." + }, + "html_content": { + "type": "string", + "description": "The information and HTML for your unsubscribe link. " + }, + "landing": { + "type": "string", + "description": "The HTML that will be displayed on the page that your customers will see after clicking unsubscribe, hosted on SendGrid’s server." + }, + "plain_content": { + "type": "string", + "description": "The information in plain text for your unsubscribe link. You should have the “<% %>” tag in your content, otherwise the user will have no URL for unsubscribing." + }, + "replace": { + "type": "string", + "description": "Your custom defined replacement tag for your templates. Use this tag to place your unsubscribe content anywhere in your emailtemplate." + }, + "url": { + "type": "string", + "description": "The URL where you would like your users sent to unsubscribe." + } + }, + "x-stoplight": { + "id": "subscription_tracking_settings", + "name": "Settings: Subscription Tracking", + "public": true + } + }, + "campaign_response": { + "title": "Campaigns Response", + "allOf": [ + { + "$ref": "#/definitions/campaign_request" + }, + { + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "The status of your campaign." + }, + "id": { + "type": "integer" + } + }, + "required": [ + "status" + ] + } + ], + "x-stoplight": { + "id": "campaign_response", + "name": "Campaigns Response", + "public": true + } + }, + "contactdb_recipient_response": { + "title": "ContactDB: Recipient response", + "type": "object", + "properties": { + "error_count": { + "type": "number", + "default": 0, + "description": "The number of errors found while adding recipients." + }, + "error_indices": { + "type": "array", + "default": [], + "description": "The indices of the recipient(s) sent that caused the error. ", + "items": { + "type": "number" + } + }, + "new_count": { + "type": "number", + "default": 0, + "description": "The count of new recipients added to the contactdb." + }, + "persisted_recipients": { + "type": "array", + "default": [], + "description": "The recipient IDs of the recipients that already existed from this request.", + "items": { + "type": "string" + } + }, + "updated_count": { + "type": "number", + "default": 0, + "description": "The recipients who were updated from this request." + }, + "errors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "error_indices": { + "type": "array", + "items": { + "type": "number" + } + } + } + } + } + }, + "required": [ + "error_count", + "new_count", + "persisted_recipients", + "updated_count" + ], + "example": { + "error_count": 1, + "error_indices": [ + 2 + ], + "new_count": 2, + "persisted_recipients": [ + "YUBh", + "bWlsbGVyQG1pbGxlci50ZXN0" + ], + "updated_count": 0, + "errors": [ + { + "message": "Invalid email.", + "error_indices": [ + 2 + ] + } + ] + }, + "x-stoplight": { + "id": "contactdb_recipient_response", + "name": "ContactDB: Recipient response", + "public": true + } + }, + "stats": { + "title": "Stats", + "type": "array", + "items": { + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date that the statistics were gathered." + }, + "stats": { + "type": "array", + "description": "The list of statistics.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of segmentation." + }, + "name": { + "type": "string", + "description": "The name of the specific segmentation." + }, + "metrics": { + "type": "object", + "description": "The individual events and their statistics.", + "properties": { + "blocks": { + "type": "integer", + "description": "The number of emails that were not allowed to be delivered by ISPs." + }, + "bounce_drops": { + "type": "integer", + "description": "The number of emails that were dropped because of a bounce." + }, + "bounces": { + "type": "integer", + "description": "The number of emails that bounced instead of being delivered." + }, + "clicks": { + "type": "integer", + "description": "The number of links that were clicked in your emails." + }, + "deferred": { + "type": "integer", + "description": "The number of emails that temporarily could not be delivered. " + }, + "delivered": { + "type": "integer", + "description": "The number of emails SendGrid was able to confirm were actually delivered to a recipient." + }, + "invalid_emails": { + "type": "integer", + "description": "The number of recipients who had malformed email addresses or whose mail provider reported the address as invalid." + }, + "opens": { + "type": "integer", + "description": "The total number of times your emails were opened by recipients." + }, + "processed": { + "type": "integer", + "description": "Requests from your website, application, or mail client via SMTP Relay or the API that SendGrid processed." + }, + "requests": { + "type": "integer", + "description": "The number of emails that were requested to be delivered." + }, + "spam_report_drops": { + "type": "integer", + "description": "The number of emails that were dropped due to a recipient previously marking your emails as spam." + }, + "spam_reports": { + "type": "integer", + "description": "The number of recipients who marked your email as spam." + }, + "unique_clicks": { + "type": "integer", + "description": "The number of unique recipients who clicked links in your emails." + }, + "unique_opens": { + "type": "integer", + "description": "The number of unique recipients who opened your emails." + }, + "unsubscribe_drops": { + "type": "integer", + "description": "The number of emails dropped due to a recipient unsubscribing from your emails." + }, + "unsubscribes": { + "type": "integer", + "description": "The number of recipients who unsubscribed from your emails." + } + } + } + } + } + } + } + }, + "x-stoplight": { + "id": "stats", + "name": "Stats", + "public": true + } + }, + "contactdb_segments_conditions": { + "title": "ContactDB: Segments: Conditions", + "type": "object", + "properties": { + "field": { + "type": "string" + }, + "value": { + "type": "string" + }, + "operator": { + "type": "string", + "enum": [ + "eq", + "ne", + "lt", + "gt", + "contains" + ] + }, + "and_or": { + "type": "string", + "enum": [ + "and", + "or", + "" + ] + } + }, + "required": [ + "field", + "value", + "operator" + ], + "x-stoplight": { + "id": "contactdb_segments_conditions", + "name": "ContactDB: Segments: Conditions", + "public": true + } + }, + "suppression_bounce": { + "title": "Suppression: Bounce", + "type": "object", + "properties": { + "created": { + "type": "number", + "description": "The unix timestamp for when the bounce record was created at SendGrid." + }, + "email": { + "type": "string" + }, + "reason": { + "type": "string", + "description": "The reason for the bounce. This typically will be a bounce code, an enhanced code, and a description." + }, + "status": { + "type": "string", + "description": "Enhanced SMTP bounce response" + } + }, + "example": { + "created": 1250337600, + "email": "example@example.com", + "reason": "550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/answer/6596 o186si2389584ioe.63 - gsmtp ", + "status": "5.1.1" + }, + "x-stoplight": { + "id": "suppression_bounce", + "name": "Suppression: Bounce", + "public": true + } + }, + "ip_whitelabel": { + "title": "Whitelabel - IPs", + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the IP whitelabel." + }, + "ip": { + "type": "string", + "description": "The IP address that this whitelabel was created for." + }, + "rdns": { + "type": "string", + "description": "The reverse DNS record for the IP address. This points to the IP whitelabel subdomain." + }, + "users": { + "type": "array", + "description": "The users who are able to send mail from the IP.", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "The username of the user who can send mail from this IP." + }, + "user_id": { + "type": "integer", + "description": "The ID of the user who can send mail from this IP." + } + }, + "required": [ + "username", + "user_id" + ] + } + }, + "subdomain": { + "type": "string", + "description": "The subdomain created for this IP whitelabel. This is where the rDNS record points." + }, + "domain": { + "type": "string", + "description": "The root, or sending, domain." + }, + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid whitelabel." + }, + "legacy": { + "type": "boolean", + "description": "Indicates if this whitelabel was created using the legacy whitelabel tool." + }, + "a_record": { + "type": "object", + "required": [ + "valid", + "type", + "host", + "data" + ], + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if the a_record is valid." + }, + "type": { + "type": "string", + "description": "The type of DNS record." + }, + "host": { + "type": "string", + "description": "This is the web address that will be mapped to the IP address." + }, + "data": { + "type": "string", + "description": "The IP address being whitelabeled." + } + } + } + }, + "required": [ + "id", + "ip", + "rdns", + "users", + "subdomain", + "domain", + "valid", + "legacy", + "a_record" + ], + "example": { + "id": 1, + "ip": "192.168.1.1", + "rdns": "o1.email.example.com", + "users": [ + { + "username": "john@example.com", + "user_id": 7 + }, + { + "username": "jane@example.com", + "user_id": 8 + } + ], + "subdomain": "email", + "domain": "example.com", + "valid": true, + "legacy": false, + "a_record": { + "valid": true, + "type": "a", + "host": "o1.email.example.com", + "data": "192.168.1.1" + } + }, + "x-stoplight": { + "id": "ip_whitelabel", + "name": "Whitelabel - IPs", + "public": true + } + }, + "contacts": { + "title": "Contacts", + "type": "object", + "properties": { + "address": { + "type": "string" + }, + "address2": { + "type": "object" + }, + "city": { + "type": "string" + }, + "company": { + "type": "string" + }, + "country": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "state": { + "type": "string" + }, + "zip": { + "type": "string" + } + }, + "x-stoplight": { + "id": "contacts", + "name": "Contacts", + "public": true + } + }, + "senderID": { + "title": "Sender ID", + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The unique identifier of the sender identity." + }, + "nickname": { + "type": "string", + "description": "A nickname for the sender identity. Not used for sending." + }, + "from": { + "type": "object", + "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." + } + }, + "required": [ + "email" + ] + }, + "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." + } + } + }, + "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." + }, + "verified": { + "type": "boolean", + "description": "If the sender identity is verified or not. Only verified sender identities can be used to send email." + }, + "updated_at": { + "type": "integer", + "description": "The time the sender identity was last updated." + }, + "created_at": { + "type": "integer", + "description": "The time the sender identity was created." + }, + "locked": { + "type": "boolean", + "description": "A sender identity is locked when it is associated to a campaign in the Draft, Scheduled, or In Progress status. You cannot update or delete a locked sender identity." + } + }, + "required": [ + "nickname", + "address", + "city", + "country" + ], + "example": { + "id": 1, + "nickname": "My Sender ID", + "from": { + "email": "from@example.com", + "name": "Example INC" + }, + "reply_to": { + "email": "replyto@example.com", + "name": "Example INC" + }, + "address": "123 Elm St.", + "address_2": "Apt. 456", + "city": "Denver", + "state": "Colorado", + "zip": "80202", + "country": "United States", + "verified": true, + "updated_at": 1449872165, + "created_at": 1449872165, + "locked": false + }, + "x-stoplight": { + "id": "senderID", + "name": "Sender ID", + "public": true + } + }, + "global:empty_request": { + "title": "Global: Request Empty Body", + "type": "null", + "x-stoplight": { + "id": "global:empty_request", + "name": "Global: Request Empty Body", + "public": true + } + }, + "contactdb_custom_field": { + "title": "ContactDB Custom field schema.", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the field" + }, + "type": { + "type": "string", + "description": "The type of the field.", + "enum": [ + "date", + "text", + "number" + ] + } + }, + "example": { + "name": "first_name", + "type": "text" + }, + "x-stoplight": { + "id": "contactdb_custom_field", + "name": "ContactDB: Custom Field", + "public": true + } + }, + "whitelabel:domain_spf": { + "title": "Whitelabel - Domain", + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The ID of the domain whitelabel." + }, + "domain": { + "type": "string", + "description": "The domain that this whitelabel was created for." + }, + "subdomain": { + "type": "string", + "description": "The subdomain that was used to create this whitelabel." + }, + "username": { + "type": "string", + "description": "The username of the account that this whitelabel is associated with." + }, + "user_id": { + "type": "integer", + "description": "The user_id of the account that this whitelabel is associated with." + }, + "ips": { + "type": "array", + "description": "The IP addresses that are included in the SPF record for this whitelabel.", + "items": {} + }, + "custom_spf": { + "type": "boolean", + "description": "Indicates if this whitelabel uses custom SPF." + }, + "default": { + "type": "boolean", + "description": "Indicates if this is the default whitelabel." + }, + "legacy": { + "type": "boolean", + "description": "Indicates if this whitelabel was created using the legacy whitelabel tool." + }, + "automatic_security": { + "type": "boolean", + "description": "Indicates if this whitelabel uses automated security." + }, + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid whitelabel." + }, + "dns": { + "type": "object", + "description": "The DNS records for this whitelabel.", + "required": [ + "mail_server", + "subdomain_spf", + "domain_spf", + "dkim" + ], + "properties": { + "mail_server": { + "type": "object", + "description": "Designates which mail server is responsible for accepting messages from a domain.", + "required": [ + "host", + "type", + "data", + "valid" + ], + "properties": { + "host": { + "type": "string", + "description": "The domain sending the messages." + }, + "type": { + "type": "string", + "description": "They type of DNS record." + }, + "data": { + "type": "string", + "description": "The mail server responsible for accepting messages from the sending domain." + }, + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid DNS record." + } + } + }, + "subdomain_spf": { + "type": "object", + "description": "The SPF record for the subdomain used to create this whitelabel.", + "required": [ + "host", + "type", + "data", + "valid" + ], + "properties": { + "host": { + "type": "string", + "description": "The domain that this SPF record will be used to authenticate." + }, + "type": { + "type": "string", + "description": "The type of data in the SPF record." + }, + "data": { + "type": "string", + "description": "The SPF record." + }, + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid SPF record." + } + } + }, + "domain_spf": { + "type": "object", + "description": "The SPF record for the root domain.", + "required": [ + "host", + "type", + "data", + "valid" + ], + "properties": { + "host": { + "type": "string", + "description": "The root domain that this SPF record will be used to authenticate." + }, + "type": { + "type": "string", + "description": "The type of data in the SPF record." + }, + "data": { + "type": "string", + "description": "The SPF record." + }, + "valid": { + "type": "boolean", + "description": "Indicates if the SPF record is valid." + } + } + }, + "dkim": { + "type": "object", + "description": "The DKIM record for messages sent using this whitelabel.", + "required": [ + "host", + "type", + "data", + "valid" + ], + "properties": { + "host": { + "type": "string", + "description": "The DNS labels for the DKIM signature." + }, + "type": { + "type": "string", + "description": "The type of data in the DKIM record." + }, + "data": { + "type": "string", + "description": "The DKIM record." + }, + "valid": { + "type": "boolean", + "description": "Indicates if the DKIM record is valid." + } + } + } + } + } + }, + "required": [ + "id", + "domain", + "subdomain", + "username", + "user_id", + "ips", + "custom_spf", + "default", + "legacy", + "automatic_security", + "valid", + "dns" + ], + "x-stoplight": { + "id": "whitelabel:domain_spf", + "name": "Whitelabel - Domain", + "public": true + } + }, + "subuser": { + "title": "List all Subusers for a parent response", + "type": "object", + "properties": { + "disabled": { + "type": "boolean", + "description": "Whether or not the user is enabled or disabled." + }, + "id": { + "type": "number", + "description": "The ID of this subuser." + }, + "username": { + "type": "string", + "description": "The name by which this subuser will be referred." + }, + "email": { + "type": "string", + "description": "The email address to contact this subuser.", + "format": "email" + } + }, + "required": [ + "disabled", + "id", + "username", + "email" + ], + "example": { + "disabled": false, + "email": "example@example.com", + "id": 1234, + "username": "example_subuser" + }, + "x-stoplight": { + "id": "subuser", + "name": "Subuser", + "public": true + } + }, + "mail_settings_address_whitelabel": { + "title": "Mail Settings: Address Whitelabel", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if you have an email address whitelist enabled. " + }, + "list": { + "type": "array", + "description": "All email address that are currently on the whitelist.", + "items": { + "type": "string" + } + } + }, + "example": { + "enabled": true, + "list": [ + "email1@example.com", + "example.com" + ] + }, + "x-stoplight": { + "id": "mail_settings_address_whitelabel", + "name": "Mail Settings: Address Whitelabel", + "public": true + } + }, + "link_whitelabel": { + "title": "Whitelabel - Links", + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The id of the link whitelabel." + }, + "domain": { + "type": "string", + "description": "The root domain for this link whitelabel." + }, + "subdomain": { + "type": "string", + "description": "The subdomain used to generate the DNS records for this link whitelabel. This subdomain must be different from the subdomain used for your domain whitelabel." + }, + "username": { + "type": "string", + "description": "The username of the account that this link whitelabel is associated with." + }, + "user_id": { + "type": "integer", + "description": "The id of the user that this whitelabel is associated with." + }, + "default": { + "type": "boolean", + "description": "Indicates if this is the default link whitelabel.", + "enum": [ + true, + false + ] + }, + "valid": { + "type": "boolean", + "description": "Indicates if this link whitelabel is valid.", + "enum": [ + true, + false + ] + }, + "legacy": { + "type": "boolean", + "description": "Indicates if this link whitelabel was created using the legacy whitelabel tool.", + "enum": [ + true, + false + ] + }, + "dns": { + "type": "object", + "description": "The DNS records generated for this link whitelabel.", + "required": [ + "domain_cname" + ], + "properties": { + "domain_cname": { + "type": "object", + "description": "The DNS record generated to point to your link whitelabel subdomain.", + "required": [ + "valid", + "type", + "host", + "data" + ], + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if the DNS record is valid.", + "enum": [ + true, + false + ] + }, + "type": { + "type": "string", + "description": "The type of DNS record that was generate.", + "enum": [ + "cname", + "txt", + "mx" + ] + }, + "host": { + "type": "string", + "description": "The domain that this whitelabel will use when whitelabeling the links in your email." + }, + "data": { + "type": "string", + "description": "The domain that the DNS record points to." + } + } + }, + "owner_cname": { + "type": "object", + "description": "The DNS record generated to verify who created the link whitelabel.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if the DNS record is valid.", + "enum": [ + true, + false + ] + }, + "type": { + "type": "string", + "description": "The type of DNS record generated.", + "enum": [ + "cname", + "txt", + "mx" + ] + }, + "host": { + "type": "string", + "description": "Used to verify the link whitelabel. The subdomain of this domain is the user id of the user who created the link whitelabel." + }, + "data": { + "type": "string", + "description": "The domain that the DNS record points to." + } + }, + "required": [ + "valid", + "host", + "data" + ] + } + } + } + }, + "required": [ + "id", + "domain", + "subdomain", + "username", + "user_id", + "default", + "valid", + "legacy", + "dns" + ], + "x-stoplight": { + "id": "link_whitelabel", + "name": "Whitelabel - Links", + "public": true + } + }, + "email_object": { + "title": "Email Object", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email" + }, + "name": { + "type": "string", + "description": "The name of the person to whom you are sending an email." + } + }, + "required": [ + "email" + ], + "x-stoplight": { + "id": "email_object", + "name": "Email Object", + "public": true + } + }, + "api_key_name_id_scopes": { + "title": "API Key Name, ID, and Scopes", + "allOf": [ + { + "type": "object", + "properties": { + "scopes": { + "type": "array", + "description": "The permissions this API Key has access to.", + "items": { + "type": "string" + } + } + } + }, + { + "$ref": "#/definitions/api_key_name_id" + } + ], + "example": { + "api_key_id": "qfTQ6KG0QBiwWdJ0-pCLCA", + "name": "A New Hope", + "scopes": [ + "user.profile.read", + "user.profile.update" + ] + }, + "x-stoplight": { + "id": "api_key_name_id_scopes", + "name": "API Key Name, ID, and Scopes", + "public": true + } + }, + "contactdb_segments": { + "title": "Create a Segment request", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of this segment." + }, + "list_id": { + "type": "integer", + "description": "The list id from which to make this segment. Not including this ID will mean your segment is created from the main contactdb rather than a list." + }, + "conditions": { + "type": "array", + "description": "The conditions for a recipient to be included in this segment.", + "items": { + "$ref": "#/definitions/contactdb_segments_conditions" + } + }, + "recipient_count": { + "type": "number", + "description": "The count of recipients in this list. This is not included on creation of segments." + } + }, + "required": [ + "name", + "conditions" + ], + "example": { + "name": "Last Name Miller", + "list_id": 4, + "conditions": [ + { + "field": "last_name", + "value": "Miller", + "operator": "eq", + "and_or": "" + }, + { + "field": "last_clicked", + "value": "01/02/2015", + "operator": "gt", + "and_or": "and" + }, + { + "field": "clicks.campaign_identifier", + "value": "513", + "operator": "eq", + "and_or": "or" + } + ], + "recipient_count": 1234 + }, + "x-stoplight": { + "id": "contactdb_segments", + "name": "ContactDB: Segments", + "public": true + } + }, + "api_key_name_id": { + "title": "API Key Name and ID", + "type": "object", + "properties": { + "api_key_id": { + "type": "string", + "description": "The ID of your API Key. " + }, + "name": { + "type": "string", + "description": "The name of your API Key." + } + }, + "example": { + "api_key_id": "qfTQ6KG0QBiwWdJ0-pCLCA", + "name": "A New Hope" + }, + "x-stoplight": { + "id": "api_key_name_id", + "name": "API Key Name and ID", + "public": true + } + }, + "advanced_stats_opens": { + "title": "Stats: Advanced Stats with Opens", + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date that the events occurred." + }, + "stats": { + "type": "array", + "description": "The statistics of the email events.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of segmentation." + }, + "name": { + "type": "string", + "description": "The name of the specific segmentation." + }, + "metrics": { + "type": "object", + "description": "The individual events and their stats.", + "required": [ + "opens", + "unique_opens" + ], + "properties": { + "opens": { + "type": "integer", + "description": "The total number of times your emails were opened by recipients." + }, + "unique_opens": { + "type": "integer", + "description": "The number of unique recipients who opened your emails." + } + } + } + }, + "required": [ + "type", + "name", + "metrics" + ] + } + } + }, + "required": [ + "date", + "stats" + ], + "x-stoplight": { + "id": "advanced_stats_opens", + "name": "Stats: Advanced Stats with Opens", + "public": true + } + }, + "mail_settings_template": { + "title": "Mail Settings: Template", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if the legacy email template setting is enabled." + }, + "html_content": { + "type": "string", + "description": "The HTML content that you want to use for your legacy email template." + } + }, + "example": { + "enabled": false, + "html_content": "

<% body %>Example

\n" + }, + "x-stoplight": { + "id": "mail_settings_template", + "name": "Mail Settings: Template", + "public": true + } + }, + "ip_warmup_response": { + "title": "IP Warmup: IP", + "type": "array", + "items": { + "type": "object", + "properties": { + "ip": { + "type": "string", + "description": "The IP address." + }, + "start_date": { + "type": "integer", + "description": "A Unix timestamp indicating when the IP address was entered into warmup mode." + } + }, + "required": [ + "ip", + "start_date" + ] + }, + "example": [ + { + "ip": "0.0.0.0", + "start_date": 1409616000 + } + ], + "x-stoplight": { + "id": "ip_warmup_response", + "name": "IP Warmup: IP", + "public": true + } + }, + "advanced_stats_mailbox_provider": { + "title": "Stats: Advanced Stats for Mailbox Provider", + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date that the events occurred." + }, + "stats": { + "type": "array", + "description": "The statistics of the email events.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of segmentation." + }, + "name": { + "type": "string", + "description": "The name of the specific segmentation." + }, + "metrics": { + "type": "object", + "description": "The individual events and their stats.", + "required": [ + "clicks", + "opens", + "unique_clicks", + "unique_opens", + "blocks", + "bounces", + "deferred", + "delivered", + "drops", + "spam_reports" + ], + "properties": { + "clicks": { + "type": "integer", + "description": "The number of links that were clicked in your emails." + }, + "opens": { + "type": "integer", + "description": "The total number of times your emails were opened by recipients." + }, + "unique_clicks": { + "type": "integer", + "description": "The number of unique recipients who clicked links in your emails." + }, + "unique_opens": { + "type": "integer", + "description": "The number of unique recipients who opened your emails." + }, + "blocks": { + "type": "integer", + "description": "The number of emails that were not allowed to be delivered by ISPs." + }, + "bounces": { + "type": "integer", + "description": "The number of emails that bounced instead of being delivered." + }, + "deferred": { + "type": "integer", + "description": "The number of emails that temporarily could not be delivered." + }, + "delivered": { + "type": "integer", + "description": "The number of emails SendGrid was able to confirm were actually delivered to a recipient." + }, + "drops": { + "type": "integer", + "description": "The number of emails that were not delivered due to the recipient email address being on a suppression list." + }, + "spam_reports": { + "type": "integer", + "description": "The number of recipients who marked your email as spam." + } + } + } + }, + "required": [ + "type", + "name", + "metrics" + ] + } + } + }, + "required": [ + "date", + "stats" + ], + "x-stoplight": { + "id": "advanced_stats_mailbox_provider", + "name": "Stats: Advanced Stats for Mailbox Provider", + "public": true + } + }, + "global:ErrorResponse": { + "title": "Global: Error Response", + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "field": { + "type": [ + "string", + "null" + ], + "description": "The field that generated the error." + }, + "message": { + "type": "string", + "description": "The error message." + } + }, + "required": [ + "message" + ] + } + } + }, + "example": { + "errors": [ + { + "field": "field_name", + "message": "Some message here" + } + ] + }, + "x-stoplight": { + "id": "global:ErrorResponse", + "name": "Global: Error Response", + "public": true + } + }, + "contactdb_custom_field_with_id": { + "title": "ContactDB Custom field schema with ID.", + "allOf": [ + { + "$ref": "#/definitions/contactdb_custom_field" + }, + { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "The ID of the custom field." + } + } + } + ], + "x-stoplight": { + "id": "contactdb_custom_field_with_id", + "name": "ContactDB: Custom Field with ID", + "public": true + } + }, + "monitor": { + "title": "Create monitor settings request", + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "The email address to send emails at the frequency specified for monitoring.", + "format": "email" + }, + "frequency": { + "type": "number", + "description": "The frequency by which to send the emails. An email will be sent, every time your subuser sends this {frequency} emails. " + } + }, + "required": [ + "email", + "frequency" + ], + "example": { + "email": "example@example.com", + "frequency": 50000 + }, + "x-stoplight": { + "id": "monitor", + "name": "Monitor Settings", + "public": true + } + }, + "errors": { + "title": "Error Schema", + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "field": { + "type": [ + "null", + "string" + ], + "description": "The field that has the error." + }, + "message": { + "type": "string", + "description": "The message the API caller will receive." + } + } + } + } + }, + "x-stoplight": { + "id": "errors", + "name": "Error Schema", + "public": true + } + }, + "ip_pool": { + "title": "IP Pools: Pool", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the IP pool.", + "maxLength": 64 + } + }, + "required": [ + "name" + ], + "x-stoplight": { + "id": "ip_pool", + "name": "IP Pools: Pool", + "public": true + } + }, + "google_analytics_settings": { + "title": "Settings: Google Analytics", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if Google Analytics is enabled." + }, + "utm_campaign": { + "type": "string", + "description": "The name of the campaign." + }, + "utm_content": { + "type": "string", + "description": "Used to differentiate ads" + }, + "utm_medium": { + "type": "string", + "description": "Name of the marketing medium (e.g. \"Email\")." + }, + "utm_source": { + "type": "string", + "description": "Name of the referrer source. " + }, + "utm_term": { + "type": "string", + "description": "Any paid keywords." + } + }, + "example": { + "enabled": true, + "utm_source": "sendgrid.com", + "utm_medium": "email", + "utm_term": "", + "utm_content": "", + "utm_campaign": "website" + }, + "x-stoplight": { + "id": "google_analytics_settings", + "name": "Settings: Google Analytics", + "public": true + } + }, + "event_webhook_settings": { + "title": "Webhooks: Event Webhook Settings", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if the event webhook is enabled." + }, + "url": { + "type": "string", + "description": "The URL that you want the event webhook to POST to." + }, + "group_resubscribe": { + "type": "boolean", + "description": "Recipient resubscribes to specific group by updating preferences. You need to enable Subscription Tracking for getting this type of event." + }, + "delivered": { + "type": "boolean", + "description": "Message has been successfully delivered to the receiving server." + }, + "group_unsubscribe": { + "type": "boolean", + "description": "Recipient unsubscribe from specific group, by either direct link or updating preferences. You need to enable Subscription Tracking for getting this type of event." + }, + "spam_report": { + "type": "boolean", + "description": "Recipient marked a message as spam." + }, + "bounce": { + "type": "boolean", + "description": "Receiving server could not or would not accept message." + }, + "deferred": { + "type": "boolean", + "description": "Recipient's email server temporarily rejected message." + }, + "unsubscribe": { + "type": "boolean", + "description": "Recipient clicked on message's subscription management link. You need to enable Subscription Tracking for getting this type of event." + }, + "processed": { + "type": "boolean", + "description": "Message has been received and is ready to be delivered." + }, + "open": { + "type": "boolean", + "description": "Recipient has opened the HTML message. You need to enable Open Tracking for getting this type of event." + }, + "click": { + "type": "boolean", + "description": "Recipient clicked on a link within the message. You need to enable Click Tracking for getting this type of event." + }, + "dropped": { + "type": "boolean", + "description": "You may see the following drop reasons: Invalid SMTPAPI header, Spam Content (if spam checker app enabled), Unsubscribed Address, Bounced Address, Spam Reporting Address, Invalid, Recipient List over Package Quota" + } + }, + "required": [ + "enabled", + "url", + "group_resubscribe", + "delivered", + "group_unsubscribe", + "spam_report", + "bounce", + "deferred", + "unsubscribe", + "processed", + "open", + "click", + "dropped" + ], + "x-stoplight": { + "id": "event_webhook_settings", + "name": "Webhooks: Event Webhook Settings", + "public": true + } + }, + "user_profile": { + "title": "User: Profile", + "type": "object", + "properties": { + "address": { + "type": "string", + "description": "The street address for this user profile." + }, + "address2": { + "type": "string", + "description": "An optional second line for the street address of this user profile." + }, + "city": { + "type": "string", + "description": "The city for the user profile." + }, + "company": { + "type": "string", + "description": "That company that this user profile is associated with." + }, + "country": { + "type": "string", + "description": "Th country of this user profile." + }, + "first_name": { + "type": "string", + "description": "The first name of the user." + }, + "last_name": { + "type": "string", + "description": "The last name of the user." + }, + "phone": { + "type": "string", + "description": "The phone number for the user." + }, + "state": { + "type": "string", + "description": "The state for this user." + }, + "website": { + "type": "string", + "description": "The website associated with this user." + }, + "zip": { + "type": "string", + "description": "The zip code for this user." + } + }, + "example": { + "address": "1451 Larimer Street, 3rd floor", + "address2": "", + "city": "Denver, CO", + "company": "SendGrid", + "country": "US", + "first_name": "Matthew", + "last_name": "Bernier", + "phone": "7208788003", + "state": "CO", + "website": "http://sendgrid.com", + "zip": "80202" + }, + "x-stoplight": { + "id": "user_profile", + "name": "User: Profile", + "public": true + } + }, + "mail_settings_footer": { + "title": "Mail Settings: Footer", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if the Footer mail setting is currently enabled." + }, + "html_content": { + "type": "string", + "description": "The custom HTML content of your email footer." + }, + "plain_content": { + "type": "string", + "description": "The plain text content of your email footer." + } + }, + "example": { + "enabled": true, + "html_content": "Example HTML content", + "plain_content": "Example plain content" + }, + "x-stoplight": { + "id": "mail_settings_footer", + "name": "Mail Settings: Footer", + "public": true + } + }, + "category_stats": { + "title": "Stats: Category Stats", + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date the statistics were gathered." + }, + "stats": { + "type": "array", + "items": { + "type": "object", + "properties": { + "metrics": { + "type": "object", + "properties": { + "blocks": { + "type": "integer", + "description": "The number of emails that were not allowed to be delivered by ISPs." + }, + "bounce_drops": { + "type": "integer", + "description": "The number of emails that were dropped because of a bounce." + }, + "bounces": { + "type": "integer", + "description": "The number of emails that bounced instead of being delivered." + }, + "clicks": { + "type": "integer", + "description": "The number of links that were clicked." + }, + "deferred": { + "type": "integer", + "description": "The number of emails that temporarily could not be delivered." + }, + "delivered": { + "type": "integer", + "description": "The number of emails SendGrid was able to confirm were actually delivered to a recipient." + }, + "invalid_emails": { + "type": "integer", + "description": "The number of recipients who had malformed email addresses or whose mail provider reported the address as invalid." + }, + "opens": { + "type": "integer", + "description": "The total number of times your emails were opened by recipients." + }, + "processed": { + "type": "integer", + "description": "Requests from your website, application, or mail client via SMTP Relay or the API that SendGrid processed." + }, + "requests": { + "type": "integer", + "description": "The number of emails that were requested to be delivered." + }, + "spam_report_drops": { + "type": "integer", + "description": "The number of emails that were dropped due to a recipient previously marking your emails as spam." + }, + "spam_reports": { + "type": "integer", + "description": "The number of recipients who marked your email as spam." + }, + "unique_clicks": { + "type": "integer", + "description": "The number of unique recipients who clicked links in your emails." + }, + "unique_opens": { + "type": "integer", + "description": "The number of unique recipients who opened your emails." + }, + "unsubscribe_drops": { + "type": "integer", + "description": "The number of emails dropped due to a recipient unsubscribing from your emails." + }, + "unsubscribes": { + "type": "integer", + "description": "The number of recipients who unsubscribed from your emails." + } + }, + "required": [ + "blocks", + "bounce_drops", + "bounces", + "clicks", + "deferred", + "delivered", + "invalid_emails", + "opens", + "processed", + "requests", + "spam_report_drops", + "spam_reports", + "unique_clicks", + "unique_opens", + "unsubscribe_drops", + "unsubscribes" + ] + }, + "name": { + "type": "string", + "description": "The name of the category." + }, + "type": { + "type": "string", + "description": "How you are segmenting your statistics." + } + }, + "required": [ + "type" + ] + } + } + }, + "required": [ + "date" + ], + "example": { + "date": "2015-01-01", + "stats": [ + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + }, + "name": "cat1", + "type": "category" + }, + { + "metrics": { + "blocks": 0, + "bounce_drops": 0, + "bounces": 0, + "clicks": 0, + "deferred": 0, + "delivered": 0, + "invalid_emails": 0, + "opens": 0, + "processed": 0, + "requests": 0, + "spam_report_drops": 0, + "spam_reports": 0, + "unique_clicks": 0, + "unique_opens": 0, + "unsubscribe_drops": 0, + "unsubscribes": 0 + }, + "name": "cat2", + "type": "category" + } + ] + }, + "x-stoplight": { + "id": "category_stats", + "name": "Stats: Category Stats", + "public": true + } + }, + "transactional_template": { + "title": "Transactional Templates: Template", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the transactional template." + }, + "name": { + "type": "string", + "description": "The name for the transactional template.", + "maxLength": 100 + }, + "versions": { + "type": "array", + "description": "The different versions of this transactional template.", + "items": { + "$ref": "#/definitions/transactional_template_version" + } + } + }, + "required": [ + "id", + "name" + ], + "x-stoplight": { + "id": "transactional_template", + "name": "Transactional Templates: Template", + "public": true + } + }, + "parse-setting": { + "title": "Parse Setting", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The public URL where you would like SendGrid to POST the data parsed from your email. Any emails sent with the given hostname provided (whose MX records have been updated to point to SendGrid) will be parsed and POSTed to this URL." + }, + "hostname": { + "type": "string", + "description": "A specific and unique domain or subdomain that you have created to use exclusively to parse your incoming email. For example, parse.yourdomain.com." + }, + "spam_check": { + "type": "boolean", + "description": "Indicates if you would like SendGrid to check the content parsed from your emails for spam before POSTing them to your domain." + }, + "send_raw": { + "type": "boolean", + "description": "Indicates if you would like SendGrid to post the original MIME-type content of your parsed email. When this parameter is set to \"false\", SendGrid will send a JSON payload of the content of your email. " + } + }, + "example": { + "url": "http://email.myhostname.com", + "hostname": "myhostname.com", + "spam_check": false, + "send_raw": true + }, + "x-stoplight": { + "id": "parse-setting", + "name": "Parse Setting", + "public": true + } + }, + "contactdb_list": { + "title": "ContactDB lists", + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "The reference ID of your list." + }, + "name": { + "type": "string", + "description": "The name of your list." + }, + "recipient_count": { + "type": "integer", + "description": "The count of recipients currently in the list." + } + }, + "required": [ + "id", + "name", + "recipient_count" + ], + "example": { + "id": 1, + "name": "listname", + "recipient_count": 0 + }, + "x-stoplight": { + "id": "contactdb_list", + "name": "ContactDB: List", + "public": true + } + }, + "suppression_group": { + "title": "Suppressions: Suppression Group", + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "The id of the suppression group." + }, + "name": { + "type": "string", + "description": "The name of the suppression group. Each group created by a user must have a unique name.", + "maxLength": 30 + }, + "description": { + "type": "string", + "description": "A description of the suppression group.", + "maxLength": 100 + }, + "last_email_sent_at": { + "type": "null" + }, + "is_default": { + "type": "boolean", + "default": false, + "description": "Indicates if this is the default suppression group." + } + }, + "required": [ + "id", + "name", + "description" + ], + "x-stoplight": { + "id": "suppression_group", + "name": "Suppressions: Suppression Group", + "public": true + } + }, + "mail_settings_bounce_purge": { + "title": "Mail Settings: Bounce Purge", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if the bounce purge mail setting is enabled." + }, + "soft_bounces": { + "type": [ + "integer", + "null" + ], + "description": "The number of days, after which SendGrid will purge all contacts from your soft bounces suppression lists." + }, + "hard_bounces": { + "type": [ + "integer", + "null" + ], + "description": "The number of days, after which SendGrid will purge all contacts from your hard bounces suppression lists." + } + }, + "example": { + "enabled": false, + "soft_bounces": 1234, + "hard_bounces": null + }, + "x-stoplight": { + "id": "mail_settings_bounce_purge", + "name": "Mail Settings: Bounce Purge", + "public": true + } + }, + "transactional_template_version": { + "title": "Transactional Templates: Version", + "type": "object", + "properties": { + "template_id": { + "type": "string", + "description": "The name of the original transactional template." + }, + "active": { + "type": "integer", + "description": "Set the new version as the active version associated with the template. Only one version of a template can be active. The first version created for a template will automatically be set to Active.", + "enum": [ + 0, + 1 + ] + }, + "name": { + "type": "string", + "description": "Name of the new transactional template version." + }, + "html_content": { + "type": "string", + "description": "The HTML content of the new version. Must include <%body%> tag. Maximum of 1048576 bytes allowed for plain content." + }, + "plain_content": { + "type": "string", + "description": "Text/plain content of the new transactional template version. Must include <%body%> tag. Maximum of 1048576 bytes allowed for plain content." + }, + "subject": { + "type": "string", + "description": "Subject of the new transactional template version. Must include <%subject%> tag." + } + }, + "required": [ + "template_id", + "active", + "name", + "html_content", + "plain_content", + "subject" + ], + "x-stoplight": { + "id": "transactional_template_version", + "name": "Transactional Templates: Version", + "public": true + } + }, + "mail_settings_bcc": { + "title": "Mail Settings: BCC", + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "The email address that will be sent a blind carbon copy." + }, + "enabled": { + "type": "boolean", + "description": "Indicates if the BCC setting is enabled." + } + }, + "example": { + "email": "example@example.com", + "enabled": false + }, + "x-stoplight": { + "id": "mail_settings_bcc", + "name": "Mail Settings: BCC", + "public": true + } + }, + "global:id": { + "title": "Global: ID", + "type": "integer", + "x-stoplight": { + "id": "global:id", + "name": "Global: ID", + "public": true + } + }, + "credentials": { + "title": "Credentials", + "type": "object", + "properties": { + "permissions": { + "type": "object", + "properties": { + "api": { + "type": "string" + }, + "mail": { + "type": "string" + }, + "web": { + "type": "string" + } + } + }, + "username": { + "type": "string" + } + }, + "example": { + "address": "1234 example street", + "address2": null, + "city": "Denver", + "company": "Company name", + "country": "US", + "email": "example@example.com", + "first_name": "Example", + "last_name": "User", + "phone": "(555) 555-5555", + "state": "CO", + "zip": "55555" + }, + "x-stoplight": { + "id": "credentials", + "name": "Credentials", + "public": true + } + }, + "subuser_stats": { + "title": "subuser_stats", + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date the statistics were gathered." + }, + "stats": { + "type": "array", + "description": "The list of statistics.", + "items": { + "type": "object", + "properties": { + "first_name": { + "type": "string", + "description": "The first name of the subuser." + }, + "last_name": { + "type": "string", + "description": "The last name of the subuser." + }, + "metrics": { + "type": "object", + "properties": { + "blocks": { + "type": "integer", + "description": "The number of emails that were not allowed to be delivered by ISPs." + }, + "bounce_drops": { + "type": "integer", + "description": "The number of emails that were dropped because of a bounce." + }, + "bounces": { + "type": "integer", + "description": "The number of emails that bounced instead of being delivered." + }, + "clicks": { + "type": "integer", + "description": "The number of links that were clicked in your emails." + }, + "deferred": { + "type": "integer", + "description": "The number of emails that temporarily could not be delivered." + }, + "delivered": { + "type": "integer", + "description": "The number of emails SendGrid was able to confirm were actually delivered to a recipient." + }, + "invalid_emails": { + "type": "integer", + "description": "The number of recipients who had malformed email addresses or whose mail provider reported the address as invalid." + }, + "opens": { + "type": "integer", + "description": "The total number of times your emails were opened by recipients." + }, + "processed": { + "type": "integer", + "description": "Requests from your website, application, or mail client via SMTP Relay or the API that SendGrid processed." + }, + "requests": { + "type": "integer", + "description": "The number of emails that were requested to be delivered." + }, + "spam_report_drops": { + "type": "integer", + "description": "The number of emails that were dropped due to a recipient previously marking your emails as spam." + }, + "spam_reports": { + "type": "integer", + "description": "The number of recipients who marked your email as spam." + }, + "unique_clicks": { + "type": "integer", + "description": "The number of unique recipients who clicked links in your emails." + }, + "unique_opens": { + "type": "integer", + "description": "The number of unique recipients who opened your emails." + }, + "unsubscribe_drops": { + "type": "integer", + "description": "The number of emails dropped due to a recipient unsubscribing from your emails." + }, + "unsubscribes": { + "type": "integer", + "description": "The number of recipients who unsubscribed from your emails." + } + } + }, + "name": { + "type": "string", + "description": "The username of the subuser." + }, + "type": { + "type": "string", + "description": "The type of account." + } + } + } + } + }, + "x-stoplight": { + "id": "subuser_stats", + "name": "subuser_stats", + "public": true + } + }, + "campaign_request": { + "title": "Campaigns Request", + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "The display title of your campaign. This will be viewable by you in the Marketing Campaigns UI." + }, + "subject": { + "type": [ + "string", + "null" + ], + "description": "The subject of your campaign that your recipients will see." + }, + "sender_id": { + "type": [ + "null", + "integer" + ], + "description": "The ID of the \"sender\" identity that you have created. Your recipients will see this as the \"from\" on your marketing emails." + }, + "list_ids": { + "type": [ + "array", + "null" + ], + "description": "The IDs of the lists you are sending this campaign to. You can have both segment IDs and list IDs", + "items": { + "type": "integer" + } + }, + "segment_ids": { + "type": [ + "array", + "null" + ], + "description": "The segment IDs that you are sending this list to. You can have both segment IDs and list IDs.", + "items": { + "type": "integer" + } + }, + "categories": { + "type": [ + "array", + "null" + ], + "description": "The categories you would like associated to this campaign.", + "items": { + "type": "string" + } + }, + "suppression_group_id": { + "type": [ + "null", + "integer" + ], + "description": "The suppression group that this marketing email belongs to, allowing recipients to opt-out of emails of this type." + }, + "custom_unsubscribe_url": { + "type": [ + "string", + "null" + ], + "description": "This is the url of the custom unsubscribe page that you provide for customers to unsubscribe from your suppression groups." + }, + "ip_pool": { + "type": [ + "string", + "null" + ], + "description": "The pool of IPs that you would like to send this email from." + }, + "html_content": { + "type": [ + "string", + "null" + ], + "description": "The HTML of your marketing email." + }, + "plain_content": { + "type": [ + "string", + "null" + ], + "description": "The plain text content of your emails." + } + }, + "required": [ + "title" + ], + "example": { + "id": 986724, + "title": "May Newsletter", + "subject": "New Products for Summer!", + "sender_id": 124451, + "list_ids": [ + 110, + 124 + ], + "segment_ids": [ + 110 + ], + "categories": [ + "summer line" + ], + "suppression_group_id": 42, + "custom_unsubscribe_url": "", + "ip_pool": "marketing", + "html_content": "

Check out our summer line!

", + "plain_content": "Check out our summer line!", + "status": "Draft" + }, + "x-stoplight": { + "id": "campaign_request", + "name": "Campaigns Request", + "public": true + } + }, + "user_scheduled_send_status": { + "title": "User: Scheduled Send status", + "allOf": [ + { + "$ref": "#/definitions/mail_batch_id" + }, + { + "type": "object", + "description": "The status of the scheduled send.", + "properties": { + "status": { + "type": "string", + "description": "The status of the scheduled send.", + "enum": [ + "cancel", + "pause" + ] + } + }, + "required": [ + "status" + ] + } + ], + "x-stoplight": { + "id": "user_scheduled_send_status", + "name": "User: Scheduled Send status", + "public": true + } + }, + "mail_settings_forward_spam": { + "title": "Mail Settings: Forward Spam", + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "The email address where you would like the spam reports to be forwarded." + }, + "enabled": { + "type": "boolean", + "description": "Indicates if the Forward Spam setting is enabled." + } + }, + "example": { + "email": "", + "enabled": true + }, + "x-stoplight": { + "id": "mail_settings_forward_spam", + "name": "Mail Settings: Forward Spam", + "public": true + } + }, + "contactdb_segments_with_id": { + "title": "ContactDB:: Segments with ID", + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "The ID of the segment." + } + }, + "required": [ + "id" + ] + }, + { + "$ref": "#/definitions/contactdb_segments" + } + ], + "x-stoplight": { + "id": "contactdb_segments_with_id", + "name": "ContactDB:: Segments with ID", + "public": true + } + }, + "advanced_stats_country": { + "title": "Stats: Advanced Stats with Clicks and Opens", + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date that the events occurred." + }, + "stats": { + "type": "array", + "description": "The statistics of the email events.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of segmentation." + }, + "name": { + "type": "string", + "description": "The name of the specific segmentation." + }, + "metrics": { + "type": "object", + "description": "The individual events and their stats.", + "required": [ + "clicks", + "opens", + "unique_clicks", + "unique_opens" + ], + "properties": { + "clicks": { + "type": "integer", + "description": "The number of links that were clicked in your emails." + }, + "opens": { + "type": "integer", + "description": "The total number of times your emails were opened by recipients." + }, + "unique_clicks": { + "type": "integer", + "description": "The number of unique recipients who clicked links in your emails." + }, + "unique_opens": { + "type": "integer", + "description": "The number of unique recipients who opened your emails." + } + } + } + }, + "required": [ + "type", + "name", + "metrics" + ] + } + } + }, + "required": [ + "date", + "stats" + ], + "x-stoplight": { + "id": "advanced_stats_country", + "name": "Stats: Advanced Stats with Clicks and Opens", + "public": true + } + }, + "advanced_stats_clicks": { + "title": "Stats: Advanced Stats with Clicks", + "type": "object", + "properties": { + "date": { + "type": "string", + "description": "The date that the events occurred." + }, + "stats": { + "type": "array", + "description": "The statistics of the email events.", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of segmentation." + }, + "name": { + "type": "string", + "description": "The name of the specific segmentation." + }, + "metrics": { + "type": "object", + "description": "The individual events and their stats.", + "required": [ + "clicks", + "unique_clicks" + ], + "properties": { + "clicks": { + "type": "integer", + "description": "The number of links that were clicked in your emails." + }, + "unique_clicks": { + "type": "integer", + "description": "The number of unique recipients who clicked links in your emails." + } + } + } + }, + "required": [ + "type", + "name", + "metrics" + ] + } + } + }, + "required": [ + "date", + "stats" + ], + "x-stoplight": { + "id": "advanced_stats_clicks", + "name": "Stats: Advanced Stats with Clicks", + "public": true + } + }, + "contactdb_recipient": { + "title": "ContactDB: Recipient", + "type": "object", + "properties": { + "recipients": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of this recipient." + }, + "created_at": { + "type": "number", + "description": "The time this record was created in your contactdb, in unixtime." + }, + "custom_fields": { + "type": "array", + "description": "The custom fields assigned to this recipient and their values.", + "items": { + "$ref": "#/definitions/contactdb_custom_field_with_id_value" + } + }, + "email": { + "type": "string", + "description": "The email address of this recipient. This is a default custom field that SendGrid provides.", + "format": "email" + }, + "first_name": { + "type": [ + "string", + "null" + ], + "description": "The first name of this recipient. This is a default custom field that SendGrid provides." + }, + "last_name": { + "type": [ + "string", + "null" + ], + "description": "The last name of the recipient." + }, + "last_clicked": { + "type": [ + "number", + "null" + ], + "description": "The last time this recipient clicked a link from one of your campaigns, in unixtime." + }, + "last_emailed": { + "type": [ + "number", + "null" + ], + "description": "The last time this user was emailed by one of your campaigns, in unixtime." + }, + "last_opened": { + "type": [ + "number", + "null" + ], + "description": "The last time this recipient opened an email from you, in unixtime." + }, + "updated_at": { + "type": "number", + "description": "The last update date for this recipient's record." + } + }, + "required": [ + "email" + ] + } + } + }, + "x-stoplight": { + "id": "contactdb_recipient", + "name": "ContactDB: Recipient", + "public": true + } + }, + "mail_settings_patch": { + "title": "Mail Settings: Patch", + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Indicates if the mail setting is enabled." + }, + "email": { + "type": "string", + "description": "The email address of the recipient." + } + }, + "example": { + "enabled": true, + "email": "email@example.com" + }, + "x-stoplight": { + "id": "mail_settings_patch", + "name": "Mail Settings: Patch", + "public": true + } + }, + "mail_settings_forward_bounce": { + "title": "Mail Settings: Forward Bounce", + "type": "object", + "properties": { + "email": { + "type": [ + "string", + "null" + ], + "description": "The email address that you would like your bounce reports forwarded to." + }, + "enabled": { + "type": "boolean", + "description": "Indicates if the bounce forwarding mail setting is enabled." + } + }, + "example": { + "enabled": false, + "email": null + }, + "x-stoplight": { + "id": "mail_settings_forward_bounce", + "name": "Mail Settings: Forward Bounce", + "public": true + } + }, + "contactdb_custom_field_with_id_value": { + "title": "ContactDB Custom field schema.", + "allOf": [ + { + "$ref": "#/definitions/contactdb_custom_field_with_id" + }, + { + "type": "object", + "properties": { + "value": { + "type": [ + "string", + "null" + ], + "description": "The value of this recipient's custom field" + } + } + } + ], + "x-stoplight": { + "id": "contactdb_custom_field_with_id_value", + "name": "ContactDB: Custom Field with ID & Value", + "public": true + } + }, + "contactdb_recipient_count": { + "title": "ContactDB: Recipient Count", + "type": "object", + "properties": { + "recipient_count": { + "type": "number", + "description": "The count of recipients." + } + }, + "required": [ + "recipient_count" + ], + "example": { + "recipient_count": 1234 + }, + "x-stoplight": { + "id": "contactdb_recipient_count", + "name": "ContactDB: Recipient Count", + "public": true + } + }, + "subuser_post": { + "title": "Subuser::POST", + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "The username of the subuser." + }, + "user_id": { + "type": "number", + "description": "The user ID for this subuser." + }, + "email": { + "type": "string", + "description": "The email address for this subuser.", + "format": "email" + }, + "signup_session_token": { + "type": "string" + }, + "authorization_token": { + "type": "string" + }, + "credit_allocation": { + "type": "object", + "properties": { + "type": { + "type": "string" + } + } + } + }, + "required": [ + "username", + "user_id", + "email" + ], + "example": { + "username": "example_subuser", + "user_id": 1234, + "email": "example@example.com", + "signup_session_token": "", + "authorization_token": "", + "credit_allocation": { + "type": "unlimited" + } + }, + "x-stoplight": { + "id": "subuser_post", + "name": "Subuser::POST", + "public": true + } + }, + "whitelabel::domain": { + "title": "Whitelabel - Domain", + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "The ID of the domain whitelabel." + }, + "user_id": { + "type": "number", + "description": "The ID of the user that this whitelabel will be associated with." + }, + "subdomain": { + "type": "string", + "description": "The subdomain to use for this domain whitelabel." + }, + "domain": { + "type": "string", + "description": "The domain that this whitelabel is being created for." + }, + "username": { + "type": "string", + "description": "The username that this whitelabel will be associated with." + }, + "ips": { + "type": "array", + "description": "The IPs to be included in the custom SPF record for this domain whitelabel.", + "items": { + "type": "object" + } + }, + "custom_spf": { + "type": "boolean", + "description": "Indicates whether this domain whitelabel will use custom SPF." + }, + "default": { + "type": "boolean", + "description": "Indicates if this domain whitelabel is the default whitelabel." + }, + "legacy": { + "type": "boolean", + "description": "Indicates if this domain whitelabel was created using the legacy whitelabel tool." + }, + "automatic_security": { + "type": "boolean", + "description": "Indicates if this domain whitelabel uses automated security." + }, + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid whitelabel." + }, + "dns": { + "type": "object", + "description": "The DNS records for this whitelabel that are used to authenticate the sending domain.", + "required": [ + "mail_cname", + "dkim1", + "dkim2" + ], + "properties": { + "mail_cname": { + "type": "object", + "description": "The CNAME for your sending domain that points to sendgrid.net.", + "required": [ + "valid", + "type", + "host", + "data" + ], + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid CNAME." + }, + "type": { + "type": "string", + "description": "The type of DNS record." + }, + "host": { + "type": "string", + "description": "The domain that this CNAME is created for.", + "format": "hostname" + }, + "data": { + "type": "string", + "description": "The CNAME record." + } + } + }, + "dkim1": { + "type": "object", + "description": "A DNS record.", + "required": [ + "valid", + "type", + "host", + "data" + ], + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid DNS record." + }, + "type": { + "type": "string", + "description": "The type of DNS record." + }, + "host": { + "type": "string", + "description": "The domain that this DNS record was created for." + }, + "data": { + "type": "string", + "description": "The DNS record." + } + } + }, + "dkim2": { + "type": "object", + "description": "A DNS record.", + "required": [ + "valid", + "type", + "host", + "data" + ], + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates if this is a valid DNS record." + }, + "type": { + "type": "string", + "description": "The type of DNS record." + }, + "host": { + "type": "string", + "description": "The domain that this DNS record was created for." + }, + "data": { + "type": "string", + "description": "The DNS record." + } + } + } + } + } + }, + "required": [ + "id", + "user_id", + "subdomain", + "domain", + "username", + "ips", + "custom_spf", + "default", + "legacy", + "automatic_security", + "valid", + "dns" + ], + "x-stoplight": { + "id": "whitelabel::domain", + "name": "Whitelabel - Domain", + "public": true + } + }, + "mail_batch_id": { + "title": "Mail: Batch ID", + "type": "object", + "properties": { + "batch_id": { + "type": "string", + "pattern": "^[a-zA-Z0-9\\-\\_]" + } + }, + "required": [ + "batch_id" + ], + "example": { + "batch_id": "HkJ5yLYULb7Rj8GKSx7u025ouWVlMgAi" + }, + "x-stoplight": { + "id": "mail_batch_id", + "name": "Mail: Batch ID", + "public": true + } + } + }, + "x-stoplight": { + "beforeScript": "function (ctx, request) {\n // REMOVE WITH CAUTION. OR AT LEAST, JUST LEAVE IT COMMENTED OUT.\n // Removing this means your endpoint before scripts will not be run!\n SL.runEndpoint();\n \n //adds the Accept header to every request\n // request.header.set(\"accept\", \"application/json\")\n \n //request.header.set(\"foo\", \"bear\");\n //request.header.add(\"bar\", \"cat\");\n\n if (request.url.query.get('accept')) {\n request.header.set('Accept', 'this is a bad header');\n }\n \n if (request.url.query.get('behalf')) {\n request.header.set('on-behalf-of', 'subuser2');\n }\n \n // For example, adding ?mock=200 to a request url will enable mocking,\n // using the example endpoint response for the 200 status code.\n // var mock = request.url.query.get(\"mock\")\n // if (mock) {\n // ctx.mock.set(true, mock)\n //}\n \n // For example, adding the header X-Mock: 200 will enable mocking,\n // using the example endpoint response for the 200 status code.\n var mock = request.header.get(\"X-Mock\");\n if (mock) {\n\t ctx.mock.set(true, mock);\n\t ctx.learn.set(false);\n }\n}", + "afterScript": "function (ctx, request, response) {\n // REMOVE WITH CAUTION. OR AT LEAST, JUST LEAVE IT COMMENTED OUT.\n // Removing this means your endpoint AFTER scripts will not be run!\n SL.runEndpoint();\n \n// if (response.body.get().count() > 1) {\n// request.hijack(200, 'application/json', {foo: 'bear'})\n// }\n\n \n //make this always available\n //SL.utilities.Audit_LogDataInResponse(ctx, request, response);\n \n //if (request.url.query.get('test')) {\n // SL.utilities.RunSpecifiedTests(ctx, request, response);\n //}\n \n // ELMER: Remove this, it logs only DELETE calls\n // if (JSON.parse(request.header.get('X-Mock')) == response.statusCode.get()) {\n // ctx.log.set(false);\n // } else {\n // ctx.log.set(true);\n //}\n}", + "version": { + "groups": { + "docs": [ + { + "description": "Elements that can be shared among more than one endpoint definition.", + "items": [ + { + "_id": "POST_mail-send", + "type": "endpoints" + }, + { + "_id": "mail-send-limitations", + "type": "docTextSections" + }, + { + "_id": "mail-send-validation", + "type": "docTextSections" + }, + { + "_id": "mail-send-errors", + "type": "docTextSections" + }, + { + "type": "schemas", + "_id": "email_object" + }, + { + "_id": "errors", + "type": "schemas" + } + ], + "name": "Mail Send", + "divider": false + }, + { + "divider": false, + "items": [ + { + "_id": "api-authentication", + "type": "docTextSections" + }, + { + "_id": "api-authorization", + "type": "docTextSections" + }, + { + "_id": "api-requests", + "type": "docTextSections" + }, + { + "_id": "on-behalf-of", + "type": "docTextSections" + }, + { + "_id": "api-responses", + "type": "docTextSections" + }, + { + "_id": "api-rate-limits", + "type": "docTextSections" + }, + { + "_id": "api-errors", + "type": "docTextSections" + } + ], + "name": "How to use the SendGrid v3 API" + }, + { + "name": "Alerts", + "items": [ + { + "_id": "POST_alerts", + "type": "endpoints" + }, + { + "_id": "GET_alerts", + "type": "endpoints" + }, + { + "_id": "GET_alerts-alertid", + "type": "endpoints" + }, + { + "_id": "DELETE_alerts-alertid", + "type": "endpoints" + }, + { + "_id": "PATCH_alerts-alertid", + "type": "endpoints" + } + ], + "divider": false, + "description": "Elements that can be shared among more than one endpoint definition." + }, + { + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false, + "items": [ + { + "_id": "api_key_name_id", + "type": "schemas" + }, + { + "_id": "api_key_name_id_scopes", + "type": "schemas" + }, + { + "_id": "GET_apikeys", + "type": "endpoints" + }, + { + "_id": "create-api-keys", + "type": "endpoints" + }, + { + "_id": "GET_apikeys-apikeyid", + "type": "endpoints" + }, + { + "_id": "DELETE_apikeys-apikeyid", + "type": "endpoints" + }, + { + "_id": "PATCH_apikeys-apikeyid", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "PUT_apikeys-apikeyid" + } + ], + "name": "API Keys" + }, + { + "items": [ + { + "_id": "GET_suppression-blocks", + "type": "endpoints" + }, + { + "_id": "DELETE_suppression-blocks", + "type": "endpoints" + }, + { + "_id": "GET_suppression-blocks-email", + "type": "endpoints" + }, + { + "_id": "DELETE_suppression-blocks-email", + "type": "endpoints" + } + ], + "name": "Blocks API", + "description": null, + "divider": false + }, + { + "name": "API Key Permissions", + "description": null, + "divider": false, + "items": [ + { + "_id": "api-key-permissions", + "type": "docTextSections" + }, + { + "_id": "GET_scopes", + "type": "endpoints" + } + ] + }, + { + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false, + "items": [ + { + "type": "schemas", + "_id": "suppression_bounce" + }, + { + "_id": "GET_suppression-bounces", + "type": "endpoints" + }, + { + "_id": "DELETE_suppression-bounces", + "type": "endpoints" + }, + { + "_id": "GET_suppression-bounces-email", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "DELETE_suppression-bounces-email" + } + ], + "name": "Bounces API" + }, + { + "name": "Campaigns API", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false, + "items": [ + { + "_id": "campaign_request", + "type": "schemas" + }, + { + "type": "schemas", + "_id": "campaign_response" + }, + { + "_id": "POST_campaigns", + "type": "endpoints" + }, + { + "_id": "GET_campaigns", + "type": "endpoints" + }, + { + "_id": "GET_campaigns-campaignid", + "type": "endpoints" + }, + { + "_id": "DELETE_campaigns-campaignid", + "type": "endpoints" + }, + { + "_id": "PATCH_campaigns-campaignid", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "POST_campaigns-campaignid-schedules-now" + }, + { + "_id": "POST_campaigns-campaignid-schedules", + "type": "endpoints" + }, + { + "_id": "PATCH_campaigns-campaignid-schedules", + "type": "endpoints" + }, + { + "_id": "GET_campaigns-campaignid-schedules", + "type": "endpoints" + }, + { + "_id": "DELETE_campaigns-campaignid-schedules", + "type": "endpoints" + }, + { + "_id": "POST_campaigns-campaignid-schedules-test", + "type": "endpoints" + } + ] + }, + { + "items": [ + { + "type": "schemas", + "_id": "mail_batch_id" + }, + { + "_id": "POST_mail-batch", + "type": "endpoints" + }, + { + "_id": "GET_mail-batch-batchid", + "type": "endpoints" + }, + { + "_id": "POST_user-scheduledsends", + "type": "endpoints" + }, + { + "_id": "GET_user-scheduledsends", + "type": "endpoints" + }, + { + "_id": "GET_user-scheduledsends-batchid", + "type": "endpoints" + }, + { + "_id": "PATCH_user-scheduledsends-batchid", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "DELETE_user-scheduledsends-batchid" + } + ], + "name": "Cancel Scheduled Sends", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "GET_categories", + "type": "endpoints" + }, + { + "_id": "GET_categories-stats-sums", + "type": "endpoints" + }, + { + "_id": "GET_categories-stats", + "type": "endpoints" + }, + { + "_id": "category_stats", + "type": "schemas" + } + ], + "name": "Categories", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "contactdb_custom_field_with_id", + "type": "schemas" + }, + { + "_id": "contactdb_custom_field_with_id_value", + "type": "schemas" + }, + { + "type": "schemas", + "_id": "contactdb_custom_field" + }, + { + "_id": "POST_contactdb-customfields", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-customfields", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-customfields-customfieldid", + "type": "endpoints" + }, + { + "_id": "DELETE_contactdb-customfields-customfieldid", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-reservedfields", + "type": "endpoints" + } + ], + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false, + "name": "Contacts API - Custom Fields" + }, + { + "items": [ + { + "type": "schemas", + "_id": "contactdb_list" + }, + { + "_id": "POST_contactdb-lists", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-lists", + "type": "endpoints" + }, + { + "_id": "DELETE_contactdb-lists", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-lists-listid", + "type": "endpoints" + }, + { + "_id": "PATCH_contactdb-lists-listid", + "type": "endpoints" + }, + { + "_id": "DELETE_contactdb-lists-listid", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-lists-listid-recipients", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "POST_contactdb-lists-listid-recipients-recipientid" + }, + { + "_id": "DELETE_contactdb-lists-listid-recipients-recipientid", + "type": "endpoints" + }, + { + "_id": "POST_contactdb-lists-listid-recipients", + "type": "endpoints" + } + ], + "name": "Contacts API - Lists", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "GET_contactdb-status", + "type": "endpoints" + }, + { + "type": "schemas", + "_id": "contactdb_recipient_count" + }, + { + "_id": "contactdb_recipient", + "type": "schemas" + }, + { + "_id": "contactdb_recipient_response", + "type": "schemas" + }, + { + "_id": "contacts", + "type": "schemas" + }, + { + "_id": "POST_contactdb-recipients", + "type": "endpoints" + }, + { + "_id": "PATCH_contactdb-recipients", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "DELETE_contactdb-recipients" + }, + { + "_id": "GET_contactdb-recipients", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-recipients-recipientid", + "type": "endpoints" + }, + { + "_id": "DELETE_contactdb-recipients-recipientid", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-recipients-recipientid-lists", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-recipients-billablecount", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-recipients-count", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-recipients-search", + "type": "endpoints" + } + ], + "name": "Contacts API - Recipients", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "contactdb_segments", + "type": "schemas" + }, + { + "_id": "contactdb_segments_with_id", + "type": "schemas" + }, + { + "_id": "contactdb_segments_conditions", + "type": "schemas" + }, + { + "_id": "POST_contactdb-segments", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-segments", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-segments-segmentid", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "PATCH_contactdb-segments-segmentid" + }, + { + "_id": "DELETE_contactdb-segments-segmentid", + "type": "endpoints" + }, + { + "_id": "GET_contactdb-segments-segmentid-recipients", + "type": "endpoints" + } + ], + "name": "Contacts API - Segments", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "credentials", + "type": "schemas" + } + ], + "name": "Credentials", + "description": null, + "divider": false + }, + { + "items": [ + { + "_id": "GET_suppression-invalidemails", + "type": "endpoints" + }, + { + "_id": "DELETE_suppression-invalidemails", + "type": "endpoints" + }, + { + "_id": "GET_suppression-invalidemails-email", + "type": "endpoints" + }, + { + "_id": "DELETE_suppression-invalidemails-email", + "type": "endpoints" + } + ], + "name": "Invalid Emails API", + "description": null, + "divider": false + }, + { + "items": [ + { + "_id": "GET_accesssettings-activity", + "type": "endpoints" + }, + { + "_id": "GET_accesssettings-whitelist", + "type": "endpoints" + }, + { + "_id": "POST_accesssettings-whitelist", + "type": "endpoints" + }, + { + "_id": "DELETE_accesssettings-whitelist", + "type": "endpoints" + }, + { + "_id": "GET_accesssettings-whitelist-ruleid", + "type": "endpoints" + }, + { + "_id": "DELETE_accesssettings-whitelist-ruleid", + "type": "endpoints" + } + ], + "name": "IP Access Management", + "divider": false, + "description": "Elements that can be shared among more than one endpoint definition." + }, + { + "items": [ + { + "_id": "POST_ips", + "type": "endpoints" + }, + { + "_id": "GET_ips-remaining", + "type": "endpoints" + }, + { + "_id": "GET_ips", + "type": "endpoints" + }, + { + "_id": "GET_ips-assigned", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "GET_ips-ipaddress" + } + ], + "name": "IP Addresses", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "ip_pool", + "type": "schemas" + }, + { + "_id": "POST_ips-pools", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "GET_ips-pools" + }, + { + "_id": "GET_ips-pools-poolname", + "type": "endpoints" + }, + { + "_id": "PUT_ips-pools-poolname", + "type": "endpoints" + }, + { + "_id": "DELETE_ips-pools-poolname", + "type": "endpoints" + }, + { + "_id": "POST_ips-pools-poolname-ips", + "type": "endpoints" + }, + { + "_id": "DELETE_ips-pools-poolname-ips-ip", + "type": "endpoints" + } + ], + "name": "IP Pools", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "name": "IP Warmup", + "items": [ + { + "type": "schemas", + "_id": "ip_warmup_response" + }, + { + "_id": "GET_ips-warmup", + "type": "endpoints" + }, + { + "_id": "GET_ips-warmup-ipaddress", + "type": "endpoints" + }, + { + "_id": "POST_ips-warmup", + "type": "endpoints" + }, + { + "_id": "DELETE_ips-warmup-ipaddress", + "type": "endpoints" + } + ], + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "name": "Sender Identities API", + "items": [ + { + "_id": "senderID", + "type": "schemas" + }, + { + "_id": "POST_senders", + "type": "endpoints" + }, + { + "_id": "GET_v3-senders", + "type": "endpoints" + }, + { + "_id": "PATCH_v3-senders-sender_id", + "type": "endpoints" + }, + { + "_id": "DELETE_v3-senders-sender_id", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "POST_v3-senders-sender_id-resend_verification" + }, + { + "_id": "GET_v3-senders-sender_id", + "type": "endpoints" + } + ] + }, + { + "items": [ + { + "_id": "GET_user-settings-enforcedtls", + "type": "endpoints" + }, + { + "_id": "PATCH_user-settings-enforcedtls", + "type": "endpoints" + } + ], + "name": "Settings - Enforced TLS", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "parse-setting", + "type": "schemas" + }, + { + "_id": "POST_user-webhooks-parse-settings", + "type": "endpoints" + }, + { + "_id": "GET_user-webhooks-parse-settings", + "type": "endpoints" + }, + { + "_id": "GET_user-webhooks-parse-settings-hostname", + "type": "endpoints" + }, + { + "_id": "PATCH_user-webhooks-parse-settings-hostname", + "type": "endpoints" + }, + { + "_id": "DELETE_user-webhooks-parse-settings-hostname", + "type": "endpoints" + } + ], + "name": "Settings - Inbound Parse", + "divider": false, + "description": "Elements that can be shared among more than one endpoint definition." + }, + { + "items": [ + { + "_id": "mail_settings_address_whitelabel", + "type": "schemas" + }, + { + "type": "schemas", + "_id": "mail_settings_bcc" + }, + { + "_id": "mail_settings_bounce_purge", + "type": "schemas" + }, + { + "_id": "mail_settings_footer", + "type": "schemas" + }, + { + "_id": "mail_settings_forward_bounce", + "type": "schemas" + }, + { + "type": "schemas", + "_id": "mail_settings_forward_spam" + }, + { + "_id": "mail_settings_spam_check", + "type": "schemas" + }, + { + "_id": "mail_settings_template", + "type": "schemas" + }, + { + "_id": "mail_settings_patch", + "type": "schemas" + }, + { + "type": "endpoints", + "_id": "GET_mailsettings" + }, + { + "_id": "GET_mailsettings-bcc", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-bcc", + "type": "endpoints" + }, + { + "_id": "GET_mailsettings-addresswhitelist", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-addresswhitelist", + "type": "endpoints" + }, + { + "_id": "GET_mailsettings-footer", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-footer", + "type": "endpoints" + }, + { + "_id": "GET_mailsettings-forwardspam", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-forwardspam", + "type": "endpoints" + }, + { + "_id": "GET_mailsettings-plaincontent", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-plaincontent", + "type": "endpoints" + }, + { + "_id": "GET_mailsettings-spamcheck", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-spamcheck", + "type": "endpoints" + }, + { + "_id": "GET_mailsettings-template", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-template", + "type": "endpoints" + }, + { + "_id": "GET_mailsettings-bouncepurge", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-bouncepurge", + "type": "endpoints" + }, + { + "_id": "GET_mailsettings-forwardbounce", + "type": "endpoints" + }, + { + "_id": "PATCH_mailsettings-forwardbounce", + "type": "endpoints" + } + ], + "name": "Settings - Mail", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "divider": false, + "items": [ + { + "_id": "partner_settings_new_relic", + "type": "schemas" + }, + { + "_id": "GET_partnersettings", + "type": "endpoints" + }, + { + "_id": "GET_partnersettings-newrelic", + "type": "endpoints" + }, + { + "_id": "PATCH_partnersettings-newrelic", + "type": "endpoints" + } + ], + "name": "Settings - Partner", + "description": "Elements that can be shared among more than one endpoint definition." + }, + { + "items": [ + { + "_id": "subscription_tracking_settings", + "type": "schemas" + }, + { + "_id": "google_analytics_settings", + "type": "schemas" + }, + { + "_id": "GET_trackingsettings", + "type": "endpoints" + }, + { + "_id": "GET_trackingsettings-click", + "type": "endpoints" + }, + { + "_id": "PATCH_trackingsettings-click", + "type": "endpoints" + }, + { + "_id": "GET_trackingsettings-googleanalytics", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "PATCH_trackingsettings-googleanalytics" + }, + { + "_id": "GET_trackingsettings-open", + "type": "endpoints" + }, + { + "_id": "PATCH_trackingsettings-open", + "type": "endpoints" + }, + { + "_id": "GET_trackingsettings-subscription", + "type": "endpoints" + }, + { + "_id": "PATCH_trackingsettings-subscription", + "type": "endpoints" + } + ], + "name": "Settings - Tracking", + "description": null, + "divider": false + }, + { + "items": [ + { + "_id": "GET_suppression-spamreports", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "DELETE_suppression-spamreports" + }, + { + "_id": "GET_suppression-spamreports-email", + "type": "endpoints" + }, + { + "_id": "DELETE_suppression-spamreports-email", + "type": "endpoints" + } + ], + "name": "Spam Reports API", + "description": null, + "divider": false + }, + { + "divider": false, + "items": [ + { + "_id": "stats", + "type": "schemas" + }, + { + "_id": "GET_stats", + "type": "endpoints" + }, + { + "_id": "advanced_stats_mailbox_provider", + "type": "schemas" + }, + { + "type": "schemas", + "_id": "advanced_stats_clicks" + }, + { + "_id": "advanced_stats_opens", + "type": "schemas" + }, + { + "_id": "advanced_stats_country", + "type": "schemas" + }, + { + "_id": "GET_geo-stats", + "type": "endpoints" + }, + { + "_id": "GET_devices-stats", + "type": "endpoints" + }, + { + "_id": "GET_clients-stats", + "type": "endpoints" + }, + { + "_id": "GET_clients-clienttype-stats", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "GET_mailboxproviders-stats" + }, + { + "_id": "GET_browsers-stats", + "type": "endpoints" + } + ], + "name": "Stats", + "description": "Elements that can be shared among more than one endpoint definition." + }, + { + "items": [ + { + "_id": "subuser_stats", + "type": "schemas" + }, + { + "type": "schemas", + "_id": "subuser" + }, + { + "_id": "subuser_post", + "type": "schemas" + }, + { + "_id": "monitor", + "type": "schemas" + }, + { + "type": "endpoints", + "_id": "GET_subusers" + }, + { + "_id": "POST_subusers", + "type": "endpoints" + }, + { + "_id": "PATCH_subusers-subusername", + "type": "endpoints" + }, + { + "_id": "DELETE_subusers-subusername", + "type": "endpoints" + }, + { + "_id": "GET_subusers-subusername-monitor", + "type": "endpoints" + }, + { + "_id": "POST_subusers-subusername-monitor", + "type": "endpoints" + }, + { + "_id": "PUT_subusers-subusername-monitor", + "type": "endpoints" + }, + { + "_id": "DELETE_subusers-subusername-monitor", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "GET_subusers-reputations" + }, + { + "_id": "PUT_subusers-subusername-ips", + "type": "endpoints" + }, + { + "_id": "GET_subusers-subusername-stats-monthly", + "type": "endpoints" + }, + { + "_id": "GET_subusers-stats-monthly", + "type": "endpoints" + }, + { + "_id": "GET_subusers-stats-sums", + "type": "endpoints" + }, + { + "_id": "GET_subusers-stats", + "type": "endpoints" + } + ], + "name": "Subusers API", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "GET_suppression-unsubscribes", + "type": "endpoints" + }, + { + "_id": "POST_asm-suppressions-global", + "type": "endpoints" + }, + { + "_id": "GET_asm-suppressions-global-email", + "type": "endpoints" + }, + { + "_id": "DELETE_asm-suppressions-global-email", + "type": "endpoints" + } + ], + "name": "Suppressions - Global Suppressions", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "name": "Suppressions - Suppressions", + "items": [ + { + "_id": "POST_asm-groups-groupid-suppressions", + "type": "endpoints" + }, + { + "_id": "GET_asm-groups-groupid-suppressions", + "type": "endpoints" + }, + { + "_id": "DELETE_asm-groups-groupid-suppressions-email", + "type": "endpoints" + }, + { + "_id": "GET_asm-suppressions", + "type": "endpoints" + }, + { + "_id": "GET_asm-suppressions-email", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "POST_asm-groups-groupid-suppressions-search" + } + ], + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "divider": false, + "items": [ + { + "_id": "suppression_group_unsubscribes", + "type": "schemas" + }, + { + "_id": "suppression_group", + "type": "schemas" + }, + { + "_id": "GET_asm-groups", + "type": "endpoints" + }, + { + "_id": "GET_asm-groups-groupid", + "type": "endpoints" + }, + { + "_id": "PATCH_asm-groups-groupid", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "DELETE_asm-groups-groupid" + }, + { + "_id": "POST_asm-groups", + "type": "endpoints" + }, + { + "_id": "GET_asm-groups", + "type": "endpoints" + } + ], + "name": "Suppressions - Unsubscribe Groups", + "description": "Elements that can be shared among more than one endpoint definition." + }, + { + "divider": false, + "items": [ + { + "_id": "GET_v3-scopes-requests", + "type": "endpoints" + }, + { + "_id": "DELETE_v3-scopes-requests-request_id", + "type": "endpoints" + }, + { + "_id": "PATCH_v3-scopes-requests-approve-id", + "type": "endpoints" + }, + { + "_id": "POST_v3-teammates-pending-token-resend", + "type": "endpoints" + }, + { + "_id": "GET_v3-teammates-pending", + "type": "endpoints" + }, + { + "_id": "DELETE_v3-teammates-pending-token", + "type": "endpoints" + }, + { + "_id": "POST_v3-teammates", + "type": "endpoints" + }, + { + "_id": "GET_v3-teammates", + "type": "endpoints" + }, + { + "_id": "GET_v3-teammates-username", + "type": "endpoints" + }, + { + "_id": "PATCH_v3-teammates-username", + "type": "endpoints" + }, + { + "_id": "DELETE_v3-teammates-username", + "type": "endpoints" + } + ], + "name": "Teammates", + "description": "**Teammates is currently in beta!**\n\nSendGrid is releasing the Teammates Beta to users in phases. If you do not immediately have access to Teammates, you will shortly. Stay tuned!" + }, + { + "items": [ + { + "_id": "transactional_template", + "type": "schemas" + }, + { + "_id": "POST_templates", + "type": "endpoints" + }, + { + "_id": "GET_templates", + "type": "endpoints" + }, + { + "_id": "GET_templates-templateid", + "type": "endpoints" + }, + { + "_id": "PATCH_templates-templateid", + "type": "endpoints" + }, + { + "_id": "DELETE_templates-templateid", + "type": "endpoints" + } + ], + "name": "Transactional Templates", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "transactional_template_version", + "type": "schemas" + }, + { + "_id": "POST_templates-templateid-versions", + "type": "endpoints" + }, + { + "_id": "POST_templates-templateid-versions-versionid-activate", + "type": "endpoints" + }, + { + "_id": "GET_templates-templateid-versions-versionid", + "type": "endpoints" + }, + { + "_id": "PATCH_templates-templateid-versions-versionid", + "type": "endpoints" + }, + { + "_id": "DELETE_templates-templateid-versions-versionid", + "type": "endpoints" + } + ], + "name": "Transactional Templates Versions", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "items": [ + { + "_id": "user_scheduled_send_status", + "type": "schemas" + }, + { + "_id": "user_profile", + "type": "schemas" + }, + { + "_id": "GET_user-profile", + "type": "endpoints" + }, + { + "_id": "PATCH_user-profile", + "type": "endpoints" + }, + { + "_id": "GET_user-account", + "type": "endpoints" + }, + { + "_id": "GET_user-email", + "type": "endpoints" + }, + { + "_id": "PUT_user-email", + "type": "endpoints" + }, + { + "_id": "GET_user-username", + "type": "endpoints" + }, + { + "_id": "PUT_user-username", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "GET_user-credits" + }, + { + "_id": "PUT_user-password", + "type": "endpoints" + } + ], + "name": "Users API", + "description": null, + "divider": false + }, + { + "description": null, + "divider": false, + "items": [ + { + "_id": "event_webhook_settings", + "type": "schemas" + }, + { + "_id": "GET_user-webhooks-event-settings", + "type": "endpoints" + }, + { + "_id": "PATCH_user-webhooks-event-settings", + "type": "endpoints" + }, + { + "_id": "POST_user-webhooks-event-test", + "type": "endpoints" + }, + { + "_id": "GET_user-webhooks-parse-settings", + "type": "endpoints" + }, + { + "_id": "GET_user-webhooks-parse-stats", + "type": "endpoints" + } + ], + "name": "Webhooks" + }, + { + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false, + "items": [ + { + "_id": "whitelabel::domain", + "type": "schemas" + }, + { + "_id": "whitelabel:domain_spf", + "type": "schemas" + }, + { + "type": "endpoints", + "_id": "GET_whitelabel-domains" + }, + { + "_id": "POST_whitelabel-domains", + "type": "endpoints" + }, + { + "_id": "GET_whitelabel-domains-domainid", + "type": "endpoints" + }, + { + "type": "endpoints", + "_id": "PATCH_whitelabel-domains-domainid" + }, + { + "_id": "DELETE_whitelabel-domains-domainid", + "type": "endpoints" + }, + { + "_id": "GET_whitelabel-domains-default", + "type": "endpoints" + }, + { + "_id": "POST_whitelabel-domains-id-ips", + "type": "endpoints" + }, + { + "_id": "DELETE_whitelabel-domains-id-ips-ip", + "type": "endpoints" + }, + { + "_id": "POST_whitelabel-domains-id-validate", + "type": "endpoints" + }, + { + "_id": "GET_whitelabel-domains-subuser", + "type": "endpoints" + }, + { + "_id": "DELETE_whitelabel-domains-subuser", + "type": "endpoints" + }, + { + "_id": "POST_whitelabel-domains-domainid-subuser", + "type": "endpoints" + } + ], + "name": "Whitelabel - Domains" + }, + { + "items": [ + { + "type": "schemas", + "_id": "ip_whitelabel" + }, + { + "_id": "GET_whitelabel-ips", + "type": "endpoints" + }, + { + "_id": "POST_whitelabel-ips", + "type": "endpoints" + }, + { + "_id": "GET_whitelabel-ips-id", + "type": "endpoints" + }, + { + "_id": "DELETE_whitelabel-ips-id", + "type": "endpoints" + }, + { + "_id": "POST_whitelabel-ips-id-validate", + "type": "endpoints" + } + ], + "name": "Whitelabel - IPs", + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "name": "Whitelabel - Links", + "items": [ + { + "_id": "link_whitelabel", + "type": "schemas" + }, + { + "_id": "GET_whitelabel-links", + "type": "endpoints" + }, + { + "_id": "POST_whitelabel-links", + "type": "endpoints" + }, + { + "_id": "GET_whitelabel-links-id", + "type": "endpoints" + }, + { + "_id": "PATCH_whitelabel-links-id", + "type": "endpoints" + }, + { + "_id": "DELETE_whitelabel-links-id", + "type": "endpoints" + }, + { + "_id": "GET_whitelabel-links-default", + "type": "endpoints" + }, + { + "_id": "POST_whitelabel-links-id-validate", + "type": "endpoints" + }, + { + "_id": "GET_whitelabel-links-subuser", + "type": "endpoints" + }, + { + "_id": "DELETE_whitelabel-links-subuser", + "type": "endpoints" + }, + { + "_id": "POST_whitelabel-links-linkid-subuser", + "type": "endpoints" + } + ], + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + }, + { + "divider": false, + "name": "Global: Models", + "items": [ + { + "_id": "global:ErrorResponse", + "type": "schemas" + }, + { + "_id": "global:id", + "type": "schemas" + }, + { + "_id": "global:empty_request", + "type": "schemas" + } + ], + "description": "Elements that can be shared among more than one endpoint definition." + }, + { + "name": "Global: Traits", + "items": [ + { + "_id": "authorizationHeader", + "type": "traits" + }, + { + "_id": "onBehalfOfSubuser", + "type": "traits" + } + ], + "description": "Elements that can be shared among more than one endpoint definition.", + "divider": false + } + ] + } + }, + "functions": {}, + "textSections": { + "mail-send-limitations": { + "id": "mail-send-limitations", + "name": "Limitations", + "content": "There are several rate limitations and restrictions that you should be aware of when using the v3 Mail Send endpoint.\n\n* The total size of your email, including attachments, must be less than 30MB.\n* The total number of recipients must be less than 1000. This includes all recipients defined within the `to`, `cc`, and `bcc` parameters, across each object that you include in the `personalizations` array.\n* 3000 requests/sec is the maximum rate at which you may call v3 Mail endpoint.\n* The total length of custom arguments must be less than 10000 bytes.\n* Unicode encoding is not supported for the `from` field within the `personalizations` array.\n* The `to.name`, `cc.name`, and `bcc.name` personalizations cannot include either the `;` or `,` characters.\n\nFor more specific, parameter level requirements and limitatiosn, please refer to the [v3/mail/send documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).", + "public": true + }, + "mail-send-validation": { + "id": "mail-send-validation", + "name": "Validation", + "content": "Whenever you make a request to the v3 Mail Send endpoint, your JSON payload is validated before your email is sent. If there are any errors, SendGrid will attempt to identify and return as many issues as possible for each request. For more information, please read our [error documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html).", + "public": true + }, + "api-authentication": { + "id": "api-authentication", + "name": "Authentication", + "content": "## Authorization Header\n\nTo authenticate, add an `Authorization` header to your API request that contains an [API Key](https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html).\n\n## API Keys\n\nSendGrid’s Web API v3 supports the use of API Keys. API Keys allow you to use another method of authentication separate from your account username and password. API Keys add an additional layer of security for your account and can be assigned [specific permissions](https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/api_key_permissions_list.html) to limit which areas of your account they may be used to access. [API Keys can be generated in your account](https://app.sendgrid.com/settings/api_keys). To use keys, you must set a plain text header named “Authorization” with the contents of the header being “Bearer XXX” where XXX is your API Secret Key.\n\n### Example Header\n\n```bash\nGET https://api.sendgrid.com/v3/resource HTTP/1.1\nAuthorization: Bearer Your.API.Key-HERE\n```\n\n```bash\ncurl -X \"GET\" \"https://api.sendgrid.com/v3/templates\" -H \"Authorization: Bearer Your.API.Key-HERE\" -H \"Content-Type: application/json\"\n```", + "public": true + }, + "api-requests": { + "id": "api-requests", + "name": "Requests", + "content": "## Making a Request\n\n### Host\n\nThe host for Web API v3 requets is always `https://sendgrid.com/v3/`\n\n**All requests must be made over HTTPS. HTTP is not supported.**\n\n### Authorization Header\n\nYou must provide an authorization header as described in [Authentication]().\n\n### HTTP Verbs\n\n| **Verb** | **Description** |\n| --- | --- |\n| GET | Retrieve a resource or gropu of resources |\n| POST| Create a new resource |\n| PUT | Update an existing resource |\n| DELTE | Delete an existing resource |\n| OPTIONS | View allowed verbs against a specific resource |\n\n### Accept Header\n\nThe API provides JSON responses. The [accept header](http://www.soapui.org/Best-Practices/understanding-rest-headers-and-parameters.html) is not currently required, though it may be required in the future. If not set, the API will use `application/json`.\n\n```bash\nGET https://api.sendgrid.com/v3/endpoint HTTP/1.1\nAccept: application/json\n```\n\n### Arrays of Data\n\nWhen you send an array of data in a `GET` request, you will include the parameter multiple times on the URL. We do not require that you add brackets to the parameter name.\n\n#### Example Array in a GET request\\\n\n```bash\nGET https://api.sendgrid.com/v3/endpoint?parameter=data1¶meter=data2 HTTP/1.1\n```\n\n## Formatting Your Request\n\n### Request Body\n\nWhen submitting data to a resource via `POST` or `PUT`, you must submit your payload in JSON.\n\n```bash\nPOST https://api.sendgrid.com/v3/templates/ HTTP/1.1\nContent-Type: application/json\n```\n\n```json\n{\n \"name\": \"new template name\"\n}\n```\n\n### Pagination\n\nSome `GET` resources allow for retrieval of information in batches. We will provide the query args in the resource documentation when available to consume.\n\nWhen requesting multiple items, we will default the request limit to 500 items. You can specify a different limit but cannot not exceed the default limit.\n\nResources documented will display a bolded list of available paginated parameters if available.\n\nBelow is a basic pagination example. In the resource documentation, we will only provide the bolded list of available parameters.\n\n**When information is batched, a [Link Header](http://tools.ietf.org/html/rfc5988) will be provided in the response.**\n\n```bash\nGET https://api.sendgrid.com/v3/resource?limit=300&offset=10 HTTP/1.1\n```\n\n| **Parameter** | **Description** |\n|---|---|\n| limit | The number of records to return |\n| offset | The number of records to skip |\n\n### Search & Paramters\n\nSome resources allow for you to search by a specific field. Other resources require you ot append a paramter to the URI.\n\nIn this example, we will display a paginated URI example, searching for resources where the email contains `foo`.\n\n```bash\nGET https://api.sendgrid.com/v3/resource?email=foo&bar=baz HTTP/1.1\n```\n\n## Successful Requests\n\nBelow is a general overview of what resource objects are returned on successful Web API requets.\n\n| **Verb** | **Resource object returned** |\n|---|---|\n| GET | A single resoruce object or array of resource objects |\n| PATCH | The updated resource object is returned |\n| PUT | The updated resource object is returned |\n| DELETE | No content is returned |\n| POST | The newly created resource object is returned |", + "public": true + }, + "api-responses": { + "id": "api-responses", + "name": "Responses", + "content": "## Content-Type Header\n\nAll responses are returned in JSON format. We specify this by sending the `Content-Type` header.\n\n```bash\nGET https://api.sendgrid.com/v3/resource HTTP/1.1\n```\n\n```json\nHTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"foo\": \"bar\"\n}\n```\n\n## Status Codes\n\nBelow is a table containing descriptions of the various status codes we currently support against various resources.\n\n| **Status Code** | **Description** |\n|---|---|\n| 200 | No error |\n| 201 | Successfully created |\n| 204 | Successfully deleted |\n| 400 | Bad request|\n| 401 | Requires authentication |\n| 406 | Missing Accept header. For example: `Accept: application/json` |\n| 429 | Too many requests/Rate limit exceeded |\n| 500 | Internal server error |\n\n## Pagination\n\nWhen a request is made with a pagination query, the following data is included in the header to allow for easy traversal of previous, current, first, and last page of the data set.\n\n```bash\nGET https://api.sendgrid.com/v3/resource?limit=5&offset=0 HTTP/1.1\n```\n\n```json\nHTTP/1.1 200 OK\nContent-Type: application/json\n\nLink: ; rel=\"next\"; title=\"2\",\n ; rel=\"prev\"; title=\"1\",\n ; rel=\"last\"; title=\"3\",\n ; rel=\"first\"; title=\"1\"\n\n```", + "public": true + }, + "api-rate-limits": { + "id": "api-rate-limits", + "name": "Rate Limits", + "content": "## Rate Limit Response Header\n\nAll calls within the Web API are allotted a specific number of requests per refresh period.\n\nEach Web API request returns the following header information regarding rate limits and number of requests left.\n\nDepending on the endpoint you are trying to reach, it will have a specific number of allowed requests per refresh period. Once this threshold has been reached, we will return a status code `429` response.\n\n### Example\n\n```bash\nGET https://api.sendgrid.com/v3/resource HTTP/1.1\n```\n\n```json\nHTTP/1.1 200 OK\nContent-Type: application/json\nX-RateLimit-Limit: 500\nX-RateLimit-Remaining: 499\nX-RateLimit-Reset: 1392815263\n\n{\n \"foo\": \"bar\"\n}\n```\n\n## When You Reach a Rate Limit\n\nYou will no longer be able to make request against that endpoint for the duration of that refresh period.\n\n### Example\n\n```bash\nGET https://api.sendgrid.com/v3/resource/ HTTP/1.1\n```\n\n```json\nHTTP/1.1 429 TOO MANY REQUESTS\nContent-Type: application/json\nX-RateLimit-Limit: 150\nX-RateLimit-Remaining: 0\nX-RateLimit-Reset: 1392815263\n\n{\n \"errors\": [\n {\n \"field\": null,\n \"message\": \"too many requests\"\n },\n ]\n}\n```", + "public": true + }, + "api-errors": { + "id": "api-errors", + "name": "Errors", + "content": "Sometimes your API call will generate an error. Here you will find additional information about what to expect if you don’t format your request properly, or we fail to properly process your request.\n\n## Response Codes\n\n| **Status Code** | **Description** |\n|---|---|\n| 400 | Bad request|\n| 401 | Requires authentication |\n| 406 | Missing Accept header. For example: `Accept: application/json` |\n| 429 | Too many requests/Rate limit exceeded |\n| 500 | Internal server error |\n\n## Failed Requests\n\nThe general format guidelines are displayed when the accompanying status code is returned.\n\n```bash\nGET https://api.sendgrid.com/v3/resource HTTP/1.1\n```\n\n```json\nHTTP/1.1 400 BAD REQUEST\nContent-Type: application/json\n\n{\n \"errors\": [\n {\"field\": \"identifier1\", \"message\": \"error message explained\"},\n {\"field\": \"identifier2\", \"message\": \"error message explained\"},\n {\"field\": \"identifier3\", \"message\": \"error message explained\"},\n ]\n}\n```", + "public": true + }, + "mail-send-errors": { + "id": "mail-send-errors", + "name": "Errors", + "content": "\n\n\n

Personalizations Errors

\n\n\n\n\n

personalizations

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n\n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The personalization block is limited to 1000 personalizations per API request. You have provided X personalizations. Please consider splitting this into multiple requests and resending your request.
The v3 Mail Send endpoint is only capable of processing 1000 individual personalizations objects per request. If you need to send your email to more than 1000 different recipients, we recommend that you simply make more than once call. For more information about the personalizations array, and how you can use it to define who you would like you send your email to, and how you would like your email to be processed, please visit our Classroom.
You must have at least one personalization.
Every email you send must have at least one recipient email address included. Recipients are defined in the personalizations array. For more information on how to use personalizations to define who you want to send your email to, please visit our Classroom.
There is a limit of 1000 total recipients (to + cc + bcc) per request.
The combined, total number of email recipients may never exceed 1000. This includes recipients defined within the to, cc, and bcc parameters. For more information on how you may specify your recipients, please visit our Classroom.
Each \"to\" object must at least have an email address and may also contain a name. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
For every recipient that you define within a personalizations.to parameter, you must include one, valid email address. You are not required to include a name.
Each unique email address in the personalizations array should only be included once. You have included [email address] more than once.
To prevent the same email from being delivered to one recipient multiple times, SendGrid will confirm that you do not duplicate an email address in your request. For more information on how you may specify your recipients, please visit our Classroom.
The to parameter is required for all personalization objects.
For every single object that you include within the personalizations array, you must include at least one to email object with a valid email address. For more information on how you may specify your recipients, please visit our Classroom.
\n\n\n\n\n

personalizations.bcc

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The bcc array, when used, must at least have an email parameter with a valid email address and it may also contain a name parameter. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
For every blind carbon copy of your email, you must include one, valid recipient email address. However, you are not required to include a corresponding name with the recipient email address. For more information on how to use personalizations to define who you want to send your email to, please visit our Classroom.
Each recipient object must at least have an email address and may also contain a name. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
Every recipient that you define within the personalizations.cc array must be in the form of an email object including one, valid email address. You are not required to include a name.
Each unique email address in the personalization block should only be included once. You have included [email address] more than once.
To prevent the same email from being delivered to one recipient multiple times, SendGrid will confirm that you do not duplicate an email address in your request. For more information on how you may specify your recipients, please visit our Classroom.
\n\n\n\n\n

personalizations.cc

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The cc array, when used, must at least have an email parameter with a valid email address and it may also contain a name parameter. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
For every carbon copy of your email, you must include one, valid recipient email address. However, you are not required to include a corresponding name with the recipient email address. For more information on how to use personalizations to define who you want to send your email to, please visit our Classroom.
Each recipient object must at least have an email address and may also contain a name. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
Every recipient that you define within the personalizations.cc array must be in the form of an email object including one, valid email address. You are not required to include a name.
Each unique email address in the personalization block should only be included once. You have included [email address] more than once.
To prevent the same email from being delivered to one recipient multiple times, SendGrid will confirm that you do not duplicate an email address in your request. For more information on how you may specify your recipients, please visit our Classroom.
\n\n\n\n\n

personalizations.custom_args

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
All values of custom arguments object must be strings
Custom argument values must always be strings. You cannot define arrays, integers, or booleans as custom argument values. Click here more information about how to use custom arguments.
custom_args cannot be empty.
If you include the custom_args parameter, you must include at least one value. If you do not want to use any custom arguments, simply omit the custom_arg param from your request. Click here more information about how to use custom arguments.
The combined size of both global and personalization custom arguments may not exceed 10,000 bytes per personalization.
personalizations[x].custom_args will be merged with message level custom_args, overriding any conflicting keys. The combined total size of the resulting custom arguments, after merging, for each personalization may not exceed 10,000 bytes. Click here more information about how to use custom arguments.
\n\n\n\n\n

personalizations.headers

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
All values of the headers object must be strings.
The object type of every header that you include must be a string. You cannot include headers that are integers, booleans, or arrays.
The headers cannot contain duplicate keys.
You may not include the same header more than once.
Header keys cannot contain non-ASCII characters or empty spaces.
When defining the headers that you would like to use, you must make sure that the string contains only ASCII characters.
Header cannot be one of the reserved keys.
Some header keys are reserved. You may not include any of the following reserved keys: x-sg-id, x-sg-eid, received, dkim-signature, Content-Type, Content-Transfer-Encoding, To, From, Subject, Reply-To, CC, BCC.
\n\n\n\n\n

personalizations.send_at

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The send_at parameter is expecting a Unix timestamp as an integer. We will send immediately if you include a send_at timestamp that is in the past.
send_at accepts a unix timestamp representing when you want your email to be sent from SendGrid. If you want the email to be sent at the time of your API request, simply omit the send_at parameter.
Scheduling more than 72 hours in advance is forbidden.
The send_at parameter allows you to schedule your email to be sent up to 72 hours in advance, but due to our constraints, we cannot schedule emails more than 72 hours in the future. For more information on scheduling parameters, please see our API Reference.
\n\n\n\n\n

personalizations.subject

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The subject of your email must be a string at least one character in length.
You are required to include a subject for every email you send, and you may not include an empty subject. The minimum length of your subject is one character.
The subject is required. You can get around this requirement if you use a template with a subject defined.
Every email must have a subject. This can be accomplished 3 ways: you include a template that has a subject, you define a global subject, or every single personalizations object has a subject.
\n\n\n\n\n

personalizations.substitutions

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The substitution values must be an object of key/value pairs, where the values are all strings.
Substitutions must always follow the pattern \"substitution_tag\": \"value to substitute\". The value to substitute for the \"substitution_tag\" must always be a string.
You are limited to 10,000 substitutions.
You may not make more than 10,000 substitutions per request. Substitutions will apply to the content of your email, in addition to the subject and reply_to parameters
\n\n\n\n\n

personalizations.to

\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
Error CodeError MessageDetails
400
The to array must at least have an email parameter with a valid email address and it may also contain a name parameter. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
Every email you send must have at least one, valid recipient email address included. However, you are not required to include a corresponding name with the recipient email address. For more information on how to use personalizations to define who you want to send your email to, please visit our Classroom.
\n\n\n\n\n

ASM Errors

\n\n\n\n\n

asm.group_id

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The ASM group ID must be an integer.
Suppression Groups, or unsubscribe groups, are a great way to record which emails your recipients want to receive. Including the asm.group_id in your request allows you to group your email with other, similar sends. However, these group IDs are always generated as integers, and so you must ensure that asm.group_id is defined as an integer. For more information please read our Unsubscribe Groups documentation.
The ASM group ID must be a valid Group ID on your account. You provided [YOUR ASM GROUP ID].
\n\n\n\n\n

asm.groups_to_display

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The ASM Group IDs to display must be an array of integers.
All ASM groups to display must be valid ASM groups IDs on your account. You provided {invalid IDs}.
There is a limit of 25 unsubscribe groups that can be displayed to a user at a time.
\n\n\n\n\n

Attachment Errors

\n\n\n\n\n

attachments.content

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The attachment content must be base64 encoded.
The attachment content must be a string at least one character in length.
\n\n\n\n\n

attachments.content_id

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The content ID of your attachment must be a string. You provided [YOUR CONTENT ID].
The content_id is a unique id that you specify for the attachment. 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. For example, <img src=\"cid:ii_139db99fdb5c3704\"></img>
The content ID of your attachment cannot contain CRLF characters.
When defining your content_id, you may not include the characters ;, ,, n, or r.
\n\n\n\n\n

attachments.disposition

\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
Error CodeError MessageDetails
400
The disposition of your attachment can be either \"inline\" or \"attachment\". You provided [YOUR DISPOSITION].
The content-disposition of your attachment defines how you would like the attachment to be displayed. For example, \"inline\" results in the attached file being displayed automatically within the message while \"attachment\" results in the attached file requiring some action to be taken before it is displayed (e.g. opening or downloading the file). attachments.disposition always defaults to \"attachment\". Can be either \"attachment\" or \"inline\".
\n\n\n\n\n

attachments.filename

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The filename of your attachment must be a string.
The filename of your attachment cannot contain CRLF characters.
When defining the filename of your attachment, you may not include the characters ;, ,, n, or r.
filename is required.
You must always include a filename for your attachment.
\n\n\n\n\n

attachments.type

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The attachment type must be a string and at least one character in length.
The type cannot contain ‘;’, or CRLF characters.
When defining the type of your attachment content, you may not include the characters ;, ,, n, or r.
\n\n\n\n\n

Batch ID Errors

\n\n\n\n\n

batch_id

\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
Error CodeError MessageDetails
400
The batch_id must be a string.
Batch IDs are always generated as strings, so when you choose to include a batch ID in your send, you must make sure that batch_id is defined as a string. For more information about batch IDs, and how you can use them to group sends together, please visit our API Reference.
\n\n\n\n\n

Categories Errors

\n\n\n\n\n

categories

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
There is a limit of 10 categories for each email that is sent. You provided X categories.
For more information on how you can use categories to organize your email analytics, please visit our User Guide.
Categories must be an array of strings.
Every object that you include within the categories array must be a string. For more information on how you can use categories to organize your email analytics, please visit our User Guide.
Each category must not be longer than 255 characters. [YOUR CATEGORY] exceeds this limit
he maximum length of a category is 255 characters. For more information on how you can use categories to organize your email analytics, please visit our User Guide.
The categories must be a unique list, and you have included [YOUR CATEGORY] more than once.
You cannot include the same category more than once within the categories array. For more information on how you can use categories to organize your email analytics, please visit our User Guide.
Categories can not contain non-ASCII characters.
Each category name must only be comprised of ASCII characters. For more information on how you can use categories to organize your email analytics, please visit our User Guide.
\n\n\n\n\n

Content Errors

\n\n\n\n\n

content

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The content param is required unless you are using a transactional template and have defined a template_ID.
You may not send an email without the content parameter unless you are using a transactional template. This is to prevent you from sending an empty email to your recipients.
There must be at least one defined content block. We typically suggest both text/plain and text/html blocks are included, but only one block is required.
You must specify at least one content type and value for every email you send. We recommend that you include both text/plain and text/html to ensure that all of your recipients are able to read your email, but you are only required to define one type of content.
\n\n\n\n\n

content.type

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
A content type is required, this tells email clients how to display the email.
You must always specify the MIME type of content you are including in your email, and if you are including the text/plain type, it must be specified first, followed by text/html, and then any other MIME types you would like to specify.
The content value must be a string at least one character in length.
You may not send an email with no content.
Your content type must be a string with length of at least one character.
The content of your email must always be contained within a string when you make your request.
Cannot contain ‘;’, or CRLF characters.
When defining the type of your content, you may not include the characters ;, ,, n, or r.
\n\n\n\n\n

content.value

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
A content value is required, this is the content of the email you are sending.
We do not allow you to send an empty email to your recipients. You must always include a value for your content.
The content value must be a string at least one character in length.
We do not allow you to send an empty email to your recipients. Even if you include the content.value parameter, it must include at least one character.
Following RFC 1341, section 7.2, if either text/html or text/plain are to be sent in your email: text/plain needs to be first, followed by text/html, followed by any other content.
The order in which you specify the MIME types of your content must always be text/plain first, if you choose to include it, followed by text/html, and then any other MIME types you wish to include.
\n\n\n\n\n

Encoding Errors

\n\n\n\n\n

Encoding

\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
Error CodeError MessageDetails
415
Invalid UTF8 in request
Your payload must be encoded in UTF-8. This includes any attachments.
\n\n\n\n\n

From Address Errors

\n\n\n\n\n

from

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The from object must at least have an email parameter with a valid email address and may also contain a name parameter. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
While every from parameter must include a valid email address, you are not required to include a name.
The from object must be provided for every email send. It is an object that requires the email parameter, but may also contain a name parameter. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
You are required to provide a from address whenever you send an email through SendGrid. This is used for authentication purposes and helps to build a positive sending reputation with your recipients' ISPs. You are not required to include a name within the from parameter.
\n\n\n\n\n

Headers Errors

\n\n\n\n\n

headers

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The header values must be strings.
The object type of every header that you include must be a string. You cannot include headers that are integers, booleans, or arrays.
The headers cannot contain duplicate keys.
You may not include the same header more than once.
Header keys cannot contain non-ASCII characters and empty spaces.
When defining the headers that you would like to use, you must make sure that the string contains only ASCII characters.
Header can not be one of the reserved keys.
Some header keys are reserved. You may not include any of the following reserved headers: x-sg-id, x-sg-eid, received, dkim-signature, Content-Type, Content-Transfer-Encoding, To, From, Subject, Reply-To, CC, BCC.
\n\n\n\n\n

IP Pool Errors

\n\n\n\n\n

ip_pool_name

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The name of your IP pool must be a string.
The IP Pool name must be a valid pool name for your account. You provided [YOUR IP POOL NAME].
\n\n\n\n\n

Reply To Errors

\n\n\n\n\n

reply_to

\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
Error CodeError MessageDetails
400
The reply_to object, when used, must at least have an email parameter with a valid email address and it may also contain a name parameter. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
For every carbon copy of your email, you must include one, valid recipient email address. However, you are not required to include a corresponding name with the recipient email address. For more information on how to use personalizations to define who you want to send your email to, please visit our Classroom.
\n\n\n\n\n

Sections Errors

\n\n\n\n\n

sections

\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
Error CodeError MessageDetails
400
The section values must be strings.
The values of your sections parameter will be substituted into the content of your email. We will only perform substitutions using strings, so please make sure that your section values are always defined as strings.
\n\n\n\n\n

Send At Errors

\n\n\n\n\n

send_at

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The send_at parameter is expecting a Unix timestamp as an integer. We will send immediately if you include a send_at timestamp that is in the past.
send_at accepts a unix timestamp representing when you want your email to be sent from SendGrid. If you want the email to be sent at the time of your API request, simply omit the send_at parameter.
Scheduling more than 72 hours in advance is forbidden.
The send_at parameter allows you to schedule your email to be sent up to 72 hours in advance, but due to our constraints, we cannot schedule emails more than 72 hours in the future. For more information on scheduling parameters, please see our API Reference.
\n\n\n\n\n

Subject Line Errors

\n\n\n\n\n

subject

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The subject of your email must be a string at least one character in length.
You are required to include a subject for every email you send, and you may not include an empty subject. The minimum length of your subject is one character.
The subject is required. You can get around this requirement if you use a template with a subject defined or if every personalization has a subject defined.
Every email must have a subject. This can be accomplished 3 ways: you include a template that has a subject, you define a global subject, or every single personalizations object has a subject.
\n\n\n\n\n

Template Errors

\n\n\n\n\n

template_id

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The template ID must be a string, you provided [YOUR TEMPLATE ID].
Template IDs are always strings.
The Template ID must be a valid template id for your account. You provided [YOUR TEMPLATE ID].
We do not allow you to send an empty email, so in the event that the only content of your email is contained within your template, we want to make sure that the included template exists, and is valid.
Must be a valid template.
We do not allow you to send an empty email, so in the event that the only content of your email is contained within your template, we want to make sure that the included template exists, and is valid.
\n\n\n\n\n

Mail Settings Errors

\n\n\n\n\n

mail_settings.bcc.email

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The bcc email recipient object must at least have an email address and may also contain a name. e.g. {\"email\": \"example@example.com\"} or {\"email\": \"example@example.com\", \"name\": \"Example Recipient\"}
You must include a recipient object when using the bcc mail setting.
\n\n\n\n\n

mail_settings.bcc.enable

\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
Error CodeError MessageDetails
400
The bcc enable param should be a boolean value.
\n\n\n\n\n

mail_settings.bypass_list_management.enable

\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
Error CodeError MessageDetails
400
The bypass list management enable param should be a boolean value.
\n\n\n\n\n

mail_settings.footer.enable

\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
Error CodeError MessageDetails
400
The footer enable param should be a boolean value.
\n\n\n\n\n

mail_settings.footer.html

\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
Error CodeError MessageDetails
400
The text/html version of your footer should be a string.
\n\n\n\n\n

mail_settings.footer.text

\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
Error CodeError MessageDetails
400
The text/plain version of your footer should be a string.
\n\n\n\n\n

mail_settings.sandbox_mode.enable

\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
Error CodeError MessageDetails
400
The sandbox mode enable param should be a boolean value.
\n\n\n\n\n

mail_settings.spam_check.enable

\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
Error CodeError MessageDetails
400
The spam check enable param should be a boolean value.
\n\n\n\n\n

mail_settings.spam_check.post_to_url

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The spam check url must be a string.
You must include the url to post to when using the spam check mail setting.
The `post_to_url` parameter must start with `http://` or `https://`.
\n\n\n\n\n

mail_settings.spam_check.threshold

\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n\n \n\n\n \n \n \n\n\n \n \n\n\n\n \n \n \n\n\n \n \n\n\n\n \n
Error CodeError MessageDetails
400
The spam check threshold is between 1 and 10, with the lower numbers being the most strict filtering.
You must include the spam check threshold when using the spam check mail setting.
\n\n\n\n\n

Tracking Settings Errors

\n\n\n\n\n

tracking_settings.click_tracking.enable

\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
Error CodeError MessageDetails
400
The click tracking enable param should be a boolean value.
\n\n\n\n\n

tracking_settings.click_tracking.enable_text

\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
Error CodeError MessageDetails
400
The click tracking enable text must be a boolean value.
\n\n\n\n\n

tracking_settings.ganalytics.enable

\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
Error CodeError MessageDetails
400
The Google Analytics enable param must be a boolean value.
\n\n\n\n\n

tracking_settings.ganalytics.utm_campaign

\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
Error CodeError MessageDetails
400
The Google Analytics utm_campaign must be a string value.
\n\n\n\n\n

tracking_settings.ganalytics.utm_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
Error CodeError MessageDetails
400
The Google Analytics utm_content must be a string value.
\n\n\n\n\n

tracking_settings.ganalytics.utm_medium

\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
Error CodeError MessageDetails
400
The Google Analytics utm_medium must be a string value.
\n\n\n\n\n

tracking_settings.ganalytics.utm_source

\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
Error CodeError MessageDetails
400
The Google Analytics utm_source must be a string value.
\n\n\n\n\n

tracking_settings.ganalytics.utm_term

\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
Error CodeError MessageDetails
400
The Google Analytics utm_term must be a string value.
\n\n\n\n\n

tracking_settings.open_tracking.enable

\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
Error CodeError MessageDetails
400
The open tracking enable param should be a boolean value.
\n\n\n\n\n

tracking_settings.open_tracking.substitution_tag

\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
Error CodeError MessageDetails
400
The open tracking substitution tag must be a string.
\n\n\n\n\n

tracking_settings.subscription_tracking.enable

\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
Error CodeError MessageDetails
400
The subscription tracking enable param should be a boolean value.
\n\n\n\n\n

tracking_settings.subscription_tracking.html

\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
Error CodeError MessageDetails
400
The subscription tracking unsubscribe content for text/html messages must be a string.
\n\n\n\n\n

tracking_settings.subscription_tracking.substitution_tag

\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
Error CodeError MessageDetails
400
The subscription tracking substitution tag must be a string value.
\n\n\n\n\n

tracking_settings.subscription_tracking.text

\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
Error CodeError MessageDetails
400
The subscription tracking unsubscribe content for text/plain messages must be a string.
\n\n\n\n\n\n ", + "public": true + }, + "api-key-permissions": { + "id": "api-key-permissions", + "name": "API Key Permissions", + "content": "API Keys can be used to authenticate the use of SendGrid’s v3 API, or the [Mail API endpoint](#v3-mail-send). API Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access. For a more detailed explanation of how you can use API Key permissions, please visit our [Classroom](https://sendgrid.com/docs/Classroom/Basics/API/api_key_permissions.html). \n\nThe following is a complete list of all possible permissions that you may assign to an API Key.\n\n* [Admin API Key Permissions](#Admin-API-Key-Permissions)\n* [Alerts](#Alerts)\n* [API Keys](#API-Keys)\n* [ASM Groups](#ASM-Groups)\n* [Billing](#Billing)\n* [Categories](#Categories)\n* [Clients](#Clients)\n* [Credentials](#Credentials)\n* [IPs](#IPs)\n* [Mail Settings](#Mail-Settings)\n* [Mail](#Mail)\n* [Marketing Campaigns](#Marketing-Campaigns)\n* [Partner Settings](#Partner-Settings)\n* [Scheduled Sends](#Scheduled-Sends)\n* [Stats](#Stats)\n* [Subusers](#Subusers)\n* [Suppressions](#Suppressions)\n* [Teammates](#Teammates)\n* [Templates](#Templates)\n* [Tracking](#Tracking)\n* [User Settings](#User-Settings)\n* [Webhook](#Webhook)\n* [Whitelabel](#Whitelabel)\n* [Whitelist](#Whitelist)\n\n

\n \n Admin API Key Permissions\n \n

\n\nBelow is a complete list of every API Key permission that should be given to an admin level API Key.\n\n```json\n\"scopes\": [\n \"access_settings.activity.read\",\n \"access_settings.whitelist.create\",\n \"access_settings.whitelist.delete\",\n \"access_settings.whitelist.read\",\n \"access_settings.whitelist.update\",\n \"alerts.create\",\n \"alerts.delete\",\n \"alerts.read\",\n \"alerts.update\",\n \"api_keys.create\",\n \"api_keys.delete\",\n \"api_keys.read\",\n \"api_keys.update\",\n \"asm.groups.create\",\n \"asm.groups.delete\",\n \"asm.groups.read\",\n \"asm.groups.update\",\n \"billing.create\",\n \"billing.delete\",\n \"billing.read\",\n \"billing.update\",\n \"browsers.stats.read\",\n \"categories.create\",\n \"categories.delete\",\n \"categories.read\",\n \"categories.stats.read\",\n \"categories.stats.sums.read\",\n \"categories.update\",\n \"clients.desktop.stats.read\",\n \"clients.phone.stats.read\",\n \"clients.stats.read\",\n \"clients.tablet.stats.read\",\n \"clients.webmail.stats.read\",\n \"credentials.create\",\n \"credentials.delete\",\n \"credentials.read\",\n \"credentials.update\",\n \"devices.stats.read\",\n \"email_activity.read\",\n \"geo.stats.read\",\n \"ips.assigned.read\",\n \"ips.pools.create\",\n \"ips.pools.delete\",\n \"ips.pools.ips.create\",\n \"ips.pools.ips.delete\",\n \"ips.pools.ips.read\",\n \"ips.pools.ips.update\",\n \"ips.pools.read\",\n \"ips.pools.update\",\n \"ips.read\",\n \"ips.warmup.create\",\n \"ips.warmup.delete\",\n \"ips.warmup.read\",\n \"ips.warmup.update\",\n \"mail_settings.address_whitelist.read\",\n \"mail_settings.address_whitelist.update\",\n \"mail_settings.bcc.read\",\n \"mail_settings.bcc.update\",\n \"mail_settings.bounce_purge.read\",\n \"mail_settings.bounce_purge.update\",\n \"mail_settings.footer.read\",\n \"mail_settings.footer.update\",\n \"mail_settings.forward_bounce.read\",\n \"mail_settings.forward_bounce.update\",\n \"mail_settings.forward_spam.read\",\n \"mail_settings.forward_spam.update\",\n \"mail_settings.plain_content.read\",\n \"mail_settings.plain_content.update\",\n \"mail_settings.read\",\n \"mail_settings.spam_check.read\",\n \"mail_settings.spam_check.update\",\n \"mail_settings.template.read\",\n \"mail_settings.template.update\",\n \"mail.batch.create\",\n \"mail.batch.delete\",\n \"mail.batch.read\",\n \"mail.batch.update\",\n \"mail.send\",\n \"mailbox_providers.stats.read\",\n \"marketing_campaigns.create\",\n \"marketing_campaigns.delete\",\n \"marketing_campaigns.read\",\n \"marketing_campaigns.update\",\n \"newsletter.create\",\n \"newsletter.delete\",\n \"newsletter.read\",\n \"newsletter.update\",\n \"partner_settings.new_relic.read\",\n \"partner_settings.new_relic.update\",\n \"partner_settings.read\",\n \"partner_settings.sendwithus.read\",\n \"partner_settings.sendwithus.update\",\n \"stats.global.read\",\n \"stats.read\",\n \"subusers.create\",\n \"subusers.credits.create\",\n \"subusers.credits.delete\",\n \"subusers.credits.read\",\n \"subusers.credits.remaining.create\",\n \"subusers.credits.remaining.delete\",\n \"subusers.credits.remaining.read\",\n \"subusers.credits.remaining.update\",\n \"subusers.credits.update\",\n \"subusers.delete\",\n \"subusers.monitor.create\",\n \"subusers.monitor.delete\",\n \"subusers.monitor.read\",\n \"subusers.monitor.update\",\n \"subusers.read\",\n \"subusers.reputations.read\",\n \"subusers.stats.monthly.read\",\n \"subusers.stats.read\",\n \"subusers.stats.sums.read\",\n \"subusers.summary.read\",\n \"subusers.update\",\n \"suppression.blocks.create\",\n \"suppression.blocks.delete\",\n \"suppression.blocks.read\",\n \"suppression.blocks.update\",\n \"suppression.bounces.create\",\n \"suppression.bounces.delete\",\n \"suppression.bounces.read\",\n \"suppression.bounces.update\",\n \"suppression.create\",\n \"suppression.delete\",\n \"suppression.invalid_emails.create\",\n \"suppression.invalid_emails.delete\",\n \"suppression.invalid_emails.read\",\n \"suppression.invalid_emails.update\",\n \"suppression.read\",\n \"suppression.spam_reports.create\",\n \"suppression.spam_reports.delete\",\n \"suppression.spam_reports.read\",\n \"suppression.spam_reports.update\",\n \"suppression.unsubscribes.create\",\n \"suppression.unsubscribes.delete\",\n \"suppression.unsubscribes.read\",\n \"suppression.unsubscribes.update\",\n \"suppression.update\",\n \"templates.create\",\n \"templates.delete\",\n \"templates.read\",\n \"templates.update\",\n \"templates.versions.activate.create\",\n \"templates.versions.activate.delete\",\n \"templates.versions.activate.read\",\n \"templates.versions.activate.update\",\n \"templates.versions.create\",\n \"templates.versions.delete\",\n \"templates.versions.read\",\n \"templates.versions.update\",\n \"tracking_settings.click.read\",\n \"tracking_settings.click.update\",\n \"tracking_settings.google_analytics.read\",\n \"tracking_settings.google_analytics.update\",\n \"tracking_settings.open.read\",\n \"tracking_settings.open.update\",\n \"tracking_settings.read\",\n \"tracking_settings.subscription.read\",\n \"tracking_settings.subscription.update\",\n \"user.account.read\",\n \"user.credits.read\",\n \"user.email.create\",\n \"user.email.delete\",\n \"user.email.read\",\n \"user.email.update\",\n \"user.multifactor_authentication.create\",\n \"user.multifactor_authentication.delete\",\n \"user.multifactor_authentication.read\",\n \"user.multifactor_authentication.update\",\n \"user.password.read\",\n \"user.password.update\",\n \"user.profile.read\",\n \"user.profile.update\",\n \"user.scheduled_sends.create\",\n \"user.scheduled_sends.delete\",\n \"user.scheduled_sends.read\",\n \"user.scheduled_sends.update\",\n \"user.settings.enforced_tls.read\",\n \"user.settings.enforced_tls.update\",\n \"user.timezone.read\",\n \"user.username.read\",\n \"user.username.update\",\n \"user.webhooks.event.settings.read\",\n \"user.webhooks.event.settings.update\",\n \"user.webhooks.event.test.create\",\n \"user.webhooks.event.test.read\",\n \"user.webhooks.event.test.update\",\n \"user.webhooks.parse.settings.create\",\n \"user.webhooks.parse.settings.delete\",\n \"user.webhooks.parse.settings.read\",\n \"user.webhooks.parse.settings.update\",\n \"user.webhooks.parse.stats.read\",\n \"whitelabel.create\",\n \"whitelabel.delete\",\n \"whitelabel.read\",\n \"whitelabel.update\"\n]\n```\n\n

\n \n Alerts\n \n

\n\n```json\n\"scopes\": [\n \"alerts.create\",\n \"alerts.delete\",\n \"alerts.read\",\n \"alerts.update\"\n]\n```\n\n

\n \n API Keys\n \n

\n\n```json\n\"scopes\": [\n \"api_keys.create\",\n \"api_keys.delete\",\n \"api_keys.read\",\n \"api_keys.update\"\n]\n```\n\n

\n \n ASM Groups\n \n

\n\n```json\n\"scopes\": [\n \"asm.groups.create\",\n \"asm.groups.delete\",\n \"asm.groups.read\",\n \"asm.groups.update\"\n]\n```\n\n

\n \n Billing\n \n

\n\n**As explained in the [Classroom](https://sendgrid.com/docs/Classroom/Basics/API/api_key_permissions.html), Billing permissions are mutually exclusive from all other permissions. An API key can _either_ Billing permissions, or any other set of permissions, but not _both_.**\n\n```json\n\"scopes\": [\n \"billing.create\",\n \"billing.delete\",\n \"billing.read\",\n \"billing.update\"\n]\n```\n\n

\n \n Categories\n \n

\n\n```json\n\"scopes\": [\n \"categories.create\",\n \"categories.delete\",\n \"categories.read\",\n \"categories.update\",\n \"categories.stats.read\",\n \"categories.stats.sums.read\"\n]\n```\n\n

\n \n Clients\n \n

\n\n```json\n\"scopes\": [\n \"clients.desktop.stats.read\",\n \"clients.phone.stats.read\",\n \"clients.stats.read\",\n \"clients.tablet.stats.read\",\n \"clients.webmail.stats.read\"\n]\n```\n\n\n

\n \n Credentials\n \n

\n\n```json\n\"scopes\": [\n \"credentials.create\",\n \"credentials.delete\",\n \"credentials.read\",\n \"credentials.update\"\n]\n```\n\n

\n \n IPs\n \n

\n\n```json\n\"scopes\": [\n \"ips.assigned.read\",\n \"ips.read\",\n \"ips.pools.create\",\n \"ips.pools.delete\",\n \"ips.pools.read\",\n \"ips.pools.update\",\n \"ips.pools.ips.create\",\n \"ips.pools.ips.delete\",\n \"ips.pools.ips.read\",\n \"ips.pools.ips.update\",\n \"ips.warmup.create\",\n \"ips.warmup.delete\",\n \"ips.warmup.read\",\n \"ips.warmup.update\"\n]\n```\n\n

\n \n Mail Settings\n \n

\n\n```json\n\"scopes\": [\n \"mail_settings.address_whitelist.read\",\n \"mail_settings.address_whitelist.update\",\n \"mail_settings.bcc.read\",\n \"mail_settings.bcc.update\",\n \"mail_settings.bounce_purge.read\",\n \"mail_settings.bounce_purge.update\",\n \"mail_settings.footer.read\",\n \"mail_settings.footer.update\",\n \"mail_settings.forward_bounce.read\",\n \"mail_settings.forward_bounce.update\",\n \"mail_settings.forward_spam.read\",\n \"mail_settings.forward_spam.update\",\n \"mail_settings.plain_content.read\",\n \"mail_settings.plain_content.update\",\n \"mail_settings.read\",\n \"mail_settings.spam_check.read\",\n \"mail_settings.spam_check.update\",\n \"mail_settings.template.read\",\n \"mail_settings.template.update\"\n]\n```\n\n

\n \n Mail\n \n

\n\n```json\n\"scopes\": [\n \"mail.batch.create\",\n \"mail.batch.delete\",\n \"mail.batch.read\",\n \"mail.batch.update\",\n \"mail.send\"\n]\n```\n\n

\n \n Marketing Campaigns\n \n

\n\n```json\n\"scopes\": [\n \"marketing_campaigns.create\",\n \"marketing_campaigns.delete\",\n \"marketing_campaigns.read\",\n \"marketing_campaigns.update\"\n]\n```\n\n

\n \n Newsletter\n \n

\n\n```json\n\"scopes\": [\n \"newsletter.create\",\n \"newsletter.delete\",\n \"newsletter.read\",\n \"newsletter.update\"\n]\n```\n\n

\n \n Partner-Settings\n \n

\n\n```json\n\"scopes\": [\n \"partner_settings.new_relic.read\",\n \"partner_settings.new_relic.update\",\n \"partner_settings.read\",\n \"partner_settings.sendwithus.read\",\n \"partner_settings.sendwithus.update\"\n]\n```\n\n

\n \n Scheduled Sends\n \n

\n\n```json\n\"scopes\": [\n \"user.scheduled_sends.create\",\n \"user.scheduled_sends.delete\",\n \"user.scheduled_sends.read\",\n \"user.scheduled_sends.update\"\n]\n```\n\n

\n \n Stats\n \n

\n\n```json\n\"scopes\": [\n \"email_activity.read\",\n \"stats.read\",\n \"stats.global.read\",\n \"browsers.stats.read\",\n \"devices.stats.read\",\n \"geo.stats.read\",\n \"mailbox_providers.stats.read\",\n \"clients.desktop.stats.read\",\n \"clients.phone.stats.read\",\n \"clients.stats.read\",\n \"clients.tablet.stats.read\",\n \"clients.webmail.stats.read\"\n]\n```\n\n

\n \n Subusers\n \n

\n\n```json\n\"scopes\": [\n \"subusers.create\",\n \"subusers.delete\",\n \"subusers.read\",\n \"subusers.update\",\n \"subusers.credits.create\",\n \"subusers.credits.delete\",\n \"subusers.credits.read\",\n \"subusers.credits.update\",\n \"subusers.credits.remaining.create\",\n \"subusers.credits.remaining.delete\",\n \"subusers.credits.remaining.read\",\n \"subusers.credits.remaining.update\",\n \"subusers.monitor.create\",\n \"subusers.monitor.delete\",\n \"subusers.monitor.read\",\n \"subusers.monitor.update\",\n \"subusers.reputations.read\",\n \"subusers.stats.read\",\n \"subusers.stats.monthly.read\",\n \"subusers.stats.sums.read\"\n \"subusers.summary.read\"\n]\n```\n\n

\n \n Suppressions\n \n

\n\n```json\n\"scopes\": [\n \"suppression.create\",\n \"suppression.delete\",\n \"suppression.read\",\n \"suppression.update\",\n \"suppression.bounces.create\",\n \"suppression.bounces.read\",\n \"suppression.bounces.update\",\n \"suppression.bounces.delete\",\n \"suppression.blocks.create\",\n \"suppression.blocks.read\",\n \"suppression.blocks.update\",\n \"suppression.blocks.delete\",\n \"suppression.invalid_emails.create\",\n \"suppression.invalid_emails.read\",\n \"suppression.invalid_emails.update\",\n \"suppression.invalid_emails.delete\",\n \"suppression.spam_reports.create\",\n \"suppression.spam_reports.read\",\n \"suppression.spam_reports.update\",\n \"suppression.spam_reports.delete\",\n \"suppression.unsubscribes.create\",\n \"suppression.unsubscribes.read\",\n \"suppression.unsubscribes.update\",\n \"suppression.unsubscribes.delete\"\n]\n```\n

\n \n Teammates\n \n

\n\n```json\n\"scopes\": [\n \"teammates.create\",\n \"teammates.read\",\n \"teammates.update\",\n \"teammates.delete\"\n]\n```\n

\n \n Templates\n \n

\n\n```json\n\"scopes\": [\n \"templates.create\",\n \"templates.delete\",\n \"templates.read\",\n \"templates.update\",\n \"templates.versions.activate.create\",\n \"templates.versions.activate.delete\",\n \"templates.versions.activate.read\",\n \"templates.versions.activate.update\",\n \"templates.versions.create\",\n \"templates.versions.delete\",\n \"templates.versions.read\",\n \"templates.versions.update\"\n]\n```\n\n

\n \n Tracking\n \n

\n\n```json\n\"scopes\": [\n \"tracking_settings.click.read\",\n \"tracking_settings.click.update\",\n \"tracking_settings.google_analytics.read\",\n \"tracking_settings.google_analytics.update\",\n \"tracking_settings.open.read\",\n \"tracking_settings.open.update\",\n \"tracking_settings.read\",\n \"tracking_settings.subscription.read\",\n \"tracking_settings.subscription.update\"\n]\n```\n\n

\n \n User Settings\n \n

\n\n```json\n\"scopes\": [\n \"user.account.read\",\n \"user.credits.read\",\n \"user.email.create\",\n \"user.email.delete\",\n \"user.email.read\",\n \"user.email.update\",\n \"user.multifactor_authentication.create\",\n \"user.multifactor_authentication.delete\",\n \"user.multifactor_authentication.read\",\n \"user.multifactor_authentication.update\",\n \"user.password.read\",\n \"user.password.update\",\n \"user.profile.read\",\n \"user.profile.update\",\n \"user.settings.enforced_tls.read\",\n \"user.settings.enforced_tls.update\",\n \"user.timezone.read\",\n \"user.timezone.update\",\n \"user.username.read\",\n \"user.username.update\"\n]\n```\n\n\n

\n \n Webhook\n \n

\n\n```json\n\"scopes\": [\n \"user.webhooks.event.settings.read\",\n \"user.webhooks.event.settings.update\",\n \"user.webhooks.event.test.create\",\n \"user.webhooks.event.test.read\",\n \"user.webhooks.event.test.update\",\n \"user.webhooks.parse.settings.create\",\n \"user.webhooks.parse.settings.delete\",\n \"user.webhooks.parse.settings.read\",\n \"user.webhooks.parse.settings.update\",\n \"user.webhooks.parse.stats.read\"\n]\n```\n\n

\n \n Whitelabel\n \n

\n\n```json\n\"scopes\": [\n \"whitelabel.create\",\n \"whitelabel.delete\",\n \"whitelabel.read\",\n \"whitelabel.update\"\n]\n```\n\n

\n \n Whitelist\n \n

\n\n```json\n\"scopes\": [\n \"access_settings.activity.read\",\n \"access_settings.whitelist.create\",\n \"access_settings.whitelist.delete\",\n \"access_settings.whitelist.read\",\n \"access_settings.whitelist.update\"\n]\n```", + "public": true + }, + "api-authorization": { + "id": "api-authorization", + "name": "Authorization", + "content": "# API Key Permissions List\n\n[API Keys](https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html) can be used to authenticate the use of SendGrid’s v3 Web API, or the [Mail API endpoint](https://sendgrid.com/docs/API_Reference/api_v3.html). API Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access. For a more detailed explanation of how you can use API Key permissions, please visit our [Classroom](https://sendgrid.com/docs/Classroom/Basics/API/api_key_permissions.html). \n\nThe following is a complete list of all possible permissions that you may assign to an API Key.\n\n## Table of Contents\n\n\n\n\n\n\n\n\n\n\n
AlertsMail SettingsTeammates
API KeysMailTemplates
ASM GroupsMarketing CampaignsSuppressions
BillingPartner SettingsTracking
CategoriesScheduled SendsUser Settings
StatsWebhookIPs
SubusersWhitelabelWhitelist
Admin API Key Scopes
\n\n\n

Alerts

\n\n```json\n\"scopes\": [\n \"alerts.create\",\n \"alerts.delete\",\n \"alerts.read\",\n \"alerts.update\"\n]\n```\n\n

API Keys

\n\n```json\n\"scopes\": [\n \"api_keys.create\",\n \"api_keys.delete\",\n \"api_keys.read\",\n \"api_keys.update\"\n]\n```\n\n

ASM Groups

\n\n```json\n\"scopes\": [\n \"asm.groups.create\",\n \"asm.groups.delete\",\n \"asm.groups.read\",\n \"asm.groups.update\"\n]\n```\n\n\n

Billing

\n\n```json\n\"scopes\": [\n \"billing.create\",\n \"billing.delete\",\n \"billing.read\",\n \"billing.update\"\n]\n```\n\n\n**As explained in the Classroom, Billing permissions are mutually exclusive from all others. An API Key can *either* have Billing Permissions, or any other set of Permissions.**\n\n\n

Categories

\n\n```json\n\"scopes\": [\n \"categories.create\",\n \"categories.delete\",\n \"categories.read\",\n \"categories.update\",\n \"categories.stats.read\",\n \"categories.stats.sums.read\"\n]\n```\n\n

Stats

\n\n```json\n\"scopes\": [\n \"email_activity.read\",\n \"stats.read\",\n \"stats.global.read\",\n \"browsers.stats.read\",\n \"devices.stats.read\",\n \"geo.stats.read\",\n \"mailbox_providers.stats.read\",\n \"clients.desktop.stats.read\",\n \"clients.phone.stats.read\",\n \"clients.stats.read\",\n \"clients.tablet.stats.read\",\n \"clients.webmail.stats.read\"\n]\n```\n\n

IPs

\n\n```json\n\"scopes\": [\n \"ips.assigned.read\",\n \"ips.read\",\n \"ips.pools.create\",\n \"ips.pools.delete\",\n \"ips.pools.read\",\n \"ips.pools.update\",\n \"ips.pools.ips.create\",\n \"ips.pools.ips.delete\",\n \"ips.pools.ips.read\",\n \"ips.pools.ips.update\",\n \"ips.warmup.create\",\n \"ips.warmup.delete\",\n \"ips.warmup.read\",\n \"ips.warmup.update\"\n]\n```\n\n

Mail Settings

\n\n```json\n\"scopes\": [\n \"mail_settings.address_whitelist.read\",\n \"mail_settings.address_whitelist.update\",\n \"mail_settings.bcc.read\",\n \"mail_settings.bcc.update\",\n \"mail_settings.bounce_purge.read\",\n \"mail_settings.bounce_purge.update\",\n \"mail_settings.footer.read\",\n \"mail_settings.footer.update\",\n \"mail_settings.forward_bounce.read\",\n \"mail_settings.forward_bounce.update\",\n \"mail_settings.forward_spam.read\",\n \"mail_settings.forward_spam.update\",\n \"mail_settings.plain_content.read\",\n \"mail_settings.plain_content.update\",\n \"mail_settings.read\",\n \"mail_settings.spam_check.read\",\n \"mail_settings.spam_check.update\",\n \"mail_settings.template.read\",\n \"mail_settings.template.update\"\n]\n```\n\n

Mail

\n\n```json\n\"scopes\": [\n \"mail.batch.create\",\n \"mail.batch.delete\",\n \"mail.batch.read\",\n \"mail.batch.update\",\n \"mail.send\"\n]\n```\n\n

Marketing Campaigns

\n\n```json\n\"scopes\": [\n \"marketing_campaigns.create\",\n \"marketing_campaigns.delete\",\n \"marketing_campaigns.read\",\n \"marketing_campaigns.update\"\n]\n```\n\n

Newsletter

\n\n```json\n\"scopes\": [\n \"newsletter.create\",\n \"newsletter.delete\",\n \"newsletter.read\",\n \"newsletter.update\"\n]\n```\n\n

Partner Settings

\n\n```json\n\"scopes\": [\n \"partner_settings.new_relic.read\",\n \"partner_settings.new_relic.update\",\n \"partner_settings.read\",\n \"partner_settings.sendwithus.read\",\n \"partner_settings.sendwithus.update\"\n]\n```\n\n

Scheduled Sends

\n\n```json\n\"scopes\": [\n \"user.scheduled_sends.create\",\n \"user.scheduled_sends.delete\",\n \"user.scheduled_sends.read\",\n \"user.scheduled_sends.update\"\n]\n```\n\n

Subusers

\n\n```json\n\"scopes\": [\n \"subusers.create\",\n \"subusers.delete\",\n \"subusers.read\",\n \"subusers.update\",\n \"subusers.credits.create\",\n \"subusers.credits.delete\",\n \"subusers.credits.read\",\n \"subusers.credits.update\",\n \"subusers.credits.remaining.create\",\n \"subusers.credits.remaining.delete\",\n \"subusers.credits.remaining.read\",\n \"subusers.credits.remaining.update\",\n \"subusers.monitor.create\",\n \"subusers.monitor.delete\",\n \"subusers.monitor.read\",\n \"subusers.monitor.update\",\n \"subusers.reputations.read\",\n \"subusers.stats.read\",\n \"subusers.stats.monthly.read\",\n \"subusers.stats.sums.read\"\n \"subusers.summary.read\"\n]\n```\n\n

Suppressions

\n\n```json\n\"scopes\": [\n \"suppression.create\",\n \"suppression.delete\",\n \"suppression.read\",\n \"suppression.update\",\n \"suppression.bounces.create\",\n \"suppression.bounces.read\",\n \"suppression.bounces.update\",\n \"suppression.bounces.delete\",\n \"suppression.blocks.create\",\n \"suppression.blocks.read\",\n \"suppression.blocks.update\",\n \"suppression.blocks.delete\",\n \"suppression.invalid_emails.create\",\n \"suppression.invalid_emails.read\",\n \"suppression.invalid_emails.update\",\n \"suppression.invalid_emails.delete\",\n \"suppression.spam_reports.create\",\n \"suppression.spam_reports.read\",\n \"suppression.spam_reports.update\",\n \"suppression.spam_reports.delete\",\n \"suppression.unsubscribes.create\",\n \"suppression.unsubscribes.read\",\n \"suppression.unsubscribes.update\",\n \"suppression.unsubscribes.delete\"\n]\n```\n\n

Teammates

\n\n```json\n\"scopes\": [\n \"teammates.create\",\n \"teammates.read\",\n \"teammates.update\",\n \"teammates.delete\"\n]\n```\n\n

Templates

\n\n```json\n\"scopes\": [\n \"templates.create\",\n \"templates.delete\",\n \"templates.read\",\n \"templates.update\",\n \"templates.versions.activate.create\",\n \"templates.versions.activate.delete\",\n \"templates.versions.activate.read\",\n \"templates.versions.activate.update\",\n \"templates.versions.create\",\n \"templates.versions.delete\",\n \"templates.versions.read\",\n \"templates.versions.update\"\n]\n```\n\n

Tracking

\n\n```json\n\"scopes\": [\n \"tracking_settings.click.read\",\n \"tracking_settings.click.update\",\n \"tracking_settings.google_analytics.read\",\n \"tracking_settings.google_analytics.update\",\n \"tracking_settings.open.read\",\n \"tracking_settings.open.update\",\n \"tracking_settings.read\",\n \"tracking_settings.subscription.read\",\n \"tracking_settings.subscription.update\"\n]\n```\n\n

User Settings

\n\n```json\n\"scopes\": [\n \"user.account.read\",\n \"user.credits.read\",\n \"user.email.create\",\n \"user.email.delete\",\n \"user.email.read\",\n \"user.email.update\",\n \"user.multifactor_authentication.create\",\n \"user.multifactor_authentication.delete\",\n \"user.multifactor_authentication.read\",\n \"user.multifactor_authentication.update\",\n \"user.password.read\",\n \"user.password.update\",\n \"user.profile.read\",\n \"user.profile.update\",\n \"user.settings.enforced_tls.read\",\n \"user.settings.enforced_tls.update\",\n \"user.timezone.read\",\n \"user.timezone.update\",\n \"user.username.read\",\n \"user.username.update\"\n]\n```\n\n

Webhook

\n\n```json\n\"scopes\": [\n \"user.webhooks.event.settings.read\",\n \"user.webhooks.event.settings.update\",\n \"user.webhooks.event.test.create\",\n \"user.webhooks.event.test.read\",\n \"user.webhooks.event.test.update\",\n \"user.webhooks.parse.settings.create\",\n \"user.webhooks.parse.settings.delete\",\n \"user.webhooks.parse.settings.read\",\n \"user.webhooks.parse.settings.update\",\n \"user.webhooks.parse.stats.read\"\n]\n```\n\n

Whitelabel

\n\n```json\n\"scopes\": [\n \"whitelabel.create\",\n \"whitelabel.delete\",\n \"whitelabel.read\",\n \"whitelabel.update\"\n]\n```\n\n

Whitelist

\n\n```json\n\"scopes\": [\n \"access_settings.activity.read\",\n \"access_settings.whitelist.create\",\n \"access_settings.whitelist.delete\",\n \"access_settings.whitelist.read\",\n \"access_settings.whitelist.update\"\n]\n```\n\n

Admin API Key Scopes

\n\nBelow is a complete list of every API Key scope to be given to an admin level API Key.\n\n```json\n\"scopes\": [\n \"access_settings.activity.read\",\n \"access_settings.whitelist.create\",\n \"access_settings.whitelist.delete\",\n \"access_settings.whitelist.read\",\n \"access_settings.whitelist.update\",\n \"alerts.create\",\n \"alerts.delete\",\n \"alerts.read\",\n \"alerts.update\",\n \"api_keys.create\",\n \"api_keys.delete\",\n \"api_keys.read\",\n \"api_keys.update\",\n \"asm.groups.create\",\n \"asm.groups.delete\",\n \"asm.groups.read\",\n \"asm.groups.update\",\n \"billing.create\",\n \"billing.delete\",\n \"billing.read\",\n \"billing.update\",\n \"browsers.stats.read\",\n \"categories.create\",\n \"categories.delete\",\n \"categories.read\",\n \"categories.stats.read\",\n \"categories.stats.sums.read\",\n \"categories.update\",\n \"clients.desktop.stats.read\",\n \"clients.phone.stats.read\",\n \"clients.stats.read\",\n \"clients.tablet.stats.read\",\n \"clients.webmail.stats.read\",\n \"devices.stats.read\",\n \"email_activity.read\",\n \"geo.stats.read\",\n \"ips.assigned.read\",\n \"ips.pools.create\",\n \"ips.pools.delete\",\n \"ips.pools.ips.create\",\n \"ips.pools.ips.delete\",\n \"ips.pools.ips.read\",\n \"ips.pools.ips.update\",\n \"ips.pools.read\",\n \"ips.pools.update\",\n \"ips.read\",\n \"ips.warmup.create\",\n \"ips.warmup.delete\",\n \"ips.warmup.read\",\n \"ips.warmup.update\",\n \"mail_settings.address_whitelist.read\",\n \"mail_settings.address_whitelist.update\",\n \"mail_settings.bcc.read\",\n \"mail_settings.bcc.update\",\n \"mail_settings.bounce_purge.read\",\n \"mail_settings.bounce_purge.update\",\n \"mail_settings.footer.read\",\n \"mail_settings.footer.update\",\n \"mail_settings.forward_bounce.read\",\n \"mail_settings.forward_bounce.update\",\n \"mail_settings.forward_spam.read\",\n \"mail_settings.forward_spam.update\",\n \"mail_settings.plain_content.read\",\n \"mail_settings.plain_content.update\",\n \"mail_settings.read\",\n \"mail_settings.spam_check.read\",\n \"mail_settings.spam_check.update\",\n \"mail_settings.template.read\",\n \"mail_settings.template.update\",\n \"mail.batch.create\",\n \"mail.batch.delete\",\n \"mail.batch.read\",\n \"mail.batch.update\",\n \"mail.send\",\n \"mailbox_providers.stats.read\",\n \"marketing_campaigns.create\",\n \"marketing_campaigns.delete\",\n \"marketing_campaigns.read\",\n \"marketing_campaigns.update\",\n \"newsletter.create\",\n \"newsletter.delete\",\n \"newsletter.read\",\n \"newsletter.update\",\n \"partner_settings.new_relic.read\",\n \"partner_settings.new_relic.update\",\n \"partner_settings.read\",\n \"partner_settings.sendwithus.read\",\n \"partner_settings.sendwithus.update\",\n \"stats.global.read\",\n \"stats.read\",\n \"subusers.create\",\n \"subusers.credits.create\",\n \"subusers.credits.delete\",\n \"subusers.credits.read\",\n \"subusers.credits.remaining.create\",\n \"subusers.credits.remaining.delete\",\n \"subusers.credits.remaining.read\",\n \"subusers.credits.remaining.update\",\n \"subusers.credits.update\",\n \"subusers.delete\",\n \"subusers.monitor.create\",\n \"subusers.monitor.delete\",\n \"subusers.monitor.read\",\n \"subusers.monitor.update\",\n \"subusers.read\",\n \"subusers.reputations.read\",\n \"subusers.stats.monthly.read\",\n \"subusers.stats.read\",\n \"subusers.stats.sums.read\",\n \"subusers.summary.read\",\n \"subusers.update\",\n \"suppression.blocks.create\",\n \"suppression.blocks.delete\",\n \"suppression.blocks.read\",\n \"suppression.blocks.update\",\n \"suppression.bounces.create\",\n \"suppression.bounces.delete\",\n \"suppression.bounces.read\",\n \"suppression.bounces.update\",\n \"suppression.create\",\n \"suppression.delete\",\n \"suppression.invalid_emails.create\",\n \"suppression.invalid_emails.delete\",\n \"suppression.invalid_emails.read\",\n \"suppression.invalid_emails.update\",\n \"suppression.read\",\n \"suppression.spam_reports.create\",\n \"suppression.spam_reports.delete\",\n \"suppression.spam_reports.read\",\n \"suppression.spam_reports.update\",\n \"suppression.unsubscribes.create\",\n \"suppression.unsubscribes.delete\",\n \"suppression.unsubscribes.read\",\n \"suppression.unsubscribes.update\",\n \"suppression.update\",\n \"teammates.create\",\n \"teammates.read\",\n \"teammates.update\",\n \"teammates.delete\",\n \"templates.create\",\n \"templates.delete\",\n \"templates.read\",\n \"templates.update\",\n \"templates.versions.activate.create\",\n \"templates.versions.activate.delete\",\n \"templates.versions.activate.read\",\n \"templates.versions.activate.update\",\n \"templates.versions.create\",\n \"templates.versions.delete\",\n \"templates.versions.read\",\n \"templates.versions.update\",\n \"tracking_settings.click.read\",\n \"tracking_settings.click.update\",\n \"tracking_settings.google_analytics.read\",\n \"tracking_settings.google_analytics.update\",\n \"tracking_settings.open.read\",\n \"tracking_settings.open.update\",\n \"tracking_settings.read\",\n \"tracking_settings.subscription.read\",\n \"tracking_settings.subscription.update\",\n \"user.account.read\",\n \"user.credits.read\",\n \"user.email.create\",\n \"user.email.delete\",\n \"user.email.read\",\n \"user.email.update\",\n \"user.multifactor_authentication.create\",\n \"user.multifactor_authentication.delete\",\n \"user.multifactor_authentication.read\",\n \"user.multifactor_authentication.update\",\n \"user.password.read\",\n \"user.password.update\",\n \"user.profile.read\",\n \"user.profile.update\",\n \"user.scheduled_sends.create\",\n \"user.scheduled_sends.delete\",\n \"user.scheduled_sends.read\",\n \"user.scheduled_sends.update\",\n \"user.settings.enforced_tls.read\",\n \"user.settings.enforced_tls.update\",\n \"user.timezone.read\",\n \"user.username.read\",\n \"user.username.update\",\n \"user.webhooks.event.settings.read\",\n \"user.webhooks.event.settings.update\",\n \"user.webhooks.event.test.create\",\n \"user.webhooks.event.test.read\",\n \"user.webhooks.event.test.update\",\n \"user.webhooks.parse.settings.create\",\n \"user.webhooks.parse.settings.delete\",\n \"user.webhooks.parse.settings.read\",\n \"user.webhooks.parse.settings.update\",\n \"user.webhooks.parse.stats.read\",\n \"whitelabel.create\",\n \"whitelabel.delete\",\n \"whitelabel.read\",\n \"whitelabel.update\"\n]\n```", + "public": true + }, + "on-behalf-of": { + "id": "on-behalf-of", + "name": "On Behalf of Subuser", + "content": "Use the *on-behalf-of* header to make calls for a particular subuser through the parent account. Use this header to automate bulk updates, or to administer a subuser without changing the authentication in your code.\n\nTo use the feature, add the *on-behalf-of* header:\n\n`on-behalf-of: subuser_`\n\nThis header generates the API call as if the subuser account was making the call.\n\nWhen authenticating using the *on-behalf-of* header, you need to use the API key credentials of the **parent account**. For example:\n\n```curl -X GET \\\n 'https://api.sendgrid.com/v3/stats?start_date=2016-01-01&end_date=2017-01-01&aggregated_by=month' \\\n -H 'authorization: ' \\\n -H 'on-behalf-of: subuser_' \\\n ```\n\n**Note**: The *on-behalf-of* header does not work with the mail.send API.", + "public": true + } + }, + "mock": { + "enabled": false, + "dynamic": false + } + } +} \ No newline at end of file