Get subscriber details


×
For API key Please contact with us at our SMTPprovider web chat

Get the details for up to 100 subscribers at a time.

URL

GET https://spsrvr.com/ga/api/v2/mailing_lists/:mailing_list_id/subscribers/:subscriber_ids_or_emails

Request Parameters

Key Meaning Example
mailing_list_id The id of the mailing list the subscribers are on. This can be found on the mailing list’s page under the “Admin” section 456
subscriber_ids_or_emails A comma-separated list of up to 100 subscriber ids or URI encoded email addresses 1,9182,bob%40example.com,9981

Notes

  • The email addresses in the request should be URI encoded.
  • If the request includes an email address used by multiple subscribers on the mailing list (as might be the case if the mailing list uses an alternate primary key), the API will return all subscribers with that email address.

Response

The response will be a JSON array where each element contains the following keys.

Key Meaning Example Type
id The id of the subscriber 123 Integer
mailing_list_id The id of the mailing list 456 Integer
email The subscriber’s email address bob@example.com String
created_at The date the subscriber record was added to SMTPProvider Studio. 2013-03-27T10:14:13-05:00 String
confirmed The subscriber’s confirmed status. This column is only presented for mailing lists which use the Confirmed field. true or false Boolean
email_format The subscriber’s email format. This column is only presented for mailing lists which use the Format field. plaintext or html String
status The status of the subscriber. active, bounced, unsubscribed, scomp or deactivated String
subscribe_time The time the subscriber subscribed. 2013-03-27T10:14:13-05:00 String
subscribe_ip The IP the subscriber subscribed from. This can be null if it is unknown. 192.168.0.123 String
custom_fields An array of entries matching the definition found below. Hash

Each entry in the custom_fields hash are keyed for the name of the custom field, and the value being a hash containing the following keys.

Key Meaning Example Type Present for Custom Field Types
name The name of the custom field which this entry represents. First Name String All
type The type of the custom field. text, text_multiline, number, date, select_single_dropdown, select_single_radio, select_multiple_checkboxes, boolean String All
value The string value of the custom field. James McGuy String text, text_multiline, select_single_dropdown, select_single_radio
value The integer value of the custom field. 9182 Integer number
value The boolean value of the custom field. true or false Boolean boolean
value The date value of the custom field. 2000-02-17 String date
value The list of values selected for the custom field. Array of strings select_multiple_checkboxes

Example Request

> GET /ga/api/v2/mailing_lists/1/subscribers/1,2 HTTP/1.1
> Authorization: Basic MTo1ZTk2NDY1Yzg4M2YzMzA5ZjAxMDVhMmUxMDc2NjMyYjY4N2U2MWQy
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: SMTPProvider-studio.dev
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html
< X-UA-Compatible: IE=Edge
< ETag: "68a7c81054bbf60f3b6ee5c481e5245b"
< Cache-Control: max-age=0, private, must-revalidate
< Set-Cookie: _session_id=ef4d24b30d8700118859eb7a8d0d291c; path=/; HttpOnly
< X-Request-Id: 3a5478ebf7c8d5bc047c8d989403c863
< X-Runtime: 0.028557
< Connection: close
{
    "data": [
        {
            "created_at": "2013-01-31T14:25:48-06:00",
            "custom_fields": {
                "First Name": {
                    "name": "First Name",
                    "type": "text",
                    "value": "Bob"
                },
                "boolean test": {
                    "name": "boolean test",
                    "type": "boolean",
                    "value": false
                },
                "boolean test yes by default": {
                    "name": "boolean test yes by default",
                    "type": "boolean",
                    "value": true
                },
                "radio test": {
                    "name": "radio test",
                    "type": "select_single_radio",
                    "value": "bar"
                }
            },
            "email": "bob@example.com",
            "id": 1,
            "mailing_list_id": 1,
            "status": "active",
            "subscribe_ip": null,
            "subscribe_time": "2013-01-31T14:25:48-06:00"
        },
        {
            "created_at": "2013-01-31T14:25:48-06:00",
            "custom_fields": {},
            "email": "joe@example.net",
            "id": 2,
            "mailing_list_id": 1,
            "status": "active",
            "subscribe_ip": null,
            "subscribe_time": "2013-01-31T14:25:48-06:00"
        }
    ],
    "error_code": null,
    "error_message": null,
    "success": true
}

PHP Example :
 

<?php

// API Configuration
$api_key = 'API_KEY_HERE_FROM_WEB_UI';
$api_url = 'http://example.com/ga/api';
 
// Subscriber data
$listID = 5;
$email = 'customer1@example.com';
 
$request_url = "$api_url/mailing_lists/$listID/subscribers/$email";
print "\nRequesting\n$request_url\n";
$request_handle = curl_init($request_url);
curl_setopt($request_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($request_handle, CURLOPT_USERPWD, "$api_key");
curl_setopt($request_handle, CURLOPT_POST, true);
$request_result = curl_exec($request_handle);
print "\nThe results are:\n";
print_r(json_decode($request_result));
?>