# Update a document

### URL

<mark style="color:green;">**POST**</mark> `https://api.complycube.com/v1/documents/:id`

Updates the specified document by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

### Headers

<table><thead><tr><th width="240">Name</th><th width="86">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Type</code><mark style="color:red;">*</mark></td><td>string</td><td>The content-type must always be set to <code>application/json</code>.</td></tr><tr><td><code>Authorization</code><mark style="color:red;">*</mark></td><td>string</td><td>The API <strong><code>live</code></strong> or <strong><code>test</code></strong> key.</td></tr></tbody></table>

### Path parameters

<table><thead><tr><th width="240">Name</th><th width="87">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code><mark style="color:red;">*</mark></td><td>string</td><td>The ID of the document.</td></tr></tbody></table>

### Body

<table><thead><tr><th width="241">Name</th><th width="86">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>string</td><td>The type of document. Valid values include:<br>1. <code>passport</code><br>2. <code>driving_license</code><br>3. <code>national_insurance_number</code><br>4. <code>social_security_number</code><br>5. <code>tax_identification_number</code><br>6. <code>national_identity_card</code><br>7. <code>visa</code><br>8. <code>polling_card</code><br>9. <code>residence_permit</code><br>10. <code>birth_certificate</code><br>11. <code>bank_statement</code><br>12. <code>change_of_name</code><br>13. <code>tax_document</code><br>14. <code>company_confirmation_statement</code><br>15. <code>company_annual_accounts</code><br>16. <code>company_statement_of_capital</code><br>17. <code>company_change_of_address</code><br>18. <code>company_incorporation</code><br>19. <code>company_change_of_officers</code><br>20. <code>company_change_of_beneficial_owners</code><br>21. <code>unknown</code><br>22. <code>other</code></td></tr><tr><td><code>classification</code></td><td>string</td><td>The classification or purpose of this document. Valid values include:<br>1. <code>proof_of_identity</code><br>2. <code>source_of_wealth</code><br>3. <code>source_of_funds</code><br>4. <code>proof_of_address</code><br>5. <code>company_filing</code><br>6. <code>other</code></td></tr><tr><td><code>issuingCountry</code></td><td>string</td><td>The document's issuing country. This will be the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">two-letter country ISO code</a>.</td></tr></tbody></table>

### Example request

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.complycube.com/v1/documents/{:documentId} \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          	"type": "passport" 
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const { ComplyCube } = require("@complycube/api");

const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });

const document = await complycube.document.update("DOCUMENT_ID", {
    type: "passport"
});
```

{% endtab %}

{% tab title="Python" %}

```python
from complycube import ComplyCubeClient

cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')

document = cc_api.documents.update('DOCUMENT_ID', type='passport')
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');

$document = $ccapi->documents()->update('DOCUMENT_ID', [
    'type' => 'passport'
]);
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using ComplyCube.Net;
using ComplyCube.Net.Resources.Documents;

var docApi = new DocumentApi(new ComplyCubeClient("<YOUR_API_KEY>"));

var update = new DocumentRequest { type = "passport" };

var document = await docApi.UpdateAsync("DOCUMENT_ID", update);
```

{% endtab %}
{% endtabs %}

### Example responses

{% tabs %}
{% tab title="Success (200)" %}

```json
{
    "id": "5eb158880c19580007310f22",
    "clientId": "5eb1276d96be4a0008713af5",
    "type": "passport",
    "classification": "proof_of_identity",
    "issuingCountry": "GB",
    "createdAt": "2020-01-04T17:24:29.146Z",
    "updatedAt": "2020-01-04T17:13:10.712Z"
}
```

{% endtab %}

{% tab title="Resource Not Found (404)" %}

```json
{
    "type": "resource_not_found",
    "message": "Invalid document id '5eb158880c19580007310f21'"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.complycube.com/documentation/api-reference/core-resources/documents/update-a-document.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
