Open a chunked upload
curl --request POST \
--url https://api.usepatchwork.co/v1/files/initialize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"total_bytes": 123
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({total_bytes: 123})
};
fetch('https://api.usepatchwork.co/v1/files/initialize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.usepatchwork.co/v1/files/initialize"
payload = { "total_bytes": 123 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"status": "success",
"data": {
"id": "<string>",
"state": "uploading",
"created_at": "2023-11-07T05:31:56Z",
"media_type": "<string>",
"filename": "<string>",
"size": 123,
"sha256": "<string>",
"segment_size": 123,
"received_segments": [
123
],
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}Files
Open a chunked upload
Start a resumable upload for a file over 10 MB (up to 100 MB). Returns a file_ handle in the uploading state, plus the segment_size to chunk by. Append segments, then finalize.
POST
/
v1
/
files
/
initialize
Open a chunked upload
curl --request POST \
--url https://api.usepatchwork.co/v1/files/initialize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"total_bytes": 123
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({total_bytes: 123})
};
fetch('https://api.usepatchwork.co/v1/files/initialize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.usepatchwork.co/v1/files/initialize"
payload = { "total_bytes": 123 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"status": "success",
"data": {
"id": "<string>",
"state": "uploading",
"created_at": "2023-11-07T05:31:56Z",
"media_type": "<string>",
"filename": "<string>",
"size": 123,
"sha256": "<string>",
"segment_size": 123,
"received_segments": [
123
],
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}Authorizations
Identify accepts a workspace API key (sk_…). Loom accepts either a short-lived session token (direct) or a workspace API key (relay).
Headers
Makes this POST safe to retry. The first call does the work and its response is stored; a retry with the same key returns that stored response with Idempotency-Replayed: true, without charging again. Same key with a different body is rejected. Keys expire after 24 hours.
Maximum string length:
255Body
application/json