Overview
CSV Feed
PHP SDK
API Integration
API For Partners
Unsubscribed Emails
Returns the a list of emails that unsubscribed in a given interval
Method: GET
URL: https://api.retargeting.app/v1/unsubscribed-emails
Function parameters
Field | Type | Required | Description |
---|---|---|---|
rest_key | number or text | True | The REST API Key of the client. |
date_from | number | Optional (Required only if date_to parameter is given) | Unix Timestamp (Example: 1723166549). If not provided, default fallback is 30 days in the past from now. |
date_to | number | Optional | Unix Timestamp (Example: 1725758549). If not provided, default fallback is the current time. |
The interval between date_from and date_to parameters (if provided) must not exceed 30 days.
Your account status must be in one of the states: PAID, PAYMENT ERROR or ACCOUNT SUSPENDED.
If your account is Inactive or Closed the API call will not work.
The API call will respond with JSON format.
Example
<?php require_once "vendor/autoload.php"; $apiURL = "https://api.retargeting.app/v1/unsubscribed-emails"; $apiKey = "REST_KEY"; $client = new GuzzleHttp\Client(); $data = [ "rest_key" => $apiKey, "date_from" => 1723166549, "date_to" => 1725758549, ]; $request = $client->request("GET", $apiURL, ["query" => $data]);
If the API call succeeds, then the response will be as seen below:
{ status: "success", data: [ "abc-email@provider.com", "email-abc@provider.com", ..., "123-email@provider.com", "email-123@provider.com" ] }
If the API call fails, then the responses will be similar to the ones below:
When the rest_key parameter is invalid:
{ status: "error", message: "Incorrect rest key!" }
When the account is not active:
{ status: "error", message: "Your account is not active!" }
When the interval between date_from and date_to parameters is greater than 30 days:
{ status: "error", message: "Interval is greater than 30 days" }
When date_from parameter is not provided together with date_to parameter:
{ status: "fail", data: { validator: { date_from: [ "The date from field is required when date to is present." ] } } }
When something went wrong:
{ status: "error", message: "Something went wrong" }