GET
/api/public/v1/campaigns

List campaigns

Marketing sends: one message written once and sent to an audience of a location’s customers. The rest of xRM talks to one customer at a time; this is the layer above. An SMS campaign sends from a phone number of its own, because Twilio allows one A2P registration per messaging service and one service per number — marketing traffic cannot share the company’s transactional sender.

Required scope

The access token must carry this scope. A token missing it gets 403 Forbidden. Grant them to an API client under Settings → Company → API, and to a teammate under Employee → Permissions.

campaigns:read

Query Parameters

NameTypeRequiredDescription
locationIdstringRequiredWhose campaigns to read.
limitnumberOptionalMaximum number of items to return (1-100).Default: 20
offsetnumberOptionalNumber of items to skip before starting to collect the result set.Default: 0
sortBystringOptionalField to sort by. Allowed values vary by endpoint.Default: createdAt
sortOrderstring
asc
desc
OptionalSort direction.Default: desc
searchstringOptionalFree-text search across the resource’s primary fields.
createdAfterstringOptionalISO 8601 timestamp — only return items created after this time.
createdBeforestringOptionalISO 8601 timestamp — only return items created before this time.
updatedAfterstringOptionalISO 8601 timestamp — only return items updated after this time.
statusstring
DRAFT
REGISTERING
READY
SCHEDULED
SENDING
SENT
PAUSED
FAILED
OptionalREGISTERING is SMS-only — its carrier registration is pending. READY can send; SENT is done.
channelstring
EMAIL
SMS
OptionalWhich pipe it sends down.
GETExample request
curl
curl -X GET "https://www.pxb.app/api/public/v1/campaigns" \
  -H "Authorization: Bearer your_access_token"
200Example response
json
{
  "message": "Campaigns retrieved successfully!",
  "content": {
    "campaigns": [
      {
        "id": "cmp_3311",
        "locationId": "loc_abc123",
        "name": "Autumn service reminder",
        "channel": "EMAIL",
        "status": "DRAFT",
        "subject": "Time for your autumn service",
        "body": "Hi {{name}} — you are due for a service.",
        "audience": {
          "lifecycleStages": [
            "CUSTOMER"
          ],
          "inactiveDays": 180,
          "createdWithinDays": null,
          "neverContacted": false
        },
        "scheduledAt": null,
        "startedAt": null,
        "sentAt": null,
        "createdAt": "2026-08-26T12:00:00.000Z",
        "updatedAt": "2026-08-26T12:00:00.000Z"
      }
    ],
    "pagination": {
      "total": 42,
      "limit": 20,
      "offset": 0,
      "hasMore": true
    }
  }
}

In the console

The same thing done by hand, for anyone comparing the API against the screen they already use.

xRM → Campaigns
/xrm/campaigns