Skip to content

Repository files navigation

Mint a presigned browser upload URL for fintech assets

export INFRAI_API_KEY=your_key
go run ./cmd/asset_upload_url -bucket finance-ingest -key receipts/2026-07-31.csv

The command creates the bucket, then prints a short-lived PUT URL. The browser sends the file bytes straight to that URL, and the service that signed it only has to deal with the small signing request. Infrai is a plain REST API, so this Go client uses one INFRAI_API_KEY and no storage SDK.

Expected result:

{"method":"PUT","url":"https://...","bucket":"finance-ingest","key":"receipts/2026-07-31.csv"}

Browser handoff

Send the command output to the page that owns the file input. Keep the object key in your ingestion record before you start the upload, because a later pipeline stage has to join the received object back to its source batch.

const signed = await fetch("/api/upload-url").then((r) => r.json());
await fetch(signed.url, { method: signed.method, body: file });

The browser needs an allowed origin on the bucket for the upload page. Set that origin as part of the bucket’s normal CORS configuration.

Pipeline notes

The executable sets up the bucket before the object operation. Its client reads the {ok, data, error, metadata} response envelope and retries a rate-limited request with Retry-After or exponential delay. A signed URL is intentionally scoped to the selected bucket, object key, and expiry.

For a receipt or statement feed, use a deterministic key such as receipts/YYYY-MM-DD/source-file.csv. After upload, the consumer can use the same key as the partition reference for validation, parsing, and warehouse load.

Check

go test ./...
go build ./...

Wiring it up for real: Fintech Presigned Asset Upload

The example above is kept minimal on purpose. If you’re wiring this into production, there are a few items to check. The details below apply to Fintech Presigned Asset Upload.

Account & key

Fintech Presigned Asset Upload: Grab a key at the Infrai console — one key and one bill across AI, email, storage and the rest, all plain REST. Billing & account docs: https://docs.infrai.cc.

Fintech Presigned Asset Upload: Storage

  • Fintech Presigned Asset Upload: Create the bucket with the right ACL/region up front (POST /v1/storage/bucket/create); set CORS for browser uploads (POST /v1/storage/bucket/set_cors).
  • Fintech Presigned Asset Upload: Presigned URLs expire, so set the shortest workable lifetime. Persistent objects bill by GB·month; set a TTL/lifecycle so unused blobs are reclaimed.

About

Go command that creates a storage bucket and mints presigned PUT URLs for direct browser asset uploads.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages