imgbt
API Reference

Assets API

Upload, list, retrieve, update, and delete assets.

Assets API

All asset endpoints require authentication and are scoped to a vault.

Base path: /api/v1/vaults/{vaultId}/assets

Upload Asset

POST /api/v1/vaults/{vaultId}/assets
Content-Type: multipart/form-data

Parameters

FieldTypeRequiredDescription
fileFileYesThe file to upload (max 100MB)
partitionstringYesTop-level category (e.g., marketing)
collectionstringYesSub-category (e.g., blog)
channelstringYesSpecific grouping (e.g., hero-images)
filenamestringNoOverride filename (defaults to uploaded name)
metadatastringNoJSON object of custom metadata
tagsstringNoJSON array of tag strings

Path Component Rules

  • Lowercase alphanumeric characters and hyphens only
  • 1–64 characters
  • Must start and end with alphanumeric character
  • Pattern: /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/

Response (201)

{
  "id": "asset_01abc...",
  "vault_id": "vault_01abc...",
  "partition": "marketing",
  "collection": "blog",
  "channel": "hero-images",
  "filename": "photo.jpg",
  "r2_key": "vault_01abc.../marketing/blog/hero-images/asset_01abc..._photo.jpg",
  "size": 245760,
  "mime_type": "image/jpeg",
  "width": null,
  "height": null,
  "metadata": "{}",
  "tags": "[]",
  "created_at": "2026-01-15T10:30:00Z",
  "updated_at": "2026-01-15T10:30:00Z"
}

List Assets

GET /api/v1/vaults/{vaultId}/assets

Query Parameters

ParamTypeDescription
partitionstringFilter by partition
collectionstringFilter by collection
channelstringFilter by channel
cursorstringPagination cursor from previous response
limitnumberResults per page (1–200, default 50)

Response (200)

{
  "data": [{ "id": "asset_...", ... }],
  "cursor": "eyJjcmVhdGVkX2F0...",
  "has_more": true
}

Get Asset

GET /api/v1/vaults/{vaultId}/assets/{assetId}

Returns a single asset record or 404 if not found.

Update Asset

PATCH /api/v1/vaults/{vaultId}/assets/{assetId}
Content-Type: application/json

Body

{
  "metadata": { "alt": "Hero image for blog post" },
  "tags": ["hero", "blog", "featured"]
}
  • metadata is merged with existing metadata
  • tags replaces the existing tags array
  • At least one field must be provided

Delete Asset

DELETE /api/v1/vaults/{vaultId}/assets/{assetId}

Returns 204 No Content on success. Deletes from both D1 metadata and R2 storage.