> ## Documentation Index
> Fetch the complete documentation index at: https://sonar-cf3aeac7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Count view results

> Get the total number of tokens that match each Pulse view, to build page controls. Takes the same body as Query views.

Returns, for each view, the **total number of tokens that match** its model, filters and scope. `limit` and `offset` are ignored for the count. Use it next to [`POST /pulse/views`](https://sonar-cf3aeac7.mintlify.site/pulse/rest-views) to show page numbers or a "showing 1 to 25 of N" label.

The body is exactly the same as for `POST /pulse/views`, so you can send one body to both endpoints. It is validated the same way and returns the same errors.

> [!WARNING]
>
> This endpoint returns **raw JSON with no `{ "status", "data" }` envelope**. Errors still use the standard [error envelope](https://sonar-cf3aeac7.mintlify.site/concepts/responses-and-errors.md).

## Body

**views** `object[]`

The views to count, 1 to 10, with unique names. If omitted, the server counts the default `new`, `bonding` and `bonded` views. Each view has the same properties as in [Query views](https://sonar-cf3aeac7.mintlify.site/pulse/rest-views.md#body).

**view properties**

**name** `string` *required*

View name, 1 to 64 characters. Used as the key in the response.

**model** `string`

`new`, `trending`, `bonding` or `bonded`.

**chainId** `string[]`

Chains in the `evm:<id>` form. Overrides the top-level `chainId`.

**poolTypes** `string[]`

Pool type ids for the token's top pool. Overrides the top-level `poolTypes`.

**sortBy** `string`

Validated, but does not change the count.

**sortOrder** `string`

`asc` or `desc`. Does not change the count.

**limit** `integer`

Validated (1 to 100), but ignored for the count.

**offset** `integer`

Validated (0 to 500), but ignored for the count.

**filters** `object`

Filters keyed by snake\_case field name. See [Filters and sortable fields](https://sonar-cf3aeac7.mintlify.site/pulse/filters-and-fields.md).

**addressToExclude** `string | string[]`

Token addresses to leave out of the count. At most 100.

**chainId** `string[]`

Default chains for every view without its own `chainId`, in the `evm:<id>` form.

**poolTypes** `string[]`

Default pool types for every view without its own `poolTypes`.

The fields `model` (top level), `assetMode`, `filterQuotes`, `excludeLPTokens` and `compressed` are accepted for compatibility and have no effect.

## Response

`200 OK` with `content-type: application/json; charset=utf-8`. One key per view, in request order.

**\<view name>** `object`

**properties**

**pagination** `integer`

Total number of tokens matching the view, ignoring `limit` and `offset`.

Counts always come from the database and are cached for about 30 seconds per view definition. They can differ slightly from what the live engine returns on the first page of `/pulse/views`.

> [!NOTE]
>
> The count can be larger than you can page to. `offset` stops at 500 and `limit` at 100, so the deepest reachable position is 600. If `pagination` is 1,250, positions 601 to 1,250 cannot be fetched; narrow the view with filters instead.

## Paging recipe

1. Send your body to `/pulse/views/pagination` to get the total for each view.
2. Work out the number of pages: `min(total, 600)` divided by your page size, rounded up.
3. For page `p` (starting at 0), send the same body to [`/pulse/views`](https://sonar-cf3aeac7.mintlify.site/pulse/rest-views) with `offset` set to `p × limit`. Keep `offset` at 500 or below.

```javascript theme={null}
const URL = 'https://api.example.com/api/v1/pulse';
const pageSize = 25;

const view = { name: 'hot', chainId: ['evm:8453'], sortBy: 'volume_1h' };

const post = async (path, body) => {
  const response = await fetch(`${URL}${path}`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(body),
  });
  const json = await response.json();
  if (!response.ok) throw new Error(json.message);
  return json;
};

const counts = await post('/views/pagination', { views: [view] });
const total = counts.hot.pagination;
const pages = Math.ceil(Math.min(total, 600) / pageSize);

async function getPage(p) {
  const offset = p * pageSize;
  const limit = Math.min(pageSize, 600 - offset);
  const result = await post('/views', { views: [{ ...view, limit, offset }] });
  return result.hot.data;
}
```

```bash cURL theme={null}
curl -X POST https://api.example.com/api/v1/pulse/views/pagination \
  -H "Content-Type: application/json" \
  -d '{
    "views": [
      { "name": "hot", "chainId": ["evm:8453"], "sortBy": "volume_1h", "limit": 25, "offset": 50 }
    ]
  }'
```

```javascript JavaScript theme={null}
const response = await fetch('https://api.example.com/api/v1/pulse/views/pagination', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    views: [{ name: 'hot', chainId: ['evm:8453'], sortBy: 'volume_1h', limit: 25, offset: 50 }],
  }),
});

const counts = await response.json();
console.log(counts.hot.pagination); // 1250
```

```json 200 theme={null}
{
  "hot": { "pagination": 1250 }
}
```

```json 200 default board theme={null}
{
  "new": { "pagination": 412 },
  "bonding": { "pagination": 87 },
  "bonded": { "pagination": 2306 }
}
```

```json 400 theme={null}
{
  "status": "error",
  "statusCode": 400,
  "code": "INVALID_PARAMETERS",
  "message": "views.0.sources.0: unknown launchpad pumpfun",
  "details": ["views.0.sources.0: unknown launchpad pumpfun"]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.