Skip to main content
The SDK storage resource exposes two methods:
  • client.storage.upload(...)
  • client.storage.resolve_path(...)

Upload a file

From path

upload = client.storage.upload("report.pdf")

print(upload.obj_ulid)
print(upload.uri)         # doc://...
print(upload.filename)
print(upload.size_bytes)

From open file handle

with open("data.csv", "rb") as f:
    upload = client.storage.upload(f, filename="sales-data.csv")

Into a folder

upload = client.storage.upload("report.pdf", folder_ulid="01JFOLDER...")

UploadResult

FieldType
obj_ulidstr
uristr (doc://...)
filenamestr
size_bytesint

Use upload in ingest

run = client.runs.create(
    recipe_id="01JEXAMPLE00000000000000000",
    ingest={"ingest_step_1": [upload.to_ingest_source(label="Report")]},
)
to_ingest_source() creates IngestSource(uri=<doc://...>, kind="file").

Resolve Pantry path

resolved = client.storage.resolve_path("Reports/Q4 2024.pdf")

if resolved is None:
    print("not found")
else:
    print(resolved.uri)
resolve_path() returns None for 404.

REST API v1

Upload

POST /v1/storage/upload/
Authorization: Bearer <api-key>
Content-Type: multipart/form-data

file: (binary)
folder_ulid: 01JFOLDER...  # optional
Response (201):
{
  "obj_ulid": "01JABCDEF...",
  "uri": "doc://01JABCDEF...",
  "filename": "report.pdf",
  "size_bytes": 245760
}

Resolve path

GET /v1/storage/resolve/?path=Reports/Q4%202024.pdf
Authorization: Bearer <api-key>
Returns 200 with the same object shape, or 404 if missing.

See also