Getting Started with Real-time API

This section is intended for developers who want to integrate EmailMarkerĀ® service on their own applications. The REST APIs provide programmatic access to verification service. Verify single email , upload file , get list informations and download files results. The REST API identifies users using Api key authentification; responses are in JSON format. .

Single Api Verification

To use a single verification API call, you will need the following parameters :

Attributes
  • apiKey

    Your EmailMarker API key.

  • email

    The email address to be verified.

The single verification API is located as an HTTP GET request at the following URL :

https://app.emailmarker.com/api/verify
Example of HTTP Request
https://app.emailmarker.com/api/[email protected]
The example request will result in a json response like :
                                         
				{
				    "success": true,
				    "result": "invalid",
				    "message": ""
				}
				
                                         
This API call responds with the following values:
success true | false - true if the API request was successful.
result The email status : valid , invalid , unknown
message The reason for the error if success == false .

Bulk Api Verification

To use a bulk verification API call, you will need the following parameters :

Attributes
  • apiKey

    Your EmailMarker API key.

  • filename

    Name of your file.

https://app.emailmarker.com/api/upload
Example of HTTP Request
https://app.emailmarker.com/api/upload?apiKey=wkzxEIa0EXSMZgcvw62Ow&filename=myFile.csv
Example of success response :
                                         
				{
				    "success": true,
				    "file_id": "20190",
				    "message": ""
				}
				
                                         
Example of error response :
                                         
				{
				    "success": false,
				    "file_id": "",
				    "message": "Invalid API key"
				}
				
                                         

Get file info with API

To use a bulk verification API call, you will need the following parameters :

Attributes
  • apiKey

    Your EmailMarker API key.

  • filename

    Name of your file.

https://app.emailmarker.com/api/info
Example of HTTP Request
https://app.emailmarker.com/api/info?apiKey=wkzxEIa0EXSMZgcvw62Ow&fileId=20190
Example of success response when file is processing :
                                         
					{
					    "success": true,
					    "result": {
					        "file_id": "20190",
					        "filename": "myFile.csv",
					        "lines": "18",
					        "lines_processed": "10",
					        "valid": "6",
					        "invalid": "0",
					        "unknown": "0",
					        "status": "progress",
					        "timestamp": 1479678411,
					        "valid_file": "",
					        "full_report_file": ""
					    },
					    "message": ""
					}
				
                                         
Example of success response when file is processed :
                                         
					{
					    "success": true,
					    "result": {
					        "file_id": "20190",
					        "filename": "myFile.csv",
					        "lines": "18",
					        "lines_processed": "18",
					        "valid": "6",
					        "invalid": "0",
					        "unknown": "12",
					        "status": "finished",
					        "timestamp": 1479678411,
					        "valid_file": "https://app.emailmarker.com/valid_file.csv",
					        "full_report_file": "https://app.emailmarker.com/full_report_file.csv"
					    },
					    "message": ""
					}
				
                                         

Code Examples

Single Verification
                                          
$email = "[email protected]";
$url= 'https://app.emailmarker.com/api/verify?apiKey=wkzxEIa0EXSMZgcvw62Ow&email='.$email;
$response = file_get_contents($url);
                                          
Upload File
                                          
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$filename = "myFile.csv";
$filepath = realpath($filename);
$mimeType = finfo_file($finfo, $filepath);
$url = 'https://app.emailmarker.com/api/upload?apiKey=wkzxEIa0EXSMZgcvw62Ow&filename='.$filename;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$settings['file_contents'] = new CURLFile($filepath,$mimeType,$filename);
curl_setopt($ch, CURLOPT_POSTFIELDS, $settings);
$file_id = curl_exec($ch);
curl_close($ch);
                                          
Get File info
                                          
$file_id = 20190; //File id that was saved after file upload
$url= 'https://app.emailmarker.com/api/info?apiKey=wkzxEIa0EXSMZgcvw62Ow&fileId='.$file_id;
$response = file_get_contents($url); //execute request to api
$data = json_decode($response, true); // optional : convert the response to an array