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:
| Parameter | Type | Description |
|---|---|---|
agentId | string | Filter 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
filename | string | Yes | The 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
name or filename | string | Yes | The filename |
agentId | string | No | The 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"
}