curl -X POST https://api.u1.archetypeai.app/v0.5/files/uploads/upl_1mehceg8cn80qsekh46143whrx/complete \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"parts": [
{ "part_number": 4, "part_token": "\"f912ab83e0d1...\"" },
{ "part_number": 5, "part_token": "\"203fa182b97c...\"" }
]
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
upload_id = "upl_1mehceg8cn80qsekh46143whrx"
# Only include parts that were NOT previously checkpointed
remaining_parts = [
{"part_number": 4, "part_token": '"f912ab83e0d1..."'},
{"part_number": 5, "part_token": '"203fa182b97c..."'},
]
response = requests.post(
f"https://api.u1.archetypeai.app/v0.5/files/uploads/{upload_id}/complete",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
},
json={"parts": remaining_parts},
)
result = response.json()
print(f"file_uid: {result['file_uid']} status: {result['file_status']}")
const uploadId = "upl_1mehceg8cn80qsekh46143whrx";
const remainingParts = [
{ part_number: 4, part_token: '"f912ab83e0d1..."' },
{ part_number: 5, part_token: '"203fa182b97c..."' },
];
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/uploads/${uploadId}/complete`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ parts: remainingParts }),
}
);
const result = await response.json();
console.log(`file_uid: ${result.file_uid} status: ${result.file_status}`);
{
"file_uid": "fil_5hx819ysp38n2rt1f5fv0wsxgh",
"file_name": "training-data.parquet",
"num_bytes": 1073741824,
"file_status": "Registered",
"file_attributes": {
"metadata_status": "not_extracted"
}
}
{
"errors": [
{
"code": "size_mismatch",
"message": "Combined size of submitted parts does not match the upload's declared num_bytes.",
"suggestion": "Verify each part_token corresponds to the matching part_number and that all parts were uploaded.",
"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 aborted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_already_completed",
"message": "Upload has already been completed.",
"suggestion": "Use the file_id from the original completion response to operate on the file.",
"error_uid": "err-xxxxxxxx"
}
]
}
Files API
Complete Upload
Finalize a direct-to-cloud upload after all parts have been uploaded
POST
/
files
/
uploads
/
{upload_id}
/
complete
curl -X POST https://api.u1.archetypeai.app/v0.5/files/uploads/upl_1mehceg8cn80qsekh46143whrx/complete \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"parts": [
{ "part_number": 4, "part_token": "\"f912ab83e0d1...\"" },
{ "part_number": 5, "part_token": "\"203fa182b97c...\"" }
]
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
upload_id = "upl_1mehceg8cn80qsekh46143whrx"
# Only include parts that were NOT previously checkpointed
remaining_parts = [
{"part_number": 4, "part_token": '"f912ab83e0d1..."'},
{"part_number": 5, "part_token": '"203fa182b97c..."'},
]
response = requests.post(
f"https://api.u1.archetypeai.app/v0.5/files/uploads/{upload_id}/complete",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
},
json={"parts": remaining_parts},
)
result = response.json()
print(f"file_uid: {result['file_uid']} status: {result['file_status']}")
const uploadId = "upl_1mehceg8cn80qsekh46143whrx";
const remainingParts = [
{ part_number: 4, part_token: '"f912ab83e0d1..."' },
{ part_number: 5, part_token: '"203fa182b97c..."' },
];
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/uploads/${uploadId}/complete`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ parts: remainingParts }),
}
);
const result = await response.json();
console.log(`file_uid: ${result.file_uid} status: ${result.file_status}`);
{
"file_uid": "fil_5hx819ysp38n2rt1f5fv0wsxgh",
"file_name": "training-data.parquet",
"num_bytes": 1073741824,
"file_status": "Registered",
"file_attributes": {
"metadata_status": "not_extracted"
}
}
{
"errors": [
{
"code": "size_mismatch",
"message": "Combined size of submitted parts does not match the upload's declared num_bytes.",
"suggestion": "Verify each part_token corresponds to the matching part_number and that all parts were uploaded.",
"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 aborted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_already_completed",
"message": "Upload has already been completed.",
"suggestion": "Use the file_id from the original completion response to operate on the file.",
"error_uid": "err-xxxxxxxx"
}
]
}
Requires version 1.1.5 or later of the Archetype platform.
Overview
Finalize a direct-to-cloud upload after the client hasPUT every part to its presigned URL. The server validates the supplied part_tokens, assembles the final file, and registers it with the organization.
Parts already submitted via Checkpoint Upload Parts do not need to be repeated here — only supply tokens for parts not yet checkpointed.
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 that have not already been checkpointed. Pass an empty array when every part of the upload has been checkpointed.
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 request, including its surrounding quotesstring
Optional whole-file checksum, base64-encoded. When provided, the server queries the storage backend for the checksum it computed over the full object and compares; a mismatch marks the file as corrupt and returns an error. Omit to skip verification entirely.The encoding and byte length must match the algorithm returned by Initiate Upload (e.g.
crc32c → 4 raw bytes → 8 base64 characters with = padding). Sending a checksum when integrity_algorithm: none is returned is an error.Response
string
Internal unique identifier of the completed file
string
Name of the completed file
integer
Total size of the completed file in bytes
string
Lifecycle status of the file. After a successful upload, the status is
Registered. Other values are: Unknown, Uploading, Ingested, Deleting, Deleted, and Corrupt.The format of the status string returned for direct-to-cloud uploads is different from the
file_status string returned by the Get File Metadata endpoint.object
Type-specific attributes for the file. Shape depends on the file type — see Get File Metadata for the variants.
curl -X POST https://api.u1.archetypeai.app/v0.5/files/uploads/upl_1mehceg8cn80qsekh46143whrx/complete \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"parts": [
{ "part_number": 4, "part_token": "\"f912ab83e0d1...\"" },
{ "part_number": 5, "part_token": "\"203fa182b97c...\"" }
]
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
upload_id = "upl_1mehceg8cn80qsekh46143whrx"
# Only include parts that were NOT previously checkpointed
remaining_parts = [
{"part_number": 4, "part_token": '"f912ab83e0d1..."'},
{"part_number": 5, "part_token": '"203fa182b97c..."'},
]
response = requests.post(
f"https://api.u1.archetypeai.app/v0.5/files/uploads/{upload_id}/complete",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
},
json={"parts": remaining_parts},
)
result = response.json()
print(f"file_uid: {result['file_uid']} status: {result['file_status']}")
const uploadId = "upl_1mehceg8cn80qsekh46143whrx";
const remainingParts = [
{ part_number: 4, part_token: '"f912ab83e0d1..."' },
{ part_number: 5, part_token: '"203fa182b97c..."' },
];
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/uploads/${uploadId}/complete`,
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ parts: remainingParts }),
}
);
const result = await response.json();
console.log(`file_uid: ${result.file_uid} status: ${result.file_status}`);
{
"file_uid": "fil_5hx819ysp38n2rt1f5fv0wsxgh",
"file_name": "training-data.parquet",
"num_bytes": 1073741824,
"file_status": "Registered",
"file_attributes": {
"metadata_status": "not_extracted"
}
}
{
"errors": [
{
"code": "size_mismatch",
"message": "Combined size of submitted parts does not match the upload's declared num_bytes.",
"suggestion": "Verify each part_token corresponds to the matching part_number and that all parts were uploaded.",
"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 aborted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "upload_already_completed",
"message": "Upload has already been completed.",
"suggestion": "Use the file_id from the original completion response to operate on the file.",
"error_uid": "err-xxxxxxxx"
}
]
}
Was this page helpful?