curl -X POST https://api.u1.archetypeai.app/v0.5/files/uploads/upl_1mehceg8cn80qsekh46143whrx/parts/checkpoint \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"parts": [
{ "part_number": 1, "part_token": "\"e1b3a4cd87f3...\"" },
{ "part_number": 2, "part_token": "\"a2c8f7b9e081...\"" },
{ "part_number": 3, "part_token": "\"d40fa2c81b9e...\"" }
]
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
upload_id = "upl_1mehceg8cn80qsekh46143whrx"
# part_tokens are the ETag header values returned from each PUT to the
# presigned URL; collect them as you upload parts.
parts = [
{"part_number": 1, "part_token": '"e1b3a4cd87f3..."'},
{"part_number": 2, "part_token": '"a2c8f7b9e081..."'},
{"part_number": 3, "part_token": '"d40fa2c81b9e..."'},
]
response = requests.post(
f"https://api.u1.archetypeai.app/v0.5/files/uploads/{upload_id}/parts/checkpoint",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
},
json={"parts": parts},
)
print(response.json())
const uploadId = "upl_1mehceg8cn80qsekh46143whrx";
const parts = [
{ part_number: 1, part_token: '"e1b3a4cd87f3..."' },
{ part_number: 2, part_token: '"a2c8f7b9e081..."' },
{ part_number: 3, part_token: '"d40fa2c81b9e..."' },
];
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/uploads/${uploadId}/parts/checkpoint`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ parts }),
}
);
console.log(await response.json());
{
"num_checkpointed": 3
}
{
"errors": [
{
"code": "invalid_upload_parts",
"message": "Parts list is empty or contains duplicate or out-of-range part numbers.",
"suggestion": "Send a non-empty list of unique part numbers within [1, num_parts].",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_not_found",
"message": "No upload with the given upload_id was found for the organization.",
"suggestion": "Verify the upload_id and that the upload has not been completed or aborted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_already_completed",
"message": "Upload has already been completed; checkpoint is not allowed.",
"suggestion": "Begin a new upload via /uploads/initiate.",
"error_uid": "err-xxxxxxxx"
}
]
}
Files API
Checkpoint Upload Parts
Persist part_tokens for completed parts so they can be skipped on resume
POST
/
files
/
uploads
/
{upload_id}
/
parts
/
checkpoint
curl -X POST https://api.u1.archetypeai.app/v0.5/files/uploads/upl_1mehceg8cn80qsekh46143whrx/parts/checkpoint \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"parts": [
{ "part_number": 1, "part_token": "\"e1b3a4cd87f3...\"" },
{ "part_number": 2, "part_token": "\"a2c8f7b9e081...\"" },
{ "part_number": 3, "part_token": "\"d40fa2c81b9e...\"" }
]
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
upload_id = "upl_1mehceg8cn80qsekh46143whrx"
# part_tokens are the ETag header values returned from each PUT to the
# presigned URL; collect them as you upload parts.
parts = [
{"part_number": 1, "part_token": '"e1b3a4cd87f3..."'},
{"part_number": 2, "part_token": '"a2c8f7b9e081..."'},
{"part_number": 3, "part_token": '"d40fa2c81b9e..."'},
]
response = requests.post(
f"https://api.u1.archetypeai.app/v0.5/files/uploads/{upload_id}/parts/checkpoint",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
},
json={"parts": parts},
)
print(response.json())
const uploadId = "upl_1mehceg8cn80qsekh46143whrx";
const parts = [
{ part_number: 1, part_token: '"e1b3a4cd87f3..."' },
{ part_number: 2, part_token: '"a2c8f7b9e081..."' },
{ part_number: 3, part_token: '"d40fa2c81b9e..."' },
];
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/uploads/${uploadId}/parts/checkpoint`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ parts }),
}
);
console.log(await response.json());
{
"num_checkpointed": 3
}
{
"errors": [
{
"code": "invalid_upload_parts",
"message": "Parts list is empty or contains duplicate or out-of-range part numbers.",
"suggestion": "Send a non-empty list of unique part numbers within [1, num_parts].",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_not_found",
"message": "No upload with the given upload_id was found for the organization.",
"suggestion": "Verify the upload_id and that the upload has not been completed or aborted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_already_completed",
"message": "Upload has already been completed; checkpoint is not allowed.",
"suggestion": "Begin a new upload via /uploads/initiate.",
"error_uid": "err-xxxxxxxx"
}
]
}
Overview
Checkpoint a subset of an upload’s completed parts. The server stores eachpart_token (the ETag returned from a successful part PUT) so that:
- A later Initiate Upload call with
resume_if_started=trueskips the checkpointed parts and only returns presigned URLs for the remaining ones. - Checkpointed parts do not need to be re-supplied on the Complete Upload call.
Direct-to-cloud file uploads support files up to 250GB.
Path Parameters
string
required
Upload identifier returned by Initiate Upload
Request Body
array
required
Completed parts to checkpoint
Show part properties
Show part properties
integer
required
1-based part index (matches the
part_number returned by Initiate Upload)string
required
The
ETag value returned by the part’s PUT requestResponse
integer
Number of parts that were newly checkpointed (equal to the number of parts in the request after validation)
curl -X POST https://api.u1.archetypeai.app/v0.5/files/uploads/upl_1mehceg8cn80qsekh46143whrx/parts/checkpoint \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"parts": [
{ "part_number": 1, "part_token": "\"e1b3a4cd87f3...\"" },
{ "part_number": 2, "part_token": "\"a2c8f7b9e081...\"" },
{ "part_number": 3, "part_token": "\"d40fa2c81b9e...\"" }
]
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
upload_id = "upl_1mehceg8cn80qsekh46143whrx"
# part_tokens are the ETag header values returned from each PUT to the
# presigned URL; collect them as you upload parts.
parts = [
{"part_number": 1, "part_token": '"e1b3a4cd87f3..."'},
{"part_number": 2, "part_token": '"a2c8f7b9e081..."'},
{"part_number": 3, "part_token": '"d40fa2c81b9e..."'},
]
response = requests.post(
f"https://api.u1.archetypeai.app/v0.5/files/uploads/{upload_id}/parts/checkpoint",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
},
json={"parts": parts},
)
print(response.json())
const uploadId = "upl_1mehceg8cn80qsekh46143whrx";
const parts = [
{ part_number: 1, part_token: '"e1b3a4cd87f3..."' },
{ part_number: 2, part_token: '"a2c8f7b9e081..."' },
{ part_number: 3, part_token: '"d40fa2c81b9e..."' },
];
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/uploads/${uploadId}/parts/checkpoint`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ parts }),
}
);
console.log(await response.json());
{
"num_checkpointed": 3
}
{
"errors": [
{
"code": "invalid_upload_parts",
"message": "Parts list is empty or contains duplicate or out-of-range part numbers.",
"suggestion": "Send a non-empty list of unique part numbers within [1, num_parts].",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_not_found",
"message": "No upload with the given upload_id was found for the organization.",
"suggestion": "Verify the upload_id and that the upload has not been completed or aborted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_already_completed",
"message": "Upload has already been completed; checkpoint is not allowed.",
"suggestion": "Begin a new upload via /uploads/initiate.",
"error_uid": "err-xxxxxxxx"
}
]
}
Was this page helpful?
⌘I