---
title: "Count objects"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Count objects

Path: CloudRaker Workspace API › Data Objects

`GET /spaces/{spaceId}/objects/{definitionId}/count`

Counts the live objects of a definition in a space. With `view`, only the objects that match the filters of that saved view count. Authorization: requires `space:read` on `:spaceId`. Lacking it gives **404**.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceId` (`countObjects.path.spaceId`; string, required)
- `definitionId` (`countObjects.path.definitionId`; string, required)

## Query parameters

- `view` (`countObjects.query.view`; string, optional) — A saved view id. Only the objects that match its filters count.

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api.cloudraker.com/spaces/<spaceId>/objects/<definitionId>/count' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/spaces/<spaceId>/objects/<definitionId>/count';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/spaces/<spaceId>/objects/<definitionId>/count"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

The count.

#### Example

```json
{
  "count": 0
}
```

- `count` (`countObjects.response.200.count`; number, required) — How many live objects match.

### 404

Missing `space:read`, or an unknown `view` id.

### 422

A view filter names an unknown or archived field.


Source: https://docs.cloudraker.com/workspace/api/data-objects/count-objects/index.md
