> For the complete documentation index, see [llms.txt](https://docs.lumidb.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lumidb.com/api-reference/assets.md).

# Assets

Upload and manage files

## GET /assets

> List all assets

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"assets","description":"Upload and manage files"}],"security":[{"ApiKey":[]},{"Bearer":[]},{"Basic":[]},{"Clerk":[]},{"Link":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"Long-lived API key configured in the server's auth file. The full header value is `ApiKey <key>` (note the literal `ApiKey ` prefix, which is not standard HTTP — generated SDKs will need to prepend it)."},"Bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Scoped LumiDB JWT issued by `POST /create_token`. Send as `Authorization: Bearer <jwt>`."},"Basic":{"type":"http","scheme":"basic","description":"HTTP Basic where the password is an API key (username is ignored). Send as `Authorization: Basic base64(\"user:<api_key>\")`."},"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."},"Link":{"type":"apiKey","in":"header","name":"Authorization","description":"Short-lived link token granting access to a shared project. The full header value is `Link <token>`."}}},"paths":{"/assets":{"get":{"tags":["assets"],"description":"List all assets","operationId":"handle_asset_list","responses":{}}}}}
```

## Create an asset and get presigned upload URLs

> Creates the asset metadata and returns presigned URLs for uploading the file bytes directly to storage. This endpoint accepts JSON, not \`multipart/form-data\`; do not send file bytes here.\
> \
> \*\*Single:\*\* PUT the entire raw file to \`upload\_url\`. The asset is then ready. Calling \`POST /assets/{asset\_id}/complete\` afterwards is optional and records the uploaded size. A remote single upload is limited to 5 GiB.\
> \
> \*\*Multipart:\*\* \`content\_length\` is required. For each returned part, PUT bytes \`\[(part\_number - 1) \* part\_size, part\_number \* part\_size)\` to its \`upload\_url\`; the final part contains the remainder. Parts may be uploaded in parallel. Save each PUT response's \`ETag\`, then call \`POST /assets/{asset\_id}/complete\`.\
> \
> Presigned PUTs do not use LumiDB authorization. URLs expire after \`expiration\_seconds\` (currently 86400). \`auto\` selects multipart only for remote files whose \`content\_length\` is larger than 128 MiB; otherwise it selects single.

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"assets","description":"Upload and manage files"}],"security":[{"ApiKey":[]},{"Bearer":[]},{"Basic":[]},{"Clerk":[]},{"Link":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"Long-lived API key configured in the server's auth file. The full header value is `ApiKey <key>` (note the literal `ApiKey ` prefix, which is not standard HTTP — generated SDKs will need to prepend it)."},"Bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Scoped LumiDB JWT issued by `POST /create_token`. Send as `Authorization: Bearer <jwt>`."},"Basic":{"type":"http","scheme":"basic","description":"HTTP Basic where the password is an API key (username is ignored). Send as `Authorization: Basic base64(\"user:<api_key>\")`."},"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."},"Link":{"type":"apiKey","in":"header","name":"Authorization","description":"Short-lived link token granting access to a shared project. The full header value is `Link <token>`."}},"schemas":{"PresignUploadParams":{"type":"object","required":["filename","client_modified_at"],"properties":{"client_modified_at":{"type":"string","format":"date-time","description":"Optional last modification time of the file on the client, as reported by the client."},"content_length":{"type":["integer","null"],"format":"int64","description":"Exact file size in bytes. Required for multipart mode.","minimum":0},"content_sha256":{"type":["string","null"],"description":"Optional SHA-256 of the file contents."},"filename":{"type":"string","description":"Original filename, without a directory path. `name` is accepted as a legacy alias."},"metadata":{"type":["object","null"],"description":"Optional application metadata stored with the asset.","additionalProperties":{},"propertyNames":{"type":"string"}},"mode":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UploadMode","description":"Upload strategy. Defaults to `single`."}],"default":"single"}}},"UploadMode":{"type":"string","enum":["auto","single","multipart"]},"AssetUploadResponse":{"allOf":[{"$ref":"#/components/schemas/UploadMethod"},{"type":"object","required":["asset_id","expiration_seconds"],"properties":{"asset_id":{"$ref":"#/components/schemas/AssetID","description":"Asset identifier used in the multipart completion path and later API calls."},"expiration_seconds":{"type":"integer","format":"int64","description":"Lifetime of every returned presigned URL.","minimum":0}}}]},"UploadMethod":{"oneOf":[{"type":"object","required":["upload_url","upload_type"],"properties":{"upload_type":{"type":"string","enum":["single"]},"upload_url":{"type":"string","format":"uri","description":"Presigned URL for a PUT whose body is the entire raw file."}}},{"type":"object","required":["upload_id","parts","part_size","upload_type"],"properties":{"part_size":{"type":"integer","format":"int64","description":"Size in bytes of every part except the possibly smaller final part.","minimum":0},"parts":{"type":"array","items":{"$ref":"#/components/schemas/PartUploadUrl"},"description":"Presigned PUT URL and part number for every part."},"upload_id":{"type":"string","description":"Upload identifier required by the completion request."},"upload_type":{"type":"string","enum":["multipart"]}}}]},"PartUploadUrl":{"type":"object","required":["part_number","upload_url"],"properties":{"part_number":{"type":"integer","format":"int32","description":"One-based S3 part number. It also determines the byte range for this URL."},"upload_url":{"type":"string","format":"uri","description":"Presigned URL for a PUT whose body is this part's raw bytes."}}},"AssetID":{"type":"string"}}},"paths":{"/assets/upload":{"post":{"tags":["assets"],"summary":"Create an asset and get presigned upload URLs","description":"Creates the asset metadata and returns presigned URLs for uploading the file bytes directly to storage. This endpoint accepts JSON, not `multipart/form-data`; do not send file bytes here.\n\n**Single:** PUT the entire raw file to `upload_url`. The asset is then ready. Calling `POST /assets/{asset_id}/complete` afterwards is optional and records the uploaded size. A remote single upload is limited to 5 GiB.\n\n**Multipart:** `content_length` is required. For each returned part, PUT bytes `[(part_number - 1) * part_size, part_number * part_size)` to its `upload_url`; the final part contains the remainder. Parts may be uploaded in parallel. Save each PUT response's `ETag`, then call `POST /assets/{asset_id}/complete`.\n\nPresigned PUTs do not use LumiDB authorization. URLs expire after `expiration_seconds` (currently 86400). `auto` selects multipart only for remote files whose `content_length` is larger than 128 MiB; otherwise it selects single.","operationId":"handle_asset_create","requestBody":{"description":"Filename, exact byte length, upload mode, optional content SHA-256, and optional metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PresignUploadParams"}}},"required":true},"responses":{"200":{"description":"Asset created and upload URLs generated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetUploadResponse"}}}},"400":{"description":"Invalid filename or upload parameters"}}}}}}
```

## DELETE /assets/{asset\_id}

> Delete an asset by ID

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"assets","description":"Upload and manage files"}],"security":[{"ApiKey":[]},{"Bearer":[]},{"Basic":[]},{"Clerk":[]},{"Link":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"Long-lived API key configured in the server's auth file. The full header value is `ApiKey <key>` (note the literal `ApiKey ` prefix, which is not standard HTTP — generated SDKs will need to prepend it)."},"Bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Scoped LumiDB JWT issued by `POST /create_token`. Send as `Authorization: Bearer <jwt>`."},"Basic":{"type":"http","scheme":"basic","description":"HTTP Basic where the password is an API key (username is ignored). Send as `Authorization: Basic base64(\"user:<api_key>\")`."},"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."},"Link":{"type":"apiKey","in":"header","name":"Authorization","description":"Short-lived link token granting access to a shared project. The full header value is `Link <token>`."}}},"paths":{"/assets/{asset_id}":{"delete":{"tags":["assets"],"description":"Delete an asset by ID","operationId":"handle_asset_delete","parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":""}}}}}}
```

## Complete an asset upload

> Finalizes an upload and records the uploaded size.\
> \
> \*\*Multipart:\*\* required. Call this only after every part PUT succeeded. Use the same \`asset\_id\` and \`upload\_id\`, and send every part in ascending order with the exact \`ETag\` response header returned by its PUT (including surrounding quotes when present).\
> \
> \*\*Single:\*\* optional. Call it without a request body after the PUT succeeded.\
> \
> Repeating a completion that already succeeded also succeeds.

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"assets","description":"Upload and manage files"}],"security":[{"ApiKey":[]},{"Bearer":[]},{"Basic":[]},{"Clerk":[]},{"Link":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"Long-lived API key configured in the server's auth file. The full header value is `ApiKey <key>` (note the literal `ApiKey ` prefix, which is not standard HTTP — generated SDKs will need to prepend it)."},"Bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Scoped LumiDB JWT issued by `POST /create_token`. Send as `Authorization: Bearer <jwt>`."},"Basic":{"type":"http","scheme":"basic","description":"HTTP Basic where the password is an API key (username is ignored). Send as `Authorization: Basic base64(\"user:<api_key>\")`."},"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."},"Link":{"type":"apiKey","in":"header","name":"Authorization","description":"Short-lived link token granting access to a shared project. The full header value is `Link <token>`."}},"schemas":{"CompleteMultipartParams":{"type":"object","required":["upload_id","parts"],"properties":{"parts":{"type":"array","items":{"$ref":"#/components/schemas/CompletedPartInfo"},"description":"Every uploaded part in ascending part-number order."},"upload_id":{"type":"string","description":"Upload identifier returned when the asset was created."}}},"CompletedPartInfo":{"type":"object","description":"A completed part with its ETag, used when finalizing a multipart upload","required":["part_number","etag"],"properties":{"etag":{"type":"string","description":"Exact ETag response header from the part PUT, including quotes when present."},"part_number":{"type":"integer","format":"int32","description":"Part number from the corresponding presigned URL."}}},"CompleteMultipartResponse":{"type":"object","required":["completed","asset_id"],"properties":{"asset_id":{"$ref":"#/components/schemas/AssetID"},"completed":{"type":"boolean"}}},"AssetID":{"type":"string"}}},"paths":{"/assets/{asset_id}/complete":{"post":{"tags":["assets"],"summary":"Complete an asset upload","description":"Finalizes an upload and records the uploaded size.\n\n**Multipart:** required. Call this only after every part PUT succeeded. Use the same `asset_id` and `upload_id`, and send every part in ascending order with the exact `ETag` response header returned by its PUT (including surrounding quotes when present).\n\n**Single:** optional. Call it without a request body after the PUT succeeded.\n\nRepeating a completion that already succeeded also succeeds.","operationId":"handle_asset_complete_upload","parameters":[{"name":"asset_id","in":"path","description":"Asset identifier returned by the upload endpoint","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Upload identifier and ETags collected from all part PUT responses. Omit for single uploads.","content":{"application/json":{"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CompleteMultipartParams"}]}}}},"responses":{"200":{"description":"Upload completed and asset ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteMultipartResponse"}}}},"400":{"description":"Missing or invalid multipart upload ID or parts"},"404":{"description":"Asset not found in the caller's organization"},"409":{"description":"Single upload's file has not been uploaded yet"}}}}}}
```

## Get a presigned upload URL

> Returns a fresh presigned PUT URL for a single upload, or for one multipart part when \`part\_number\` is provided. URLs expire no later than 24 hours after asset creation. Expired assets cannot get new upload URLs. Presigned URLs can stop working earlier, so it's recommended to fetch the presigned URL just before starting the the upload.

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"assets","description":"Upload and manage files"}],"security":[{"ApiKey":[]},{"Bearer":[]},{"Basic":[]},{"Clerk":[]},{"Link":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"Long-lived API key configured in the server's auth file. The full header value is `ApiKey <key>` (note the literal `ApiKey ` prefix, which is not standard HTTP — generated SDKs will need to prepend it)."},"Bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Scoped LumiDB JWT issued by `POST /create_token`. Send as `Authorization: Bearer <jwt>`."},"Basic":{"type":"http","scheme":"basic","description":"HTTP Basic where the password is an API key (username is ignored). Send as `Authorization: Basic base64(\"user:<api_key>\")`."},"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."},"Link":{"type":"apiKey","in":"header","name":"Authorization","description":"Short-lived link token granting access to a shared project. The full header value is `Link <token>`."}},"schemas":{"RefreshedUploadUrl":{"type":"object","required":["upload_url"],"properties":{"upload_url":{"type":"string","format":"uri"}}}}},"paths":{"/assets/{asset_id}/upload-url":{"get":{"tags":["assets"],"summary":"Get a presigned upload URL","description":"Returns a fresh presigned PUT URL for a single upload, or for one multipart part when `part_number` is provided. URLs expire no later than 24 hours after asset creation. Expired assets cannot get new upload URLs. Presigned URLs can stop working earlier, so it's recommended to fetch the presigned URL just before starting the the upload.","operationId":"handle_asset_refresh_upload_url","parameters":[{"name":"asset_id","in":"path","description":"Asset identifier returned by the upload endpoint","required":true,"schema":{"type":"string"}},{"name":"part_number","in":"query","description":"Part to get a URL for. Required for multipart uploads, omitted for single uploads.","required":false,"schema":{"type":["integer","null"],"format":"int32"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshedUploadUrl"}}}},"409":{"description":"Asset data has already been uploaded or the upload deadline has passed"}}}}}}
```

## POST /download\_files

> Get presigned download URLs for source files by file index

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"assets","description":"Upload and manage files"}],"security":[{"ApiKey":[]},{"Bearer":[]},{"Basic":[]},{"Clerk":[]},{"Link":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"Long-lived API key configured in the server's auth file. The full header value is `ApiKey <key>` (note the literal `ApiKey ` prefix, which is not standard HTTP — generated SDKs will need to prepend it)."},"Bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Scoped LumiDB JWT issued by `POST /create_token`. Send as `Authorization: Bearer <jwt>`."},"Basic":{"type":"http","scheme":"basic","description":"HTTP Basic where the password is an API key (username is ignored). Send as `Authorization: Basic base64(\"user:<api_key>\")`."},"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."},"Link":{"type":"apiKey","in":"header","name":"Authorization","description":"Short-lived link token granting access to a shared project. The full header value is `Link <token>`."}},"schemas":{"DownloadParams":{"type":"object","required":["table_downloads"],"properties":{"table_downloads":{"type":"array","items":{"$ref":"#/components/schemas/TableDownloadParams"}}}},"TableDownloadParams":{"type":"object","required":["table_name","files"],"properties":{"files":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}},"table_name":{"type":"string"}}}}},"paths":{"/download_files":{"post":{"tags":["assets"],"description":"Get presigned download URLs for source files by file index","operationId":"handle_download_files","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DownloadParams"}}},"required":true},"responses":{}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lumidb.com/api-reference/assets.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
