curl https://api.u1.archetypeai.app/v0.5/files/metadata \
-H "Authorization: Bearer $ATAI_API_KEY"
# Pass the previous page's next_cursor back verbatim as `after`.
curl "https://api.u1.archetypeai.app/v0.5/files/metadata?limit=10&after=<cursor>" \
-H "Authorization: Bearer $ATAI_API_KEY"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.get(
"https://api.u1.archetypeai.app/v0.5/files/metadata",
headers={"Authorization": f"Bearer {api_key}"},
params={"limit": 100},
)
page = response.json()
for file in page["data"]:
print(f"{file['file_id']} {file['file_status']} {file['num_bytes']} bytes")
# Pass the cursor back verbatim as `after` to fetch the next page.
if page["has_more"]:
print(f"Next page cursor: {page['next_cursor']}")
const params = new URLSearchParams({
limit: "100",
});
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/metadata?${params}`,
{
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
},
}
);
const page = await response.json();
for (const f of page.data) {
console.log(`${f.file_id} ${f.file_status} ${f.num_bytes} bytes`);
}
// Pass the cursor back verbatim as `after` to fetch the next page.
if (page.has_more) {
console.log(`Next page cursor: ${page.next_cursor}`);
}
{
"data": [
{
"file_id": "file-abc123",
"file_uid": "8f2c1e5a-7b3d-4d9e-9c1a-2f5b7d8e4a6c",
"is_valid": true,
"file_type": "image/png",
"num_bytes": 482931,
"file_status": "FILE_STATUS_INGESTED",
"file_attributes": {
"width": 1920,
"height": 1080,
"num_channels": 3,
"channel_bands": ["R", "G", "B"]
},
"ingested": true,
"file_index": 0,
"file_tags": {}
},
{
"file_id": "file-def456",
"file_uid": "1d4f9b2e-3a8c-4e1d-bb02-7d6c9f0a3b51",
"is_valid": true,
"file_type": "text/csv",
"num_bytes": 12483910,
"file_status": "FILE_STATUS_INGESTED",
"file_attributes": {
"num_rows": 50000,
"num_columns": 24,
"column_headers": ["timestamp", "value", "label"]
},
"ingested": true,
"file_index": 1,
"file_tags": {}
}
],
"has_more": true,
"next_cursor": "<cursor>",
"prev_cursor": null
}
{
"errors": [
{
"code": "<error_code>",
"message": "...",
"suggestion": null,
"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"
}
]
}
Files API
List Files Metadata
List metadata for all files in the authenticated organization
GET
/
files
/
metadata
curl https://api.u1.archetypeai.app/v0.5/files/metadata \
-H "Authorization: Bearer $ATAI_API_KEY"
# Pass the previous page's next_cursor back verbatim as `after`.
curl "https://api.u1.archetypeai.app/v0.5/files/metadata?limit=10&after=<cursor>" \
-H "Authorization: Bearer $ATAI_API_KEY"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.get(
"https://api.u1.archetypeai.app/v0.5/files/metadata",
headers={"Authorization": f"Bearer {api_key}"},
params={"limit": 100},
)
page = response.json()
for file in page["data"]:
print(f"{file['file_id']} {file['file_status']} {file['num_bytes']} bytes")
# Pass the cursor back verbatim as `after` to fetch the next page.
if page["has_more"]:
print(f"Next page cursor: {page['next_cursor']}")
const params = new URLSearchParams({
limit: "100",
});
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/metadata?${params}`,
{
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
},
}
);
const page = await response.json();
for (const f of page.data) {
console.log(`${f.file_id} ${f.file_status} ${f.num_bytes} bytes`);
}
// Pass the cursor back verbatim as `after` to fetch the next page.
if (page.has_more) {
console.log(`Next page cursor: ${page.next_cursor}`);
}
{
"data": [
{
"file_id": "file-abc123",
"file_uid": "8f2c1e5a-7b3d-4d9e-9c1a-2f5b7d8e4a6c",
"is_valid": true,
"file_type": "image/png",
"num_bytes": 482931,
"file_status": "FILE_STATUS_INGESTED",
"file_attributes": {
"width": 1920,
"height": 1080,
"num_channels": 3,
"channel_bands": ["R", "G", "B"]
},
"ingested": true,
"file_index": 0,
"file_tags": {}
},
{
"file_id": "file-def456",
"file_uid": "1d4f9b2e-3a8c-4e1d-bb02-7d6c9f0a3b51",
"is_valid": true,
"file_type": "text/csv",
"num_bytes": 12483910,
"file_status": "FILE_STATUS_INGESTED",
"file_attributes": {
"num_rows": 50000,
"num_columns": 24,
"column_headers": ["timestamp", "value", "label"]
},
"ingested": true,
"file_index": 1,
"file_tags": {}
}
],
"has_more": true,
"next_cursor": "<cursor>",
"prev_cursor": null
}
{
"errors": [
{
"code": "<error_code>",
"message": "...",
"suggestion": null,
"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"
}
]
}
Requires version 1.1.5 or later of the Archetype platform.
Overview
This endpoint returns a cursor-paginated list of metadata records for files belonging to your organization. The list is ordered on the property identified by thesort property, in the direction
specified by order. For example, if sort is num_bytes and order is desc, the list is
sorted in reverse order by file size (largest file first). The default sort order is by creation
timestamp (sort set to created_at), in newest file first ordering. Ties are broken by the
file_uid property; this ensures that the same request returns the same page when no files have
changed.
When paging, be sure to keep
sort and order the same.limit files (default 100, at most 1000). To read the next page, pass the
previous page’s next_cursor as after; to step back, pass its prev_cursor as before.
has_more refers to the direction being travelled. Cursors are opaque tokens tied to the sort
they were minted under and must not be constructed by the client. Sending both after and
before, or a cursor that doesn’t fit the current sort, returns an HTTP 400 error.
Query Parameters
string
Opaque cursor from a previous page’s
next_cursor (or its prev_cursor after paging
backward): returns the rows past it in the requested order. Mutually exclusive with before;
a cursor minted under a different sort is rejected with an HTTP 400 error. v1.1.12+string
Opaque cursor from a previous page’s
prev_cursor (or its next_cursor after paging
backward): returns the rows before it in the requested order. Mutually exclusive with after.
v1.1.12+integer
default:"-1"
deprecated
Zero-based index of the shard to return. Use together with
max_items_per_shard to page
through results. Specify -1 to retrieve all files.This parameter was removed in version v1.1.12 of the Archetype platform.
integer
default:"-1"
deprecated
Maximum number of metadata records per shard. Specify
-1 for the maximum allowed number of
records per shard. The maximum number of records per shard is 1000.This parameter was removed in version v1.1.12 of the Archetype platform.
string
Filter results to a comma-delineated list of up to 50 MIME file types (e.g.
image/png,
text/csv,application/json). Omit to return files of all types. v1.1.2+string
Perform a case-insensitive substring match against the names of files, and return only those
files that match. If this string is empty or not specified, no search is performed. v1.1.3+
string
Specifies the field on which the returned list is ordered. Ties are broken using the
file_uid property to ensure that returned pages are the same if no file changes have
occurred. v1.1.11+Must be one of the following:| Value | Description |
|---|---|
created_at | Sort by the time and date at which the file was created. Default value. |
file_id | Sort by the file’s ID |
file_status | Sort by the file’s lifecycle status, in this order: uploading, registered, ingested, corrupt |
num_bytes | Sort by the size of the file in bytes. |
When paging through files, do not change the value of
sort.string
Specifies whether sorting is performed in ascending order (
asc) or descending order
(desc). v1.1.11+When sorting by created_at or num_bytes, this defaults to desc. When sorting by
file_status or file_id, this defaults to asc.When paging through files, do not change the value of
order.Response
Returns one page of file metadata records, along with the cursors to move off it. When the page is past the end of the file list,data is empty and has_more is false.
array
required
The files on this page, in the requested
sort and order whether the page was reached with
after or before. Render them as returned. Each record has the same shape as the response
from Get File Metadata.boolean
required
Whether more files exist in the direction this page was fetched.
string
Cursor continuing in the direction of travel: pass it as
after on a forward page, or as
before when this request itself used before. null when has_more is false.string
Cursor stepping back the way this page was reached: pass it as
before after a forward page,
or as after after a backward one. null when the request carried no cursor (the first page).400 error is returned for an invalid sort or order, when both after and before
are given, for a malformed cursor or one minted under another sort, or when file_type lists
more than 50 MIME types.
curl https://api.u1.archetypeai.app/v0.5/files/metadata \
-H "Authorization: Bearer $ATAI_API_KEY"
# Pass the previous page's next_cursor back verbatim as `after`.
curl "https://api.u1.archetypeai.app/v0.5/files/metadata?limit=10&after=<cursor>" \
-H "Authorization: Bearer $ATAI_API_KEY"
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.get(
"https://api.u1.archetypeai.app/v0.5/files/metadata",
headers={"Authorization": f"Bearer {api_key}"},
params={"limit": 100},
)
page = response.json()
for file in page["data"]:
print(f"{file['file_id']} {file['file_status']} {file['num_bytes']} bytes")
# Pass the cursor back verbatim as `after` to fetch the next page.
if page["has_more"]:
print(f"Next page cursor: {page['next_cursor']}")
const params = new URLSearchParams({
limit: "100",
});
const response = await fetch(
`https://api.u1.archetypeai.app/v0.5/files/metadata?${params}`,
{
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
},
}
);
const page = await response.json();
for (const f of page.data) {
console.log(`${f.file_id} ${f.file_status} ${f.num_bytes} bytes`);
}
// Pass the cursor back verbatim as `after` to fetch the next page.
if (page.has_more) {
console.log(`Next page cursor: ${page.next_cursor}`);
}
{
"data": [
{
"file_id": "file-abc123",
"file_uid": "8f2c1e5a-7b3d-4d9e-9c1a-2f5b7d8e4a6c",
"is_valid": true,
"file_type": "image/png",
"num_bytes": 482931,
"file_status": "FILE_STATUS_INGESTED",
"file_attributes": {
"width": 1920,
"height": 1080,
"num_channels": 3,
"channel_bands": ["R", "G", "B"]
},
"ingested": true,
"file_index": 0,
"file_tags": {}
},
{
"file_id": "file-def456",
"file_uid": "1d4f9b2e-3a8c-4e1d-bb02-7d6c9f0a3b51",
"is_valid": true,
"file_type": "text/csv",
"num_bytes": 12483910,
"file_status": "FILE_STATUS_INGESTED",
"file_attributes": {
"num_rows": 50000,
"num_columns": 24,
"column_headers": ["timestamp", "value", "label"]
},
"ingested": true,
"file_index": 1,
"file_tags": {}
}
],
"has_more": true,
"next_cursor": "<cursor>",
"prev_cursor": null
}
{
"errors": [
{
"code": "<error_code>",
"message": "...",
"suggestion": null,
"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"
}
]
}
Was this page helpful?