# Ask a person for files

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

`POST /file/upload-request`

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

## Request body

- **`purpose`** _(string)_
  A short sentence the person reads on the page.
- **`max_files`** _(integer)_
- **`accept`** _(array<string>)_
- **`max_file_bytes`** _(integer)_

## Response body

- **`request_id`** _(string)_
  Request id (`fupr_…`).
- **`status`** _(string)_
  `open`: waiting for the person (files may be added, removed, confirmed). `confirmed`: they approved; the staged files are now theirs. `expired`: the deadline passed unconfirmed with nothing still uploading. A request whose upload STARTED before the deadline stays open until that upload finishes, and each finished file keeps it open for at least five more minutes, so someone mid-upload is never told it expired.
  Allowed: `open`, `confirmed`, `expired`
- **`purpose`** _(string)_
  What the files are for, as the asker said it.
- **`requester`** _(string)_
  Who is asking: the connected app’s name, or “Elaichi assistant”.
- **`limits`** _(object)_
  - **`max_files`** _(integer)_
    Files at most. 10.
  - **`max_file_bytes`** _(integer)_
    The most one file may be. 95 MiB, or the request’s lower setting.
  - **`max_total_bytes`** _(integer)_
    The most the whole request may hold. 250 MiB.
  - **`accept`** _(array,null)_
    Allowed media types (`image/*`, `application/pdf`) and extensions (`.csv`); null means anything.
- **`created_at`** _(string)_
- **`add_files_until`** _(string)_
  Ten minutes after creation, fixed. No new file can be reserved after it; the person can still send the files they added.
- **`expires_at`** _(string)_
  The last moment the person can confirm (Send). Starts at `add_files_until`; it moves out when an upload finishes or an upload that was running ends without landing, never past 35 minutes after creation.
- **`upload_page_url`** _(string)_
  The console page. Carries no secret: only the signed-in person who made the request can use it.
- **`files`** _(array<object>)_
  At most `limits.max_files`.
  - **`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' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"purpose":"your_purpose","max_files":0,"accept":[],"max_file_bytes":0}'
```

### JavaScript

```javascript
const body = {
  "purpose": "your_purpose",
  "max_files": 0,
  "accept": [],
  "max_file_bytes": 0
};

const response = await fetch('https://api.elaichi.ai/file/upload-request', {
  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"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "purpose": "your_purpose",
    "max_files": 0,
    "accept": [],
    "max_file_bytes": 0
}

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