[Tenjin API Reference](https://api-docs.tenjin.com/llms.txt) › [Campaign Management API](https://api-docs.tenjin.com/campaign-management-api.md) › List ad accounts

- Campaign Management API OpenAPI spec: https://api-docs.tenjin.com/openapi/campaign-management-api.json

# List ad accounts

- **Method:** `GET`
- **Path:** `/v2/ad_accounts`
- **Operation ID:** `get_ad_accounts`
- **Tags:** Ad Accounts

## Effective servers

- `https://api.tenjin.com`

## Authentication

- **Bearer**: HTTP bearer (`JWT`)

  Generate an access token on the [Access Tokens](https://dashboard.tenjin.com/dashboard/access_tokens) page of the Tenjin dashboard and send it as `Authorization: Bearer <access token>`. [API access tokens](https://tenjin.com/docs/api-access-tokens/) explains them.

## Query parameters

- **`channel_id`**: `integer`

  Keep only ad accounts of this channel
- **`query`**: `string`

  Search ad accounts by name
- **`page`**: `integer`, default: `1`

  Page of results to fetch.
- **`per_page`**: `integer`, default: `25`, minimum: `0`, maximum: `1000`

  Number of results to return per page.

## Responses

### 200 Ad accounts

**Headers:**

- **`Link`**

  URLs of the first, previous, next and last pages (RFC 8288); sent only when the list has more than one page

  `string`
- **`Total`**

  Number of items on all pages

  `integer`
- **`Per-Page`**

  Number of items per page

  `integer`

**Content type:** `application/json`

schema: `AdAccountListDocument`

- **`data` (required)**: `array`

  **Items:**

  schema: `AdAccountResource`
  - **`attributes` (required)**: `object`
    - **`channel_id` (required)**: `integer`

      Id of the ad account's channel
    - **`external_id` (required)**: `string | null`

      Id of the account on the ad network
    - **`name` (required)**: `string`

      Name of the ad account
  - **`id` (required)**: `string`, format: `uuid`
  - **`type` (required)**: `string`, possible values: `"ad_account"`
- **`links` (required)**: `object`, schema: `Links`
  - **`self` (required)**: `string`, format: `uri`

    URL of this request
  - **`first`**: `string`, format: `uri`

    URL of the first page of a list
  - **`last`**: `string`, format: `uri`

    URL of the last page of a list
  - **`next`**: `string`, format: `uri`

    URL of the next page of a list
  - **`prev`**: `string`, format: `uri`

    URL of the previous page of a list
- **`meta` (required)**: `object`, schema: `PageMeta`
  - **`count` (required)**: `integer`

    Number of items on all pages
  - **`per_page` (required)**: `integer`

    Number of items per page

**Example: Ad accounts**

```json
{
  "data": [
    {
      "id": "6e3fbfa6-27cc-45f2-af3f-5c9ead45280e",
      "type": "ad_account",
      "attributes": {
        "name": "Facebook Account",
        "channel_id": 3,
        "external_id": "444509211788999"
      }
    },
    {
      "id": "6d16d36f-a074-4acd-bdf3-2d1180295b79",
      "type": "ad_account",
      "attributes": {
        "name": "Chartboost Account",
        "channel_id": 7,
        "external_id": null
      }
    },
    {
      "id": "333c57b6-c022-496a-bd27-5d8d7caa8cae",
      "type": "ad_account",
      "attributes": {
        "name": "Tapjoy Account",
        "channel_id": 1,
        "external_id": null
      }
    }
  ],
  "links": {
    "self": "https://api.tenjin.com/v2/ad_accounts"
  },
  "meta": {
    "count": 3,
    "per_page": 25
  }
}
```

### 400, 401, 403, 498

- `400` A param is missing or invalid, a record is not found, or the request cannot be served
- `401` Missing or invalid credentials, or no access to the requested data
- `403` Invalid token, or the user's role does not allow the request
- `498` Expired token, or a token with an invalid signature

**Content type:** `application/json`

schema: `Error`

- **`error` (required)**: `string`

  What went wrong

**Example:**

```json
{
  "error": ""
}
```

## Schemas

- `AdAccountListDocument` — shown above.
- `Error` — shown above.
- `Links` — shown above.
- `PageMeta` — shown above.
- `AdAccountResource` — shown above.
