Sendgrid API
https://sg-api.omnivery.net/v3
Omnivery Sendgrid v3 compatible API
Authentication
- API Key: HTTP bearer
Enter your credentials below to use the Try it feature:
This endpoint allows you to send email using SendGrid v3 compatible API
- Top level parameters are referred to as "global".
- Individual fields within the personalizations array will override any other global, or "message level", parameters that are defined outside of personalizations.
This endpoint requires use of domain level API credentials and can not be used with account level API key.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Accept |
header | string | No | |
Content-Type |
header | string | No |
Request Body application/json
| Field | Type | Required | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
content |
array | Yes | An array where you can 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, add another object to the array containing the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mail_settings |
object | No | Mail settings allow you to control certain attributes of message processing |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
personalizations |
array | Yes | 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. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
reply_to |
object | No | Email address object with the email address and full name of the sender (from) or recipient (to, cc, bcc or reply-tp). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
subject |
string | Yes | The subject of your email. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
attachments |
array | No | An array of attachment objects to be included in the message. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
categories |
array | No | An array of category names for this message. Each category name may not exceed 64 characters. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
custom_args |
object | No | Custom values are key/value pairs attached to the message. Key/value pairs must be strings. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. Custom arguments defined in personalizations will override arguments set on global level. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
from |
object | Yes | Email address object with the email address and full name of the sender (from) or recipient (to, cc, bcc or reply-tp). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
substitutions |
object | No | An object of key/value pairs following the pattern |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tracking_settings |
object | No | A collection of different settings that you can use to override domain defaults. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
callback_url |
string | No | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Responses
Accepted
Bad Request
{
"errors": [
{
"field": "from.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.from",
"message": "The from email does not contain a valid address."
},
{
"field": "personalizations.0.to.0.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.to",
"message": "Does not contain a valid address."
},
{
"field": "personalizations.0.to.1.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.to",
"message": "Does not contain a valid address."
},
{
"field": "personalizations.0.cc.0.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.cc",
"message": "Does not contain a valid address."
},
{
"field": "personalizations.0.bcc.0.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.bcc",
"message": "Does not contain a valid address."
},
{
"field": "personalizations.1.to.0.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.to",
"message": "Does not contain a valid address."
},
{
"field": "personalizations.1.bcc.0.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.bcc",
"message": "Does not contain a valid address."
},
{
"field": "personalizations.1.from.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.from",
"message": "Does not contain a valid address."
},
{
"field": "personalizations.1.from",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.from",
"message": "The top level from email domain does not match all the from email domains in the personalization array"
},
{
"field": "reply_to.email",
"help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.reply_to",
"message": "The reply_to email does not contain a valid address."
}
]
}
Payment Required
Code Samples
curl -X POST 'https://sg-api.omnivery.net/v3/mail/send' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"content": [], "mail_settings": {}, "personalizations": [], "reply_to": {}, "subject": "string", "attachments": [], "categories": [], "custom_args": {}, "from": {}, "substitutions": {}, "tracking_settings": {}, "callback_url": "string"}'
package main
import (
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("POST", "https://sg-api.omnivery.net/v3/mail/send", nil)
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
resp, _ := http.DefaultClient.Do(req)
fmt.Println(resp.Status)
}
const response = await fetch('https://sg-api.omnivery.net/v3/mail/send', {
method: 'POST',
headers: {'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_TOKEN'},
body: JSON.stringify({"content": [], "mail_settings": {}, "personalizations": [], "reply_to": {}, "subject": "string", "attachments": [], "categories": [], "custom_args": {}, "from": {}, "substitutions": {}, "tracking_settings": {}, "callback_url": "string"})
});
const data = await response.json();
<?php
$ch = curl_init('https://sg-api.omnivery.net/v3/mail/send');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_TOKEN']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"content": [], "mail_settings": {}, "personalizations": [], "reply_to": {}, "subject": "string", "attachments": [], "categories": [], "custom_args": {}, "from": {}, "substitutions": {}, "tracking_settings": {}, "callback_url": "string"}');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
response = requests.post(
'https://sg-api.omnivery.net/v3/mail/send',
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_TOKEN'},
json={"content": [], "mail_settings": {}, "personalizations": [], "reply_to": {}, "subject": "string", "attachments": [], "categories": [], "custom_args": {}, "from": {}, "substitutions": {}, "tracking_settings": {}, "callback_url": "string"}
)
print(response.json())
Response
Address
Email Address Validation provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case.
Email validation must be enabled in the domain settings requires use of domain level API credentials.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Accept |
header | string | No | |
Content-Type |
header | string | No |
Request Body application/json
| Field | Type | Required | Description |
|---|---|---|---|
email |
string | Yes | Email address to validate |
Responses
OK
Code Samples
curl -X POST 'https://sg-api.omnivery.net/v3/validations/email' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"email": "string"}'
package main
import (
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("POST", "https://sg-api.omnivery.net/v3/validations/email", nil)
req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
resp, _ := http.DefaultClient.Do(req)
fmt.Println(resp.Status)
}
const response = await fetch('https://sg-api.omnivery.net/v3/validations/email', {
method: 'POST',
headers: {'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_TOKEN'},
body: JSON.stringify({"email": "string"})
});
const data = await response.json();
<?php
$ch = curl_init('https://sg-api.omnivery.net/v3/validations/email');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_TOKEN']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"email": "string"}');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
response = requests.post(
'https://sg-api.omnivery.net/v3/validations/email',
headers={'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_TOKEN'},
json={"email": "string"}
)
print(response.json())