# POST /api/v1/entity-tags/batch

> Batch fetch tags for multiple entities

- **Tag:** tags
- **Operation ID:** `get_entity_tags_batch_api_v1_entity_tags_batch_post`

## Description

Fetch tags for many entities of the same type in a single request. Returns a mapping of entity id -> its tags; entities with no tags are omitted. Replaces per-row GET /entity-tags/{model_type}/{model_id} calls to avoid request fan-out (and the edge rate limiting it causes).

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `BulkEntityTagsRequest`

- `model_type` (string · required) — Type of entity (transaction, invoice, bill, etc.)
- `model_ids` (array · string · required) — Entity UUIDs to fetch tags for (typically the visible page).

## Responses

### 201 — Successful Response

Schema: `BulkEntityTagsResponse`

- `items` (object) — Mapping of entity UUID -> tags attached to it. Entities with no tags are omitted.

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/entity-tags/batch' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "model_type": "string",
  "model_ids": []
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/entity-tags/batch', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "model_type": "string",
  "model_ids": []
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "model_type": "string",
  "model_ids": []
}

response = httpx.post("https://api.ondayzero.com/api/v1/entity-tags/batch", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/tags/get-entity-tags-batch
- OpenAPI slice: https://www.ondayzero.com/docs/reference/tags/get-entity-tags-batch/openapi.json
- Other endpoints in **tags**: https://www.ondayzero.com/docs/reference/tags
