---
title: "Count objects per definition in a space"
---

> 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 per definition in a space

Path: CloudRaker Workspace API › Data Objects

`GET /spaces/{spaceId}/objects`

Groups a space's live (non-deleted) objects by definition — one row per definition that has at least one object in the space (backs the Data tab's type list). Authorization: requires `space:read` on `:spaceId` — a caller who lacks it gets **404** (leak-guard, not 403). Definition ids are not joined against the definitions catalog; archived definitions with leftover objects still appear. Returns `{ counts: [{ definitionId, count }] }`.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceId` (`countSpaceObjects.path.spaceId`; string, required)

## Code samples

### cURL

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

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/spaces/<spaceId>/objects';
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"

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

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

print(response.text)
```

## Responses

### 200

Per-definition object counts.

#### Example

```json
{
  "counts": [
    {
      "definitionId": "string",
      "count": 0
    }
  ]
}
```

- `counts` (`countSpaceObjects.response.200.counts`; array<object>, required)
  - `definitionId` (`countSpaceObjects.response.200.counts.definitionId`; string, required)
  - `count` (`countSpaceObjects.response.200.counts.count`; number, required) — Live (non-deleted) objects in the space.

### 404

Missing `space:read`.


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