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:
| Name | Type | Required | Description |
|---|
options.name | string | Yes | Display name |
options.slug | string | Yes | URL-safe identifier |
options.provider | 's3' | 'gcs' | 'r2' | Yes | Cloud storage provider |
options.bucketName | string | Yes | Actual bucket name in the provider |
options.region | string | No | AWS region (for S3) |
options.endpointUrl | string | No | Custom 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:
| Name | Type | Description |
|---|
slug | string | The bucket’s slug |
Returns: Promise<Bucket>
updateBucket(slug, options)
Update a bucket configuration.
const bucket = await client.storage.updateBucket(slug, options);
Parameters:
| Name | Type | Required | Description |
|---|
slug | string | Yes | The bucket’s slug |
options.name | string | No | New display name |
options.bucketName | string | No | New bucket name |
options.region | string | No | New region |
options.endpointUrl | string | No | New 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:
| Name | Type | Required | Description |
|---|
slug | string | Yes | The bucket’s slug |
credentials.accessKeyId | string | No | AWS/R2 access key ID |
credentials.secretAccessKey | string | No | AWS/R2 secret access key |
credentials.serviceAccountJson | string | No | GCS 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:
| Name | Type | Required | Description |
|---|
slug | string | Yes | The bucket’s slug |
prefix | string | No | Filter 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