Numberly
Campaigns

Campaigns informations

The NMP API enables comprehensive management of the campaign lifecycle. Whether created via the interface or programmatically, it is essential to be able to retrieve their technical information (statuses, identifiers, configuration) for monitoring or orchestration.

Listing Campaigns

The list endpoint allows you to retrieve all campaigns accessible by your account.

Endpoint

GET /v1/campaigns

Filtering Parameters (Query Params)

You can refine your search using the following parameters:

  • Pagination:
    • limit: Maximum number of items (Default: 20, Max: 20).
    • page: Page number (Default: 1).
  • Filters:
    • search: Text search on the campaign name.
    • channel: Filter by channel (email, sms, push_notification).
    • status: Filter by state (draft, published, processing, completed, failed, paused).
    • type: Filter by typology (schedulable or transactional).

Request Example

curl -X GET "https://api.nmp.numberly.com/v1/campaigns?status=published&type=transactional&limit=20" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json"

API Response

The response returns a collection of simplified Campaign objects.

{
  "objects": [
    {
      "id": 125,
      "name": "Order Confirmation",
      "type": "transactional",
      "status": "published",
      "channel": "email",
      "created_at": "2023-10-01T10:00:00Z"
    }
  ],
  "pagination": {
    "total": 1,
    "limit": 20,
    "page": 1
  }
}

Retrieving a Specific Campaign

To obtain the complete details of a campaign, use its unique identifier (id).

This call is contextual: the JSON response structure adapts dynamically depending on whether the campaign is of type Schedulable (Marketing) or Transactional (Application).

Endpoint

GET /v1/campaigns/{id}

Request Example

curl -X GET "https://api.nmp.numberly.com/v1/campaigns/125" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

API Response

The response contains the full configuration.

Type-Specific Fields:

  • For a transactional campaign: The response includes the code field. This functional identifier (e.g., ORDER_CONFIRM_V1) serves as a reference when sending unitary messages.
  • For a schedulable campaign: The response includes the schedule object (details of one-shot or recurrent scheduling) and the targeting parameters (target).

Example for a transactional campaign:

{
  "id": 125,
  "name": "Order Confirmation",
  "type": "transactional",
  "status": "published",
  "channel": "email",
  "subject": "Your order is confirmed",
  "code": "ORDER_CONFIRM_V1", 
  "sender": {
    "name": "Customer Service",
    "email": "no-reply@example.com"
  },
  "content": {
    "id": 456,
    "language": "en"
  }
}