Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.castari.com/llms.txt

Use this file to discover all available pages before exploring further.

Storage API

The Storage API lets you manage cloud storage buckets (S3, GCS, R2) that can be mounted to agent sandboxes. Access via client.storage:
const client = new CastariClient({ apiKey: '...' });
const storage = client.storage;

Methods

getBuckets()

List all storage buckets.
const buckets = await client.storage.getBuckets();
Returns: Promise<Bucket[]>

createBucket(options)

Create a new storage bucket configuration.
const bucket = await client.storage.createBucket(options);
Parameters:
NameTypeRequiredDescription
options.namestringYesDisplay name
options.slugstringYesURL-safe identifier
options.provider's3' | 'gcs' | 'r2'YesCloud storage provider
options.bucketNamestringYesActual bucket name in the provider
options.regionstringNoAWS region (for S3)
options.endpointUrlstringNoCustom endpoint URL (required for R2)
Returns: Promise<Bucket> Example:
const bucket = await client.storage.createBucket({
  name: 'Production Data',
  slug: 'production-data',
  provider: 's3',
  bucketName: 'my-data-bucket',
  region: 'us-east-1',
});

getBucket(slug)

Get a specific bucket by slug.
const bucket = await client.storage.getBucket(slug);
Parameters:
NameTypeDescription
slugstringThe bucket’s slug
Returns: Promise<Bucket>

updateBucket(slug, options)

Update a bucket configuration.
const bucket = await client.storage.updateBucket(slug, options);
Parameters:
NameTypeRequiredDescription
slugstringYesThe bucket’s slug
options.namestringNoNew display name
options.bucketNamestringNoNew bucket name
options.regionstringNoNew region
options.endpointUrlstringNoNew endpoint URL
Returns: Promise<Bucket>

deleteBucket(slug)

Delete a bucket configuration.
await client.storage.deleteBucket(slug);
Returns: Promise<void>

setCredentials(slug, credentials)

Set credentials for a bucket.
await client.storage.setCredentials(slug, credentials);
Parameters:
NameTypeRequiredDescription
slugstringYesThe bucket’s slug
credentials.accessKeyIdstringNoAWS/R2 access key ID
credentials.secretAccessKeystringNoAWS/R2 secret access key
credentials.serviceAccountJsonstringNoGCS service account JSON
Returns: Promise<void>

testConnection(slug)

Test the connection to a bucket.
const result = await client.storage.testConnection(slug);
Returns: Promise<TestConnectionResult>

listFiles(slug, prefix?)

List files in a bucket.
const files = await client.storage.listFiles(slug, prefix?);
Parameters:
NameTypeRequiredDescription
slugstringYesThe bucket’s slug
prefixstringNoFilter files by prefix
Returns: Promise<FileInfo[]>

getDownloadUrl(slug, path, options?)

Get a presigned download URL for a file.
const presigned = await client.storage.getDownloadUrl(slug, path, options?);
Returns: Promise<PresignedUrl>

getUploadUrl(slug, path, options?)

Get a presigned upload URL for a file.
const presigned = await client.storage.getUploadUrl(slug, path, options?);
Returns: Promise<PresignedUrl>

See Also