Accounts & Integrations
API Reference
Campaigns

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

MethodPathScopeDescription
GET/campaignscampaigns:readList all campaigns for your company.
GET/campaigns/{campaign_id}campaigns:readGet details for a single campaign.
POST/accounts/{account_id}/campaignaccounts:writeAssign a single account to a campaign.
POST/accounts/campaign/bulkaccounts:writeBulk assign up to 100 accounts to a campaign.

Scope behavior and empty-scope full-access rules are documented in Core Concepts → Authentication.

Fields

FieldTypeDescription
campaign_iduuidTarget campaign identifier.
statusstringFilter campaigns by active, draft, paused, archived.
typestringFilter campaigns by campaign type.
account_idsuuid[]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:

ParamTypeDescription
searchstringSearch by campaign fields such as name.
statusstringFilter by campaign status.
typestringFilter by campaign type.
pageintegerPage number (default: 1, min: 1).
per_pageintegerResults 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, or waiting), enrollment is rejected.
  • After a campaign completes, the invoice moves to PENDING_COLLECTION and 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 denied
  • Invoice does not belong to this customer
  • Invoice 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 statusAccepts new enrollments
DRAFTNo
SCHEDULEDNo
RUNNING / ACTIVEYes
PAUSEDYes
COMPLETEDNo
CANCELLEDNo