---
description: A quick guide on how to update collection by ID, using the Alphamoon API
---

# Update collection

To update collection via API, get the **collection\_id** of the processed file from:

* [Upload a file](upload-file) endpoint (Base64 or Binary)
* Get collections endpoint
* URL\
  **e.g.** https://workspace.alphamoon.ai/supervision/**223742cc9bca43fd81b2d41b0018e4c7**

&#x20;Use the following endpoint to update the collection:

## Update collection by ID

<mark style="color:green;">`PATCH`</mark> `/api/v0.3/collections/{collection_id}`



**Path parameters**

| Name                                            | Type   | Description              |
| ----------------------------------------------- | ------ | ------------------------ |
| collection-id<mark style="color:red;">\*</mark> | String | The ID of the collection |

{% tabs %}
{% tab title="200: OK Successful Response " %}
```json
{
  "id": "c0da3bd0798e4549a1eb673887258dd3",
  "name": "Invoices_2023.pdf",
  "files": [
    {
      "id": "c4f70139d07e4b7abbd7162ecc34860c",
      "collectionId": "c0da3bd0798e4549a1eb673887258dd3",
      "name": "Invoices_2023.pdf",
      "status": "Needs Review",
      "progress": 100,
      "numberOfPages": 4,
      "createdAt": "2024-01-09T10:20:31Z",
      "updatedAt": "2024-01-09T10:21:32Z",
      "metadata": {}
    }
  ],
  "priority": false,
  "split": false,
  "status": "Needs Review",
  "progress": 100,
  "numberOfPages": 4,
  "processId": "93580f176efb48cda64f25cba74d8ca4",
  "createdAt": "2024-01-09T10:20:31Z",
  "updatedAt": "2024-04-03T15:35:05Z",
  "metadata": {},
  "availableForTraining": true,
  "duplicates": []
}
```
{% endtab %}

{% tab title="400: Bad Request" %}
```json
{
  "action": "The client should not repeat this request without modification.",
  "detail": "Please see the 'errors' field for details.",
  "errors": [
    {
      "location": "body: priority",
      "message": "field required",
      "type": "request_validation_error"
    }
  ],
  "instance": "30e18f59-7c88-4e25-9bed-61863b2abf4b",
  "status": 400,
  "timestamp": "2021-11-09T17:43:36Z",
  "title": "The server cannot process the request due to a client error.",
  "type": "RequestValidationError"
}
```
{% endtab %}

{% tab title="404: Not Found" %}
```json
{
  "action": "The client should not repeat this request without modification.",
  "detail": "Please see the 'errors' field for details.",
  "errors": [
    {
      "location": "body: priority",
      "message": "field required",
      "type": "request_validation_error"
    }
  ],
  "instance": "30e18f59-7c88-4e25-9bed-61863b2abf4b",
  "status": 400,
  "timestamp": "2021-11-09T17:43:36Z",
  "title": "The server cannot process the request due to a client error.",
  "type": "RequestValidationError"
}
```
{% endtab %}

{% tab title="422: Unprocessable Entity Validation Error" %}
```json
{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```
{% endtab %}
{% endtabs %}



**See the example:**

{% tabs %}
{% tab title="API call" %}
```bash
curl -X 'PATCH' \
  'https://workspace.alphamoon.ai/api/v0.3/collections/c0da3bd0798e4549a1eb673887258dd3' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic API_KEY_BASE64_ENCODED' \
  -H 'Content-Type: application/json' \
  -d '{
  "metadata": {}
}'
```
{% endtab %}

{% tab title="Server response" %}
```json
{
  "id": "c0da3bd0798e4549a1eb673887258dd3",
  "name": "Invoices_2023.pdf",
  "files": [
    {
      "id": "c4f70139d07e4b7abbd7162ecc34860c",
      "collectionId": "c0da3bd0798e4549a1eb673887258dd3",
      "name": "Invoices_2023.pdf",
      "status": "Needs Review",
      "progress": 100,
      "numberOfPages": 4,
      "createdAt": "2024-01-09T10:20:31Z",
      "updatedAt": "2024-01-09T10:21:32Z",
      "metadata": {}
    }
  ],
  "priority": false,
  "split": false,
  "status": "Needs Review",
  "progress": 100,
  "numberOfPages": 4,
  "processId": "93580f176efb48cda64f25cba74d8ca4",
  "createdAt": "2024-01-09T10:20:31Z",
  "updatedAt": "2024-04-03T15:35:05Z",
  "metadata": {},
  "availableForTraining": true,
  "duplicates": []
}
```
{% endtab %}
{% endtabs %}



**See next:**
