# Subscribers

## Get subscribers

<mark style="color:blue;">`GET`</mark> `https://api.sparkloop.app/v2/campaigns/:identifier/subscribers`

Subscribers are ordered in descending order by *created\_at*, meaning the first page shows the latest subscribers.

#### Path Parameters

| Name                                         | Type   | Description                                |
| -------------------------------------------- | ------ | ------------------------------------------ |
| identifier<mark style="color:red;">\*</mark> | String | Referral campaign UUID, e.g. MF9a78983d1c. |

#### Query Parameters

| Name   | Type   | Description                                                                                            |
| ------ | ------ | ------------------------------------------------------------------------------------------------------ |
| type   | string | Type of subscribers you want to get. Default is *all*, allowed values are *all, referrals, advocates.* |
| expand | String | If you pass "campaigns" the response will include referral\_programs data                              |

{% tabs %}
{% tab title="200 Used query params ?page=2\&per\_page=2" %}

```json
{
  "subscribers": [
    {
      "uuid": "sub_4bc1056297",
      "email": "drago@sparkloop.app",
      "name": null,
      "ref_code": "c784ef4f",
      "referrer_code": null,
      "referred": true,
      "referral_status": "verified",
      "ip_address": null,
      "user_agent": null,
      "origin": "signup",
      "utm_source": null,
      "utm_campaign": null,
      "created_at": "2021-03-24T11:55:02.113Z"
    },
    {
      "uuid": "sub_869976268c",
      "email": "manuel@sparkloop.com",
      "name": null,
      "ref_code": "d163ac6e",
      "referrer_code": null,
      "referred": false,
      "referral_status": "verified",
      "ip_address": null,
      "user_agent": null,
      "origin": "signup",
      "utm_source": null,
      "utm_campaign": null,
      "created_at": "2021-03-24T11:55:02.096Z"
    }
  ],
  "meta": {
    "per_page": 2,
    "page": 2,
    "total_pages": 3,
    "total_subscribers": 6
  }
}
```

{% endtab %}
{% endtabs %}

## Get a subscriber

<mark style="color:blue;">`GET`</mark> `https://api.sparkloop.app/v2/campaigns/:identifier/subscribers/:subscriber_identifier`

Returns a single subscriber by email address or UUID

#### Path Parameters

| Name                                                     | Type   | Description                                |
| -------------------------------------------------------- | ------ | ------------------------------------------ |
| subscriber\_identifier<mark style="color:red;">\*</mark> | string | Subscriber's UUID or email address         |
| identifier<mark style="color:red;">\*</mark>             | string | Referral campaign UUID, e.g. MF9a78983d1c. |

#### Query Parameters

| Name   | Type   | Description                                                               |
| ------ | ------ | ------------------------------------------------------------------------- |
| expand | String | If you pass "campaigns" the response will include referral\_programs data |

{% tabs %}
{% tab title="200 " %}

```json
{
  "subscriber": {
    "uuid": "sub_4bc1056297",
    "email": "test36@drago.com",
    "name": null,
    "ref_code": "c784ef4f",
    "referrer_code": null,
    "referred": true,
    "referral_status": "verified",
    "ip_address": null,
    "user_agent": null,
    "origin": "signup",
    "utm_source": null,
    "utm_campaign": null,
    "created_at": "2021-03-24T11:55:02.113Z"
  }
}
```

{% endtab %}

{% tab title="404 " %}
{% tabs %}
{% tab title="Subscriber not found" %}

```
{
    "error": "Subscriber sub_4bc10562d97 not found!"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Get referrals for a subscriber

<mark style="color:blue;">`GET`</mark> `https://api.sparkloop.app/v2/campaigns/:``identifier/subscribers/:subscriber_identifier/referrals`

Get the referrals of a specific subscriber.

Subscribers are ordered descendingly by *created\_at*, meaning the first page shows the latest subscribers.

#### Path Parameters

| Name                                                     | Type   | Description                                |
| -------------------------------------------------------- | ------ | ------------------------------------------ |
| subscriber\_identifier<mark style="color:red;">\*</mark> | String | Subscriber's UUID or email address         |
| identifier<mark style="color:red;">\*</mark>             | String | Referral campaign UUID, e.g. MF9a78983d1c. |

#### Query Parameters

| Name      | Type    | Description                                                                   |
| --------- | ------- | ----------------------------------------------------------------------------- |
| per\_page | integer | Number of subscribers returned in a single request. Default is 50, max is 200 |
| page      | integer | The page you want to get. Default is 1                                        |
| expand    | String  | If you pass "campaigns" the response will include referral\_programs data     |

{% tabs %}
{% tab title="200 Used query params ?page=2\&per\_page=3" %}

```
{
    "subscribers": [
        {
            "uuid": "sub_4bc1056297",
            "email": "test36@drago.com",
            "name": null,
            "ref_code": "c784ef4f",
            "referrer_code": null,
            "referrals_count": 0,
            "referred": true,
            "referral_status": "verified",
            "ip_address": null,
            "user_agent": null,
            "origin": "signup",
            "utm_source": null,
            "utm_campaign": null,
            "created_at": "2021-03-24T11:55:02.113Z"
        },
        {
            "uuid": "sub_869976268c",
            "email": "test35@drago.com",
            "name": null,
            "ref_code": "d163ac6e",
            "referrer_code": null,
            "referrals_count": 0,
            "referred": true,
            "referral_status": "pending",
            "ip_address": null,
            "user_agent": null,
            "origin": "signup",
            "utm_source": null,
            "utm_campaign": null,
            "created_at": "2021-03-24T11:55:02.096Z"
        },
        {
            "uuid": "sub_d4795d06e6",
            "email": "test34@drago.com",
            "name": null,
            "ref_code": "57b1fae2",
            "referrer_code": null,
            "referrals_count": 0,
            "referred": true,
            "referral_status": "rejected",
            "ip_address": null,
            "user_agent": null,
            "origin": "api",
            "utm_source": null,
            "utm_campaign": null,
            "created_at": "2021-03-24T11:55:02.066Z"
        }
    ],
    "meta": {
        "per_page": 3,
        "page": 2,
        "total_pages": 12,
        "total_subscribers": 36
    }
}
```

{% endtab %}
{% endtabs %}
