Limai Docs
API ReferenceBuckets

Files

List and manage files within a bucket

List Files

GET/api/v1/buckets/{bucketId}/files

Returns all files in a bucket with optional label filtering.

Parameters

NameTypeInRequiredDescription
bucketIdstringpathYesThe bucket ID
labelsstringqueryNoComma-separated list of labels to filter by

Request

const res = await fetch(
"https://app.limai.io/api/v1/buckets/bkt_abc123/files?labels=invoice,receipt",
{
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
}
);
const files = await res.json();

Response

Response200
[
  {
    "id": "file_001",
    "name": "invoice_2025.pdf",
    "labels": [
      "invoice"
    ],
    "sizeBytes": 245000,
    "status": "UPLOADED",
    "createdAt": "2025-01-15T10:30:00.000Z"
  }
]

Get File

GET/api/v1/buckets/{bucketId}/files/{fileId}

Returns detailed information about a specific file in a bucket.

Parameters

NameTypeInRequiredDescription
bucketIdstringpathYesThe bucket ID
fileIdstringpathYesThe file ID

Request

const res = await fetch(
"https://app.limai.io/api/v1/buckets/bkt_abc123/files/file_001",
{
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
}
);
const file = await res.json();

Response

Response200
{
  "id": "file_001",
  "name": "invoice_2025.pdf",
  "labels": [
    "invoice"
  ],
  "sizeBytes": 245000,
  "status": "UPLOADED",
  "contentHash": "sha256_abc123",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:30:00.000Z"
}

Update File Labels

PATCH/api/v1/buckets/{bucketId}/files/{fileId}

Update the labels on a file. Replaces all existing labels.

Parameters

NameTypeInRequiredDescription
bucketIdstringpathYesThe bucket ID
fileIdstringpathYesThe file ID
labelsstring[]bodyYesArray of label strings

Request

const res = await fetch(
"https://app.limai.io/api/v1/buckets/bkt_abc123/files/file_001",
{
  method: "PATCH",
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ labels: ["invoice", "urgent"] }),
}
);

Response

Response200
{
  "id": "file_001",
  "name": "invoice_2025.pdf",
  "labels": [
    "invoice",
    "urgent"
  ],
  "sizeBytes": 245000,
  "status": "UPLOADED",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T12:00:00.000Z"
}

Delete File

DELETE/api/v1/buckets/{bucketId}/files/{fileId}

Permanently deletes a file from a bucket.

Parameters

NameTypeInRequiredDescription
bucketIdstringpathYesThe bucket ID
fileIdstringpathYesThe file ID

Request

const res = await fetch(
"https://app.limai.io/api/v1/buckets/bkt_abc123/files/file_001",
{
  method: "DELETE",
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
}
);

Response

Response200
{
  "success": true
}