Skip to main content

Files API

The Files API provides managed file storage (Storage v2). Upload files to Castari’s managed storage and attach them to agents. Access via client.files:

Methods

upload(file, filename, options?)

Upload a file to managed storage.
Parameters: Returns: Promise<FileUploadResponse> Example:

list(options?)

List files in managed storage.
Parameters: Returns: Promise<ManagedFileList>

get(fileId)

Get file metadata.
Returns: Promise<ManagedFile>

update(fileId, options)

Update file metadata.
Returns: Promise<ManagedFile>

delete(fileId)

Delete a file from managed storage.
Returns: Promise<void>

download(fileId)

Download a file.
Returns: Promise<Response>

getUsage()

Get storage usage statistics.
Returns: Promise<StorageUsage> Example:
Response type:

getUploadUrl(filename, sizeBytes, options?)

Get a presigned upload URL for large files.
Returns: Promise<PresignedUpload>

confirmUpload(fileId, sha256Hash)

Confirm a presigned upload completed successfully.
Returns: Promise<ManagedFile>

attachToAgent(agentSlug, options)

Attach a file to an agent.
Parameters: Returns: Promise<AgentFile>

listAgentFiles(agentSlug)

List files attached to an agent.
Returns: Promise<AgentFileList>

detachFromAgent(agentSlug, fileId)

Detach a file from an agent.
Returns: Promise<void>

See Also