Skip to main content
POST
/
v0
/
files
curl -X POST https://api.getagentdrive.com/v0/files \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "drive_id": "drv_abc123",
    "filename": "report.pdf",
    "path": "documents/report.pdf",
    "content": "JVBERi0xLjQK...",
    "content_type": "application/pdf",
    "metadata": { "author": "Jane Doe" },
    "tags": ["report", "2026"]
  }'
{
  "id": "file_xyz789",
  "drive_id": "drv_abc123",
  "path": "documents/report.pdf",
  "filename": "report.pdf",
  "mime_type": "application/pdf",
  "size": 24576,
  "content_hash": "sha256:abcdef1234567890",
  "content_preview": null,
  "tags": ["report", "2026"],
  "metadata": { "author": "Jane Doe" },
  "created_at": "2026-01-15T10:30:00Z",
  "updated_at": "2026-01-15T10:30:00Z"
}

Request Body

drive_id
string
required
The ID of the drive to upload the file to.
filename
string
required
The name of the file.
path
string
The path where the file should be stored. Defaults to the filename if not specified.
content
string
required
The file content encoded as a base64 string.
content_type
string
The MIME type of the file. Auto-detected from the filename if not specified.
metadata
object
Arbitrary key-value metadata to attach to the file.
tags
string[]
An array of string tags to associate with the file.
expires_at
string
An ISO 8601 timestamp for when the file should expire.
curl -X POST https://api.getagentdrive.com/v0/files \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "drive_id": "drv_abc123",
    "filename": "report.pdf",
    "path": "documents/report.pdf",
    "content": "JVBERi0xLjQK...",
    "content_type": "application/pdf",
    "metadata": { "author": "Jane Doe" },
    "tags": ["report", "2026"]
  }'
{
  "id": "file_xyz789",
  "drive_id": "drv_abc123",
  "path": "documents/report.pdf",
  "filename": "report.pdf",
  "mime_type": "application/pdf",
  "size": 24576,
  "content_hash": "sha256:abcdef1234567890",
  "content_preview": null,
  "tags": ["report", "2026"],
  "metadata": { "author": "Jane Doe" },
  "created_at": "2026-01-15T10:30:00Z",
  "updated_at": "2026-01-15T10:30:00Z"
}

Response

id
string
Unique identifier for the file.
drive_id
string
The ID of the drive the file belongs to.
path
string
The full path of the file within the drive.
filename
string
The name of the file.
mime_type
string
The MIME type of the file.
size
integer
The size of the file in bytes.
content_hash
string
A SHA-256 hash of the file content.
content_preview
string
A text preview of the file content, if available.
tags
string[]
Tags associated with the file.
metadata
object
Custom metadata attached to the file.
created_at
string
ISO 8601 timestamp of when the file was created.
updated_at
string
ISO 8601 timestamp of when the file was last updated.