Skip to main content

Overview

The Storage API provides bucket-based file storage similar to S3. Upload, download, and manage files with support for both local and S3-compatible storage backends.

Headers

For authenticated function invocations:
For admin endpoints:

Upload Object with upload strategy

InsForge supports two types of storage backends:
  1. Local Storage: Files are stored on the local filesystem. Use for development or low-volume production.
  2. S3-Compatible: Files are stored on S3-compatible object storage. Use for high-volume production.
The steps to upload a file are:
  1. Get upload strategy
  2. Upload file
  3. Confirm upload (S3 only)

Step 1: Get Upload Strategy

Get the optimal upload strategy (direct or presigned URL) based on storage backend. The upload strategy API returns the optimal upload method based on the storage backend:
  • Local Storage: Direct upload to InsForge API
  • S3-Compatible: Presigned URL for direct upload to S3

Request Body

Uploading to an existing object key replaces the current object in place.

Example

Response (S3 Backend)

Response (Local Storage)


Step 2: Upload File

Upload the file to the specified URL using the provided method.
  • Local Storage: Use a PUT request to uploadUrl with multipart/form-data and a file field.
  • S3-Compatible: Use a POST request to uploadUrl with multipart/form-data and a file field. Include all fields from the fields object in the request.

Step 3: Confirm Presigned Upload (S3 Only)

Confirm that a file was successfully uploaded to S3 using a presigned URL.

Request Body

Example

Response


Upload Object (Deprecated)

Upload a file to a bucket with a specific key.

Path Parameters

Request Body

multipart/form-data with a file field.

Example

Response


Upload with Auto-Generated Key (Deprecated)

Upload a file with an auto-generated unique key.

Example

Response


Download Object with download strategy

InsForge supports two types of storage backends:
  1. Local Storage: Files are stored on the local filesystem. Use for development or low-volume production.
  2. S3-Compatible: Files are stored on S3-compatible object storage. Use for high-volume production.
The steps to download a file are:
  1. Get download strategy
  2. Download file from returned URL

Step 1: Get Download Strategy

Get the optimal download strategy (direct URL or presigned URL) based on storage backend and bucket visibility. The download strategy API returns the optimal download method based on the storage backend and bucket visibility:
  • Local Storage: Direct download from InsForge API
  • S3-Compatible: Presigned URL for S3.
Expiry (for presigned URLs) is auto-calculated server-side from bucket visibility. The endpoint takes no request body. objectKey may contain / (pseudo-folders) — do not percent-encode the separators.POST /api/storage/buckets/{bucketName}/objects/{objectKey}/download-strategy is retained as a deprecated alias at the original path for older SDK releases and will be removed in a future major version. Migrate to GET.

Example

Response (S3 Public Bucket)

Response (S3 Private Bucket)

Step 2: Download File

Download the file from the returned URL, using the appropriate method.

Download Object (Deprecated)

Download a file from a bucket.

Example

Response

Binary file content with appropriate Content-Type and Content-Length headers.

Delete Object

Delete a file from a bucket.

Example

Response


List Objects in Bucket

List all objects in a bucket with optional filtering.

Query Parameters

Example

Response


Bucket Management (Admin)

List All Buckets

Example

Response

Create Bucket

Request Body

Example

Response

Update Bucket

Request Body

Example

Response

Delete Bucket

Example

Response


Error Responses

Bucket Not Found (404)

Object Not Found (404)

Invalid File (400)

Bucket Already Exists (409)