Campaigns API
Campaigns define automated collection flows that operate on groups of accounts. Use the Campaigns API to discover available campaigns and assign accounts into them.
Endpoints
| Method | Path | Scope | Description |
|---|---|---|---|
| GET | /campaigns | campaigns:read | List all campaigns for your company. |
| GET | /campaigns/{campaign_id} | campaigns:read | Get details for a single campaign. |
| POST | /accounts/{account_id}/campaign | accounts:write | Assign a single account to a campaign. |
| POST | /accounts/campaign/bulk | accounts:write | Bulk assign up to 100 accounts to a campaign. |
Scope behavior and empty-scope full-access rules are documented in Core Concepts → Authentication.
Fields
| Field | Type | Description |
|---|---|---|
campaign_id | uuid | Target campaign identifier. |
status | string | Filter campaigns by active, draft, paused, archived. |
type | string | Filter campaigns by campaign type. |
account_ids | uuid[] | Array of account IDs to enroll in a campaign. |
List campaigns
curl --request GET \
--url 'https://api.agilereceivables.com/api/v1/external/campaigns?page=1&per_page=20' \
--header 'X-Api-Key: sk_live_xxxxxxxxxxxxxxxxxxxx'Supported query parameters:
| Param | Type | Description |
|---|---|---|
search | string | Search by campaign fields such as name. |
status | string | Filter by campaign status. |
type | string | Filter by campaign type. |
page | integer | Page number (default: 1, min: 1). |
per_page | integer | Results per page (default: 20, min: 1, max: 100). |
Pagination behavior and the meta object are documented in Core Concepts → Pagination.
Bulk assign accounts to a campaign
cURL
curl --request POST \
--url 'https://api.agilereceivables.com/api/v1/external/accounts/campaign/bulk' \
--header 'X-Api-Key: sk_live_xxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"campaign_id": "uuid",
"account_ids": ["uuid1", "uuid2", "uuid3"]
}'Response
{
"success": true,
"status_code": 200,
"message": "Campaign assignment processed",
"data": {
"campaign_id": "uuid",
"total_enrollments": 3,
"successful_enrollments": 2,
"failed_enrollments": 1,
"results": [
{ "invoice_id": "uuid1", "invoice_number": "INV-001", "status": "SUCCESS" },
{ "invoice_id": "uuid2", "invoice_number": "INV-002", "status": "SUCCESS" },
{ "invoice_id": "uuid3", "invoice_number": "INV-003", "status": "FAILED", "error": "..." }
]
}
}Enrollment status values: SUCCESS, FAILED, SKIPPED, PENDING.
Enrollment behavior and constraints
- One active campaign execution per invoice at a time.
- If an invoice already has an active execution (
pending,running, orwaiting), enrollment is rejected. - After a campaign completes, the invoice moves to
PENDING_COLLECTIONand can be enrolled again. - A customer with multiple invoices can have each invoice in different campaigns.
- Campaign chaining can be configured via
next_campaign_id(for example:payment_reminder->early_stage->first_party).
Enrollment error messages
Possible enrollment failures include:
Invoice has an active execution in another campaign. Please wait for the current campaign to complete before reassigning.Invoice or Customer not found or access deniedInvoice does not belong to this customerInvoice is past its due date and cannot be enrolled in a payment reminder campaign. Please use an early stage or first party campaign instead.
Campaign status and new enrollments
| Campaign status | Accepts new enrollments |
|---|---|
DRAFT | No |
SCHEDULED | No |
RUNNING / ACTIVE | Yes |
PAUSED | Yes |
COMPLETED | No |
CANCELLED | No |