Sendgrid API
Omnivery API allows you to send messages, retrieve delivery stats, check and configure your sending domains and more in multiple formats. This documentation covers the SendGrid v3 compatible API of Omnivery.
As this API is fully compatible with the SendGrid (v3) API any existing software or library support ing SendGrid (v3) API should work without any changes required. The only change that may be required would be the change of the endpoint and API token.
This REST API requires all requests to be authenticated using the Authorization header with your access token as a Bearer token (Authorization: Bearer <access token>). API tokens can be found in the UI under Credentials menu in API Keys tab (for domain specific/sending tokens) or under API keys menu. For security reasons we strongly suggest using domain specific API keys rather than account API keys whenever possible.
All data to the API endpoint must be posted in JSON format.
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.
Scheduled delivery
Set
send_atto a unix timestamp to hold the message and deliver it at that time. A globalsend_atapplies to every personalization; asend_atinside a personalization overrides it for that personalization only.
- The time must be less than 72 hours in the future. A later time is rejected with HTTP status code 400.
- A time that is now or already past sends the message immediately.
- A value that is not an integer unix timestamp is rejected with HTTP status code 400.
- Every
send_atin the request is checked before anything is sent, so one invalid value rejects the whole request. The error'sfieldnames the offending value, e.g.send_atorpersonalizations.1.send_at(0-based).
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Accept |
header | string | No | |
Content-Type |
header | string | No |
Request Body application/json
| Field | Type | Required | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
attachments |
array | No | An array of attachment objects to be included in the message. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
callback_url |
string | No | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
send_at |
integer | No | A unix timestamp allowing you to specify when you want your email to be delivered. Applies to every personalization that does not set its own |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
subject |
string | Yes | The subject of your email. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Responses
Accepted
Bad Request
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 '{"attachments": [], "callback_url": "string", "categories": [], "content": [], "custom_args": {"id": "string"}, "from": {"email": "string", "name": "string"}, "mail_settings": {"sandbox_mode": {"enable": false}}, "personalizations": [], "reply_to": {"email": "string", "name": "string"}, "send_at": 1.6172604e+09, "subject": "string", "substitutions": {"key": "string"}, "tracking_settings": {"click_tracking": {"enable": false, "enable_text": false}, "open_tracking": {"enable": false, "substitution_tag": "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({"attachments": [], "callback_url": "string", "categories": [], "content": [], "custom_args": {"id": "string"}, "from": {"email": "string", "name": "string"}, "mail_settings": {"sandbox_mode": {"enable": false}}, "personalizations": [], "reply_to": {"email": "string", "name": "string"}, "send_at": 1.6172604e+09, "subject": "string", "substitutions": {"key": "string"}, "tracking_settings": {"click_tracking": {"enable": false, "enable_text": false}, "open_tracking": {"enable": false, "substitution_tag": "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, '{"attachments": [], "callback_url": "string", "categories": [], "content": [], "custom_args": {"id": "string"}, "from": {"email": "string", "name": "string"}, "mail_settings": {"sandbox_mode": {"enable": false}}, "personalizations": [], "reply_to": {"email": "string", "name": "string"}, "send_at": 1.6172604e+09, "subject": "string", "substitutions": {"key": "string"}, "tracking_settings": {"click_tracking": {"enable": false, "enable_text": false}, "open_tracking": {"enable": false, "substitution_tag": "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={"attachments": [], "callback_url": "string", "categories": [], "content": [], "custom_args": {"id": "string"}, "from": {"email": "string", "name": "string"}, "mail_settings": {"sandbox_mode": {"enable": false}}, "personalizations": [], "reply_to": {"email": "string", "name": "string"}, "send_at": 1.6172604e+09, "subject": "string", "substitutions": {"key": "string"}, "tracking_settings": {"click_tracking": {"enable": false, "enable_text": false}, "open_tracking": {"enable": false, "substitution_tag": "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())