> For the complete documentation index, see [llms.txt](https://manual.personr.co/api-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.personr.co/api-documentation/entities/uploading-documents-to-an-entity.md).

# Uploading documents to an entity

Instead of using a verification link, use this endpoint to upload documents directly via API.

This endpoint allows you to upload entity documents directly via API. You may want to do this to fully customise the look and feel of the verification process within your website or application.

{% hint style="warning" %}
Note: You don't need to use this endpoint if you're verifying entities using a verification link.
{% endhint %}

Each call can only receive one document. Make sure to send the necessary data in the docSubType parameter.

***

## Upload documents to your applicant

<mark style="color:green;">`POST`</mark> `/api-entity-document-upload`

Upload a document to an entity, ready for processing.

| Name          | Value                 |
| ------------- | --------------------- |
| Content-Type  | `multipart/form-data` |
| Authorization | `Bearer YOUR_TOKEN`   |

**Body**

<table><thead><tr><th>Name</th><th width="165">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>applicantId</code></td><td>string</td><td>Unique applicantId generated on applicant creation <mark style="color:red;">(required)</mark></td></tr><tr><td><code>docSubType</code></td><td>string</td><td>The corporate document type - see next page for the different types.<mark style="color:orange;">(optional)</mark></td></tr><tr><td><code>docFile</code></td><td>string</td><td>An accessible URL representing the file being uploaded.<br><mark style="color:red;">(required)</mark></td></tr></tbody></table>

#### Request

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

```sh
curl -X POST https://enterprise.personr.co/api/1.1/wf/api-entity-document-upload \
    -H "Content-Type: multipart/form-data" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -F "applicantId=4242424242424x424242424242424242" \
    -F "docSubType=Certificate of incorporation" \
    -F "docFile=https://your_document_url.pdf"
```

{% endtab %}

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

```javascript
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');

var formData = new FormData();

formData.append('applicantId', '4242424242424x424242424242424242');
formData.append('docSubType', 'Certificate of incorporation');
formData.append('docFile', fs.createReadStream('/path/to/your/file.pdf'), 'your_document.pdf');

var config = {
  method: 'post',
  url: 'https://enterprise.personr.co/api/1.1/wf/api-entity-document-upload',
  headers: { 
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    ...formData.getHeaders(), 
  },
  data: formData,
  maxBodyLength: 'Infinity',
  maxContentLength: 'Infinity'
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const url = "https://enterprise.personr.co/api/1.1/wf/api-entity-document-upload";

const payload = {
    applicantId: "4242424242424x424242424242424242",
    docSubType: "Certificate of incorporation",
    docFile: {
        filename: "/path/to/your/file.pdf",
    }
};

fetch(url, {
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_TOKEN"
    },
    body: JSON.stringify(payload)
})
.then(response => response.text())
.then(text => console.log(text))
.catch(error => console.error('Error:', error));
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("https://enterprise.personr.co/api/1.1/wf/api-entity-document-upload")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer YOUR_TOKEN"
request.body = "{\r\n\t\"applicantId\": \"4242424242424x424242424242424242\",\r\n\t\"docSubType\": \"Certificate of incorporation\",\r\n\t\"docFile\": {\r\n\"filename\": \"/path/to/your/file.pdf\"\r\n  }\r\n}"

response = https.request(request)
puts response.read_body
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://enterprise.personr.co/api/1.1/wf/api-entity-document-upload"

payload = "{\r\n\t\"applicantId\": \"4242424242424x424242424242424242\",\r\n\t\"docSubType\": \"Certificate of incorporation\",\r\n\t\"docFile\": {\r\n\"filename\": \"/path/to/your/file.pdf\"\r\n  }\r\n}"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_TOKEN'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}
{% endtabs %}

**Response**

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

```json
{
    "applicantId": "4242424242424x424242424242424242",
    "documentSubType": "Certificate of incorporation"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "statusCode": 400,
    "message": "Error: invalid applicantId"
}
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
Once all required documents have been uploaded, head to[Requesting to start the verification process](/api-documentation/entities/requesting-to-start-the-verification-process.md)to confirm everything has been uploaded, and to start the verification check.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://manual.personr.co/api-documentation/entities/uploading-documents-to-an-entity.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
