Skip to content
POST /file/upload-request/{id}/file

Step one of adding a file: say what is about to be sent (`{ filename, size_bytes, mime? }`) and receive the slot id (`file.file_id`) to upload to and, at any moment, to cancel by. Refused unless the request is open **before its cutoff** (ten minutes after it was made; nothing ever moves it), has room (`409` `upload_request_full`), the size is within the request’s per-file limit (`413`) and the type within `accept` (`415`). Nothing is stored yet, and the slot is not a file: it appears in no list.

Path Parameters

idstring
required·

Request id (fupr_…).

Request Body

filenamestring
mimestring
size_bytesinteger

Response Body

fileobject
file_idstring
filenamestring
mimestring,null
size_bytesinteger,null
statestring
Possible values:
uploadingstagedreadystalled
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"}'
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);
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())