Skip to main content
GET
/
v2
/
subscribers
PHP
declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Operations;

$sdk = novu\Novu::builder()
    ->setSecurity(
        'YOUR_SECRET_KEY_HERE'
    )
    ->build();

$request = new Operations\SubscribersControllerSearchSubscribersRequest(
    limit: 10,
);

$response = $sdk->subscribers->search(
    request: $request
);

if ($response->listSubscribersResponseDto !== null) {
    // handle response
}
{
  "data": [
    {
      "subscriberId": "<string>",
      "_organizationId": "<string>",
      "_environmentId": "<string>",
      "deleted": true,
      "createdAt": "<string>",
      "updatedAt": "<string>",
      "_id": "<string>",
      "firstName": "<string>",
      "lastName": "<string>",
      "email": "<string>",
      "phone": "<string>",
      "avatar": "<string>",
      "locale": "<string>",
      "channels": [
        {
          "credentials": {
            "webhookUrl": "https://example.com/webhook",
            "channel": "general",
            "deviceTokens": [
              "token1",
              "token2",
              "token3"
            ],
            "alertUid": "12345-abcde",
            "title": "Critical Alert",
            "imageUrl": "https://example.com/image.png",
            "state": "resolved",
            "externalUrl": "https://example.com/details"
          },
          "_integrationId": "<string>",
          "integrationIdentifier": "<string>"
        }
      ],
      "topics": [
        "<string>"
      ],
      "isOnline": true,
      "lastOnlineAt": "<string>",
      "__v": 123,
      "data": {},
      "timezone": "<string>"
    }
  ],
  "next": "<string>",
  "previous": "<string>",
  "totalCount": 123,
  "totalCountCapped": true
}

Authorizations

Authorization
string
header
required

API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".

Headers

idempotency-key
string

A header for idempotency purposes

Query Parameters

after
string

Cursor for pagination indicating the starting point after which to fetch results.

before
string

Cursor for pagination indicating the ending point before which to fetch results.

limit
number

Limit the number of items to return

orderDirection
enum<string>

Direction of sorting

Available options:
ASC,
DESC
orderBy
string

Field to order by

includeCursor
boolean

Include cursor item in response

email
string

Email address of the subscriber to filter results.

name
string

Name of the subscriber to filter results.

phone
string

Phone number of the subscriber to filter results.

subscriberId
string

Unique identifier of the subscriber to filter results.

Response

OK

data
object[]
required

List of returned Subscribers

next
string | null
required

The cursor for the next page of results, or null if there are no more pages.

previous
string | null
required

The cursor for the previous page of results, or null if this is the first page.

totalCount
number
required

The total count of items (up to 50,000)

totalCountCapped
boolean
required

Whether there are more than 50,000 results available