Skip to main content
GET
/
ads
JavaScript
import Whop from '@whop/sdk';

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

// Automatically fetches more pages as needed.
for await (const adListResponse of client.ads.list()) {
  console.log(adListResponse.id);
}
{
  "data": [
    {
      "id": "ad_xxxxxxxxxxxxxxx",
      "title": "<string>",
      "created_at": "2023-12-01T05:00:00.401Z",
      "updated_at": "2023-12-01T05:00:00.401Z",
      "ad_group": {
        "id": "adgrp_xxxxxxxxxxxx"
      },
      "ad_campaign": {
        "id": "adcamp_xxxxxxxxxxx"
      }
    }
  ],
  "page_info": {
    "end_cursor": "<string>",
    "start_cursor": "<string>",
    "has_next_page": true,
    "has_previous_page": true
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.whop.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************

Query Parameters

after
string | null

Returns the elements in the list that come after the specified cursor.

before
string | null

Returns the elements in the list that come before the specified cursor.

first
integer | null

Returns the first n elements from the list.

Example:

42

last
integer | null

Returns the last n elements from the list.

Example:

42

ad_group_id
string | null

Filter by ad group. Provide exactly one of ad_group_id, campaign_id, or company_id.

campaign_id
string | null

Filter by campaign. Provide exactly one of ad_group_id, campaign_id, or company_id.

company_id
string | null

Filter by company. Provide exactly one of ad_group_id, campaign_id, or company_id.

Example:

"biz_xxxxxxxxxxxxxx"

created_after
string<date-time> | null

Only return ads created after this timestamp.

Example:

"2023-12-01T05:00:00.401Z"

created_before
string<date-time> | null

Only return ads created before this timestamp.

Example:

"2023-12-01T05:00:00.401Z"

order_by
enum<string> | null

Server-side sort column. When provided, sorts globally across all ads (not just the current page).

Available options:
spend,
roas
order_direction
enum<string> | null

Sort direction. Defaults to desc.

Available options:
asc,
desc
stats_from
string<date-time> | null

Start of the stats date range used when order_by is a stats column.

Example:

"2023-12-01T05:00:00.401Z"

stats_to
string<date-time> | null

End of the stats date range used when order_by is a stats column.

Example:

"2023-12-01T05:00:00.401Z"

status
enum<string> | null

Filter by status.

Available options:
active,
paused,
inactive,
in_review,
rejected,
flagged

Response

A successful response

The connection type for ExternalAd.

data
object[]
required

A list of nodes.

page_info
object
required

Information to aid in pagination.