# Apply a bulk action to a set of documents.

`POST /api/plugins/docs/documents/bulk`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [BulkDocumentActionDTO](https://sourcey-gauzy.pages.dev/api-reference/models/bulkdocumentactiondto/index.md)

- `ids` (required)
  Type: array
  
  Target document ids (≤200)
  
  Items:
    Type: string

- `action` (required)
  Type: string
  
  enum: ["ARCHIVE","UNARCHIVE","SET_CATEGORIES","ADD_TAGS","REMOVE_TAGS","KNOWLEDGE_IMPORT","KNOWLEDGE_EXCLUDE","MOVE","DELETE","REVIEW_APPROVE","REVIEW_REJECT"]

- `categoryIds` (optional)
  Type: array
  
  Items:
    Type: string

- `tagIds` (optional)
  Type: array
  
  Items:
    Type: string

- `parentId` (optional)
  Type: string; nullable

- `reason` (optional)
  Type: string

Responses:

- 200: Per-id bulk results returned.

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/plugins/docs/documents/bulk' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "ids": [
    "string"
  ],
  "action": "ARCHIVE",
  "categoryIds": [
    "string"
  ],
  "tagIds": [
    "string"
  ],
  "parentId": "string",
  "reason": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "ids": [
    "string"
  ],
  "action": "ARCHIVE",
  "categoryIds": [
    "string"
  ],
  "tagIds": [
    "string"
  ],
  "parentId": "string",
  "reason": "string"
}`;

const response = await fetch('http://localhost:3000/api/plugins/docs/documents/bulk', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "ids": [
    "string"
  ],
  "action": "ARCHIVE",
  "categoryIds": [
    "string"
  ],
  "tagIds": [
    "string"
  ],
  "parentId": "string",
  "reason": "string"
}'''

response = requests.post(
    'http://localhost:3000/api/plugins/docs/documents/bulk',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
