File Manager API

API endpoints for managing file uploads and storage for AI agents

Manage file uploads and storage for AI agents.

Access: Secret Key Only (sk_live_*)


List Files

Retrieves all files for the authenticated team.

GET /file

Query Parameters:

ParameterTypeDescription
agentIdstringFilter files by agent ID

Response 200 OK:

{
  "files": [
    {
      "id": "string",
      "filename": "string",
      "agentId": "string",
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ]
}

Update File Metadata

Updates file metadata (e.g., token counts).

PUT /file

Query Parameters:

ParameterTypeRequiredDescription
filenamestringYesThe filename to update

Request Body:

{
  "agentId": "string",
  "inputTokens": 1000,
  "outputTokens": 500
}

Response 200 OK:

{
  "filename": "string",
  "agentId": "string",
  "inputTokens": 1000,
  "outputTokens": 500,
  "updatedAt": "2024-01-15T10:30:00Z"
}

Get File Presigned URL

Retrieves a presigned URL to download a file.

GET /file/presigned-url

Query Parameters:

ParameterTypeRequiredDescription
name or filenamestringYesThe filename
agentIdstringNoThe agent ID

Response 200 OK:

{
  "url": "string",
  "expiresAt": "2024-01-15T11:30:00Z"
}

Create Upload Presigned URL

Creates a presigned URL for file upload.

POST /upload-url

Request Body:

{
  "filename": "string",
  "agentId": "string (optional)"
}

Response 200 OK:

{
  "uploadUrl": "string",
  "fileKey": "string",
  "expiresAt": "2024-01-15T11:30:00Z"
}

Confirm Upload

Confirms a file upload and creates a file record.

POST /confirm-upload

Request Body:

{
  "filename": "string",
  "agentId": "string (optional)",
  "inputTokens": 1000,
  "outputTokens": 500
}

Response 201 Created:

{
  "id": "string",
  "filename": "string",
  "agentId": "string",
  "createdAt": "2024-01-15T10:30:00Z"
}