curl -X POST https://api.u1.archetypeai.app/v0.5/files \
-H "Authorization: Bearer $ATAI_API_KEY" \
-F "file=@/path/to/local/file.csv"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
with open("/path/to/local/file.csv", "rb") as fh:
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/files",
headers={"Authorization": f"Bearer {api_key}"},
files={"file": ("file.csv", fh, "text/csv")},
)
result = response.json()
if result.get("is_valid"):
print(f"Uploaded: {result['file_id']}")
else:
print(f"Errors: {result.get('errors')}")
import fs from "node:fs";
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("/path/to/local/file.csv")]), "file.csv");
const response = await fetch("https://api.u1.archetypeai.app/v0.5/files", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
},
body: form,
});
const result = await response.json();
if (result.is_valid) {
console.log(`Uploaded: ${result.file_id}`);
} else {
console.error("Errors:", result.errors);
}
{
"is_valid": true,
"file_id": "file-abc123",
"file_uid": "8f2c1e5a-7b3d-4d9e-9c1a-2f5b7d8e4a6c"
}
{
"errors": [
{
"code": "invalid_request",
"message": "Multipart form is missing a file field.",
"suggestion": "Include the file contents in a form field of the multipart request body.",
"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": "file_already_exists",
"message": "A file with this name already exists for the organization.",
"suggestion": "Delete the existing file first or upload with a different filename.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "server_at_capacity",
"message": "Server is at capacity. Retry later.",
"suggestion": "Retry the request after a short delay using exponential backoff.",
"error_uid": "err-xxxxxxxx"
}
]
}
Files API
Upload File
Upload a file via streaming multipart/form-data
POST
/
files
curl -X POST https://api.u1.archetypeai.app/v0.5/files \
-H "Authorization: Bearer $ATAI_API_KEY" \
-F "file=@/path/to/local/file.csv"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
with open("/path/to/local/file.csv", "rb") as fh:
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/files",
headers={"Authorization": f"Bearer {api_key}"},
files={"file": ("file.csv", fh, "text/csv")},
)
result = response.json()
if result.get("is_valid"):
print(f"Uploaded: {result['file_id']}")
else:
print(f"Errors: {result.get('errors')}")
import fs from "node:fs";
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("/path/to/local/file.csv")]), "file.csv");
const response = await fetch("https://api.u1.archetypeai.app/v0.5/files", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
},
body: form,
});
const result = await response.json();
if (result.is_valid) {
console.log(`Uploaded: ${result.file_id}`);
} else {
console.error("Errors:", result.errors);
}
{
"is_valid": true,
"file_id": "file-abc123",
"file_uid": "8f2c1e5a-7b3d-4d9e-9c1a-2f5b7d8e4a6c"
}
{
"errors": [
{
"code": "invalid_request",
"message": "Multipart form is missing a file field.",
"suggestion": "Include the file contents in a form field of the multipart request body.",
"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": "file_already_exists",
"message": "A file with this name already exists for the organization.",
"suggestion": "Delete the existing file first or upload with a different filename.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "server_at_capacity",
"message": "Server is at capacity. Retry later.",
"suggestion": "Retry the request after a short delay using exponential backoff.",
"error_uid": "err-xxxxxxxx"
}
]
}
Requires version 1.1.5 or later of the Archetype platform.
File Upload Note: The interactive playground doesn’t support file uploads due to browser limitations. Use the cURL examples below to test file uploads.
Overview
Upload a file to the Newton Platform for processing. The request body ismultipart/form-data and the file contents are streamed to reduce memory usage.
The simple upload endpoint accepts files up to 512 MB. For files above this — or for any case where you need resumable uploads — use the direct-to-cloud multipart workflow instead, which supports up to 250 GB. The Developer Console UI caps its uploads through this endpoint at 255 MB; client integrations can go up to the full 512 MB.
Request
The request must be sent asmultipart/form-data with the file contents in a form field. The exact form-field name depends on the client; most HTTP clients (e.g. curl -F, requests files=) will use the file’s name as the field name.
Required Header
Authorization: Bearer YOUR_API_KEYContent-Type: multipart/form-data(automatically set by cURL’s-Fflag)
Supported File Types
The server’sContent-Type validator accepts:
- Images:
image/jpeg,image/png - Video:
video/mp4 - Text & data:
text/plain,text/csv,application/json
JSONL (
application/x-ndjson) is rejected by this endpoint despite appearing in the server’s “supported types” error message. Use the direct-to-cloud multipart flow for JSONL — initiate accepts it as the file_type.Response
boolean
Whether the upload was successful. Check this field to detect errors.
string
The filename of the uploaded file. Use this to download, delete, or fetch metadata for the file.
string
Internal unique identifier for the uploaded file
curl -X POST https://api.u1.archetypeai.app/v0.5/files \
-H "Authorization: Bearer $ATAI_API_KEY" \
-F "file=@/path/to/local/file.csv"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
with open("/path/to/local/file.csv", "rb") as fh:
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/files",
headers={"Authorization": f"Bearer {api_key}"},
files={"file": ("file.csv", fh, "text/csv")},
)
result = response.json()
if result.get("is_valid"):
print(f"Uploaded: {result['file_id']}")
else:
print(f"Errors: {result.get('errors')}")
import fs from "node:fs";
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("/path/to/local/file.csv")]), "file.csv");
const response = await fetch("https://api.u1.archetypeai.app/v0.5/files", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
},
body: form,
});
const result = await response.json();
if (result.is_valid) {
console.log(`Uploaded: ${result.file_id}`);
} else {
console.error("Errors:", result.errors);
}
{
"is_valid": true,
"file_id": "file-abc123",
"file_uid": "8f2c1e5a-7b3d-4d9e-9c1a-2f5b7d8e4a6c"
}
{
"errors": [
{
"code": "invalid_request",
"message": "Multipart form is missing a file field.",
"suggestion": "Include the file contents in a form field of the multipart request body.",
"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": "file_already_exists",
"message": "A file with this name already exists for the organization.",
"suggestion": "Delete the existing file first or upload with a different filename.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "server_at_capacity",
"message": "Server is at capacity. Retry later.",
"suggestion": "Retry the request after a short delay using exponential backoff.",
"error_uid": "err-xxxxxxxx"
}
]
}
Quick Test: Navigate to your file’s directory and run:
curl -X POST https://api.u1.archetypeai.app/v0.5/files \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@test_image.jpg"
Getting Full Metadata: This endpoint returns a minimal response. To get complete file information including size, dimensions, and timestamps, use the Get File Metadata endpoint.
Next Steps
- Get file details:
curl https://api.u1.archetypeai.app/v0.5/files/metadata/YOUR_FILE_ID \
-H "Authorization: Bearer YOUR_API_KEY"
- List all files:
curl https://api.u1.archetypeai.app/v0.5/files/metadata \
-H "Authorization: Bearer YOUR_API_KEY"
- Get storage summary:
curl https://api.u1.archetypeai.app/v0.5/files/info \
-H "Authorization: Bearer YOUR_API_KEY"
Was this page helpful?