Objective
Making a Bulk Email Validation API request can be tricky especially uploading the file via a Curl request. This document should be used along with our existing API documentation and aims to explain how you can complete the entire process (including file upload) within postman.
Product
Twilio SendGrid Email Validation API.
User Account Permission/Role(s) Required
We recommend using an API key with Email Address Validation Access to make the API call. You can check these articles to find out what permissions are required to use this endpoint:
Types of API keys
Teammate permissions (if you are not an admin).
Procedure
I will be showing the steps with complete screenshots from Postman (some data may be blurred or masked due to security reasons) illustrating and explaining the various steps involved:
Request a Bulk Email Address Validation Upload URL
How to set up the request:
-
- Method: PUT
- URL: https://api.sendgrid.com/v3/validations/email/jobs
- Headers:
-
Authorization: Bearer Token. In the Token field, insert your full SENDGRID_API_KEY:
-
Content-Type: application/JSON
-
Body:
- Select the raw format and choose JSON
This API will give you the upload URL and upload headers where you need to upload the file for email validation. This will also give you the Job ID to track the status of your email validation request.
Example JSON body
{"file_type":"csv"}
-
Send the request:
- Click the "Send" button in Postman to execute the request.
Sample Response
{
"job_id": "01JQTXXXXXXXXXXXXXXXXXY9F6",
"upload_uri": "<<Long upload uri>>",
"upload_headers": [
{
"header": "x-amz-server-side-encryption",
"value": "aws:kms"
},
{
"header": "content-type",
"value": "text/csv"
}
]
}
Once you have received the upload URI, you can upload your CSV file for bulk email validation as follows:
Uploading file to the Upload URI
How to set up the request:
-
- Method: PUT
- URL: Upload URL received in the response of Request a Bulk Email Address Validation Upload URL API
-
Headers:
Content-Type: text/csv
x-amz-server-side-encryption: aws:kms - Body: Binary
- Authorization: No Auth
Select the CSV file containing the email addresses that you wish to validate and upload it.
Once the file is uploaded, you can check the status of your bulk email validation request using the job ID received in response of Bulk Email Address Validation Upload URL API using the below API.
Get a Bulk Email Address Validation By ID
How to set up the request:
-
- Method: GET
- URL: https://api.sendgrid.com/v3/validations/email/jobs/{job_id}
- Body: None
- Authorization: Bearer Token. In the Token field, insert your full SENDGRID_API_KEY:
If the status of the validation request shows as done, then you should check your email on file for the detailed email validation report.