# Upload Document for Signing

Before a document can be sent for signing, it must first be **uploaded to Evia Sign**. This step ensures the document is securely stored and available within the signing environment.

## Document Upload URL

<mark style="color:yellow;">`POST`</mark> `/_apis/sign/thumbs/api/v2/requests/document`

This URL is used to upload a PDF file to Evia Sign before initiating any signing process. Once uploaded, the system returns a `documentToken` that must be used when creating a signature request. The document is stored securely and becomes available for further workflow actions such as assigning signatories or setting stamps.

### Authentication

This request **must be authenticated** using a valid `access_token`. You obtain this token through the OAuth flow, and it must be included in the request header.

### **Headers**

| Header          | Valu                  | Description                                                |
| --------------- | --------------------- | ---------------------------------------------------------- |
| `Authorization` | Bearer access\_token  | OAuth 2.0 token obtained during authentication             |
| `Content-Type`  | `multipart/form-data` | Must be set to `multipart/form-data` to allow file upload. |

### Request Body Details

This API expects a **binary PDF file** to be attached using the form field name `File`. You do not need to send any additional parameters in the body.

| Type   | Required | Description                                |
| ------ | -------- | ------------------------------------------ |
| `File` | ✅ Yes    | The document you want to send for signing. |

### Successful Response

A unique `documentToken` will be returned for the uploaded document. This token is used in the `Documents` array when initiating a signature request.

```json
{
"documentToken": "abc123-token"
}
```

**What is `documentToken`?**

This is the unique reference ID for the uploaded file. You do **not** reupload the document during signature creation. Instead, you send this token to link your signature request with the uploaded file.

### Possible Errors and How to Handle Them

<table><thead><tr><th width="226">Status Code</th><th>Error Message</th><th>Explanation</th></tr></thead><tbody><tr><td><code>400</code></td><td>Allowed extensions are PDF, DOC, DOCX</td><td>The uploaded file was not a PDF, or the form field key was incorrect.</td></tr><tr><td><code>401</code></td><td><code>Unauthorized</code></td><td>The <code>access_token</code> was missing or expired</td></tr></tbody></table>
