# File Upload

## File Upload Request

```text
POST /api/file/upload
Content-Type: multipart/form-data
```

## Form Content

| Parameter | Type | Required | Description |
|  --- | --- | --- | --- |
| meta | json | Yes | File metadata |
| file | file | Yes | File (maximum 10 MiB) |


The `meta` field is in JSON format with the following content:

| Key | Type | Required | Description |
|  --- | --- | --- | --- |
| name | String | Yes | File name (maximum 128 characters) |
| sha256 | String | Yes | SHA256 hash of the file (hex string format) |


The signature method for file uploads differs from other text-based APIs. When calculating the signature, the body used is the meta JSON string.
The final signature string looks like:

```text
Request path\n
Request timestamp\n
Request random string (nonce)\n
Merchant ID\n
Request meta JSON string
```

Except for the onboarding API, other APIs will validate the relationship between the file ID and the merchant.

br
## Response

| Parameter | Type | Required | Description |
|  --- | --- | --- | --- |
| file_id | Integer | Yes | File ID |


The response signing/verification method is consistent with other APIs.