Skip to main content
GET
/
accounts
/
{account_id}
/
campaigns
JavaScript
import Surge from '@surgeapi/node';

const client = new Surge({
  apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const campaign of client.campaigns.list('acct_01j9a43avnfqzbjfch6pygv1td')) {
  console.log(campaign.id);
}
{
  "data": [
    {
      "consent_flow": "When customers bring in their car for service, they will fill out this web form for intake: https://fastauto.shop/bp108c In it they can choose to opt in to text message notifications. If they choose to opt in, we will send them notifications to let them know if our mechanics find issues and once the car is ready to go, as well as links to invoices and to leave us feedback.",
      "description": "This phone number will send auto maintenance notifications to end users that have opted in. It will also be used for responding to customer inquiries and sending some marketing offers.",
      "id": "cpn_01k0qczvhbet4azgn5xm2ccfst",
      "includes": [
        "links",
        "phone_numbers"
      ],
      "link_sample": "https://l.fastauto.shop/s034ij",
      "message_samples": [
        "You are now opted in to receive repair notifications from DT Precision Auto. Frequency varies. Msg&data rates apply. Reply STOP to opt out.",
        "You're lucky that hundred shot of NOS didn't blow the welds on the intake!",
        "Your car is ready to go. See your invoice here: https://l.fastauto.shop/s034ij"
      ],
      "privacy_policy_url": "https://fastauto.shop/sms-privacy",
      "status": "pending",
      "terms_and_conditions_url": "https://fastauto.shop/terms-and-conditions",
      "use_cases": [
        "account_notification",
        "customer_care",
        "marketing"
      ],
      "volume": "high"
    }
  ],
  "pagination": {
    "next_cursor": "g3QAAAABZAACaWRtAAAAGnBuXzAxamtzY2s5eDdkeW0wZnBxZjdjYmRyeQ==",
    "previous_cursor": null
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

account_id
string
required

The account ID to list campaigns for.

Example:

"acct_01j9a43avnfqzbjfch6pygv1td"

Query Parameters

after
string

Cursor for forward pagination. Use the next_cursor from a previous response.

before
string

Cursor for backward pagination. Use the previous_cursor from a previous response.

Response

List of campaigns

A paginated list of campaigns

data
Campaign · object[]
required

The list of campaigns

pagination
Pagination · object
required

Cursor-based pagination information

Example:
{
"next_cursor": "g3QAAAABZAACaWRtAAAAGnBuXzAxamtzY2s5eDdkeW0wZnBxZjdjYmRyeQ==",
"previous_cursor": null
}