Limai Docs
API ReferenceBuckets

Upload

Get a presigned URL to upload a file to a bucket

GET/api/v1/buckets/{bucketId}/get-url

Returns a presigned S3 URL to upload a file to a bucket. The file record is created with UPLOADING status. Use the returned URL to upload the file via a PUT request.

Parameters

NameTypeInRequiredDescription
bucketIdstringpathYesThe bucket ID
filenamestringqueryYesName of the file being uploaded

Request

const res = await fetch(
"https://app.limai.io/api/v1/buckets/bkt_abc123/get-url?filename=invoice.pdf",
{
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
  },
}
);
const { url, fileId } = await res.json();

await fetch(url, {
method: "PUT",
body: fileBuffer,
});

Response

Response200
{
  "url": "https://s3.amazonaws.com/...presigned-url...",
  "fileId": "file_abc123"
}