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:
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())
Response
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mail_settings |
object | No | Mail settings allow you to control certain attributes of message processing |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
subject |
string | Yes | The subject of your email. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
substitutions |
object | No | An object of key/value pairs following the pattern |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
attachments |
array | No | An array of attachment objects to be included in the message. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
callback_url |
string | No | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tracking_settings |
object | No | A collection of different settings that you can use to override domain defaults. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
categories |
array | No | An array of category names for this message. Each category name may not exceed 64 characters. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 '{"mail_settings": {}, "subject": "string", "substitutions": {}, "attachments": [], "callback_url": "string", "custom_args": {}, "personalizations": [], "reply_to": {}, "tracking_settings": {}, "categories": [], "content": [], "from": {}}'
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({"mail_settings": {}, "subject": "string", "substitutions": {}, "attachments": [], "callback_url": "string", "custom_args": {}, "personalizations": [], "reply_to": {}, "tracking_settings": {}, "categories": [], "content": [], "from": {}})
});
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, '{"mail_settings": {}, "subject": "string", "substitutions": {}, "attachments": [], "callback_url": "string", "custom_args": {}, "personalizations": [], "reply_to": {}, "tracking_settings": {}, "categories": [], "content": [], "from": {}}');
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={"mail_settings": {}, "subject": "string", "substitutions": {}, "attachments": [], "callback_url": "string", "custom_args": {}, "personalizations": [], "reply_to": {}, "tracking_settings": {}, "categories": [], "content": [], "from": {}}
)
print(response.json())