# Reserve a place for a file in an upload request

> Source: https://elaichi.ai/docs/api-reference/files/file/reservefileupload/

`POST /file/upload-request/{id}/file`

Resource: **File** · API: **Files**

## Path parameters

- **`id`** _(string, required)_
  Request id (`fupr_…`).

## Request body

- **`filename`** _(string)_
- **`size_bytes`** _(integer)_
- **`mime`** _(string)_

## Response body

- **`file`** _(object)_
  - **`file_id`** _(string)_
  - **`filename`** _(string)_
  - **`size_bytes`** _(integer,null)_
  - **`mime`** _(string,null)_
  - **`state`** _(string)_
    Allowed: `uploading`, `staged`, `ready`, `stalled`

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/file/upload-request/<id>/file' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"filename":"your_filename","size_bytes":0,"mime":"your_mime"}'
```

### JavaScript

```javascript
const body = {
  "filename": "your_filename",
  "size_bytes": 0,
  "mime": "your_mime"
};

const response = await fetch('https://api.elaichi.ai/file/upload-request/<id>/file', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/file/upload-request/<id>/file"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "filename": "your_filename",
    "size_bytes": 0,
    "mime": "your_mime"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```
