Storage
S3-compatible buckets and objects with presigned URLs.
Overview
https://api.infrai.cc/v1/storageAuthorization: Bearer $INFRAI_API_KEY# Call any /v1/storage capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/storage/... \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json"Methods
storage.bucket.create
Create an object-storage bucket on a chosen vendor and region.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | Bucket name. |
vendor | string | Optional | Pin a specific vendor instead of auto-routing. |
region | string | Optional | Storage region. |
acl | "private" | "public" | Optional | Bucket access control. |
Returns
Bucket { bucket, vendor, region, created_at, acl? }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/bucket/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "..."}'storage.bucket.list
List your buckets.
Returns
{ items: Bucket[] }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/storage/bucket/list \
-H "Authorization: Bearer $INFRAI_API_KEY"storage.object.presign
Create a presigned URL for uploading or downloading an object.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | Bucket name. |
key | string | Required | Object key (path) within the bucket. |
method | "GET" | "PUT" | Optional | HTTP method the presigned URL authorizes. |
expires_seconds | number | Optional | Presigned URL lifetime in seconds. |
Returns
PresignedUrl { url, method, expires_at, headers? }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/object/presign/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"bucket_id": "bkt_42", "key": "uploads/photo.jpg", "ttl_seconds": 3600}'storage.object.delete
Delete an object from a bucket.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | Bucket name. |
key | string | Required | Object key (path) within the bucket. |
Returns
{ ok: boolean }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/storage/object/delete/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"storage.bucket.get
获取存储桶元信息
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
Returns
Bucket { bucket_id, name, vendor, region, acl, created_at, cors_rules, lifecycle_rules }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/storage/bucket/get/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY"storage.bucket.delete
删除存储桶
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
BucketDeleteResult { deleted }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/storage/bucket/delete/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY"storage.bucket.usage
查询存储桶用量
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
Returns
BucketUsageResult { byte_count, object_count, as_of }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/storage/bucket/usage/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY"storage.bucket.set_cors
设置存储桶 CORS 规则
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
rules | CorsRule[] | Required | CORS 规则列表(允许的来源、方法、头等) |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
Bucket { bucket_id, name, vendor, region, acl, created_at, cors_rules, lifecycle_rules }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/bucket/set_cors/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rules": []}'storage.bucket.set_lifecycle
设置存储桶生命周期规则
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
rules | LifecycleRule[] | Required | 生命周期规则列表(前缀、过期天数、分层转换等) |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
Bucket { bucket_id, name, vendor, region, acl, created_at, cors_rules, lifecycle_rules }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/bucket/set_lifecycle/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rules": []}'storage.bucket.set_notification
订阅存储桶对象事件
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
events | string[] | Required | 要订阅的事件类型列表(至少一个) |
target | { webhook_id?: string; url?: string } | Required | 回调目标:webhook_id(推荐,复用 scheduling.webhook.*)或裸 url |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
BucketSetNotificationResult { subscription_id }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/bucket/set_notification/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"events": [], "target": {}}'storage.object.put
服务端直接写入对象
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
key | string | Required | 对象键(路径) |
body | bytes | Required | 对象字节内容,作为原始请求体上传 |
content_type | string | Optional | 对象的 MIME 类型 |
metadata | Record<string, string> | Optional | 任意用户自定义元数据键值对 |
cache_control | string | Optional | Cache-Control 头 |
storage_class | string | Optional | 存储类别(默认 standard) |
idempotency_key | string | Optional | 幂等键;省略时按内容哈希自动派生 |
Returns
StorageObject { bucket_id, key, size_bytes, etag, content_type, metadata, created_at, last_modified }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X PUT https://api.infrai.cc/v1/storage/object/put/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'storage.object.get
下载对象内容
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
key | string | Required | 对象键(路径) |
Returns
object bytes (application/octet-stream)Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/storage/object/get/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"storage.object.head
查询对象元信息
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
key | string | Required | 对象键(路径) |
Returns
ObjectHeadResult { found, status, key, size_bytes, etag, content_type, metadata, last_modified }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/storage/object/head/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"storage.object.list
列举存储桶内对象
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
prefix | string | Optional | 仅列举键以此前缀开头的对象 |
delimiter | string | Optional | S3 风格的目录分隔符(如 /),将键归并为 common_prefixes |
cursor | string | Optional | 来自上次 next_cursor 的分页游标 |
limit | number | Optional | 本次返回的最大条数(1-1000) |
Returns
ObjectListResult { items: StorageObject[], next_cursor, common_prefixes }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/storage/object/list/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY"storage.object.copy
复制对象
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
src_bucket | string | Required | 源存储桶名称 |
src_key | string | Required | 源对象键 |
dst_bucket | string | Required | 目标存储桶名称 |
dst_key | string | Required | 目标对象键 |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
StorageObject { bucket_id, key, size_bytes, etag, content_type, metadata, created_at, last_modified }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/object/copy \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"src_bucket": "...", "src_key": "...", "dst_bucket": "...", "dst_key": "..."}'storage.object.delete_batch
批量删除对象
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
keys | string[] | Required | 要删除的对象键列表(1-1000 个) |
idempotency_key | string | Optional | 幂等键;省略时按键集合内容哈希自动派生 |
Returns
ObjectDeleteBatchResult { deleted, errors }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/object/delete_batch/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"keys": []}'storage.object.set_acl
设置对象访问权限
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
key | string | Required | 对象键(路径) |
acl | "private" | "public" | Required | 访问权限:private 或 public |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
ObjectSetAclResult { acl, public_url }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/object/set_acl/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"acl": "..."}'storage.object.set_metadata
设置对象元数据
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
key | string | Required | 对象键(路径) |
content_type | string | Optional | 对象的 MIME 类型 |
cache_control | string | Optional | Cache-Control 头 |
metadata | Record<string, string> | Optional | 任意用户自定义元数据键值对 |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
StorageObject { bucket_id, key, size_bytes, etag, content_type, metadata, created_at, last_modified }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/object/set_metadata/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'storage.multipart.create
发起分片上传
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
bucket | string | Required | 存储桶名称 |
key | string | Required | 对象键(路径) |
content_type | string | Optional | 对象的 MIME 类型 |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
MultipartUpload { upload_id, bucket_id, key, started_at, part_size_min, part_count_max }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/multipart/create/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"key": "..."}'storage.multipart.presign_part
为分片生成预签名 URL
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
upload_id | string | Required | 分片上传 ID |
part_number | number | Required | 分片序号(从 1 开始) |
Returns
MultipartPresignPartResult { url, method, headers, expires_at }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/multipart/presign_part/UPLOAD_ID/PART_NUMBER \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"upload_id": "...", "part_number": 0}'storage.multipart.upload_part
上传单个分片
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
upload_id | string | Required | 分片上传 ID |
part_number | number | Required | 分片序号(从 1 开始) |
body | bytes | Required | 分片字节内容 |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
MultipartPart { part_number, etag }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X PUT https://api.infrai.cc/v1/storage/multipart/upload_part/UPLOAD_ID/PART_NUMBER \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"upload_id": "...", "part_number": 0}'storage.multipart.complete
完成分片上传
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
upload_id | string | Required | 分片上传 ID |
parts | MultipartPart[] | Required | 已上传分片列表(每项含 part_number 与 etag,1-10000 个) |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
StorageObject { bucket_id, key, size_bytes, etag, content_type, metadata, created_at, last_modified }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/storage/multipart/complete/UPLOAD_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"parts": []}'storage.multipart.abort
中止分片上传
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
upload_id | string | Required | 分片上传 ID |
idempotency_key | string | Optional | 幂等键;省略时自动派生 |
Returns
MultipartAbortResult { aborted }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/storage/multipart/abort/UPLOAD_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"All capabilities
Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.
| Capability | Endpoint | Description |
|---|---|---|
storage.bucket.create | POST /v1/storage/bucket/create | Create an object storage bucket (idempotent). |
storage.bucket.delete | DELETE /v1/storage/bucket/delete/{bucket} | Delete an object storage bucket (idempotent). |
storage.bucket.get | GET /v1/storage/bucket/get/{bucket} | Retrieve a bucket's metadata (provider, region, ACL, CORS, and lifecycle rules). |
storage.bucket.list | GET /v1/storage/bucket/list | List the account's object storage buckets. |
storage.bucket.set_cors | POST /v1/storage/bucket/set_cors/{bucket} | Set CORS rules on a bucket, a prerequisite for browser direct uploads; returns the updated bucket. |
storage.bucket.set_lifecycle | POST /v1/storage/bucket/set_lifecycle/{bucket} | Set lifecycle rules on a bucket for automatic expiration and cold-storage tiering. |
storage.bucket.set_notification | POST /v1/storage/bucket/set_notification/{bucket} | Subscribe object events to a callback (webhook_id or url); returns a subscription ID, delivered via account.webhooks (the single global webhook). |
storage.bucket.usage | GET /v1/storage/bucket/usage/{bucket} | Query a bucket's usage statistics: object count, bytes stored, and measurement timestamp. |
storage.multipart.abort | DELETE /v1/storage/multipart/abort/{upload_id} | Abort a multipart upload and clean up uploaded parts (idempotent). |
storage.multipart.complete | POST /v1/storage/multipart/complete/{upload_id} | Complete a multipart upload, assembling parts into the final StorageObject. |
storage.multipart.create | POST /v1/storage/multipart/create/{bucket} | Initiate a multipart upload, returning an upload_id and part size/count limits. |
storage.multipart.presign_part | POST /v1/storage/multipart/presign_part/{upload_id}/{part_number} | Generate a presigned upload URL for a single part. |
storage.multipart.upload_part | PUT /v1/storage/multipart/upload_part/{upload_id}/{part_number} | Upload the bytes of a single part, returning that part's etag. |
storage.object.copy | POST /v1/storage/object/copy | Copy an object within or across buckets and providers (server-side read/write bridging). |
storage.object.delete | DELETE /v1/storage/object/delete/{bucket}/{key} | Delete a storage object (idempotent). |
storage.object.delete_batch | POST /v1/storage/object/delete_batch/{bucket} | Delete up to 1000 objects in a single call, with partial-success semantics. |
storage.object.get | GET /v1/storage/object/get/{bucket}/{key} | Download an object's contents, returning the raw byte stream. |
storage.object.head | GET /v1/storage/object/head/{bucket}/{key} | Fetch an object's existence and metadata (size, etag, content_type, metadata) without the body. |
storage.object.list | GET /v1/storage/object/list/{bucket} | List objects in a bucket, supporting prefix, delimiter, and cursor pagination. |
storage.object.presign | POST /v1/storage/object/presign/{bucket}/{key} | Generate a presigned URL for direct client upload or download of an object (idempotent). |
storage.object.put | PUT /v1/storage/object/put/{bucket}/{key} | Upload an object server-side, with raw bytes as the request body plus optional content_type/metadata. |
storage.object.set_acl | POST /v1/storage/object/set_acl/{bucket}/{key} | Toggle an object's public/private access, returning the new ACL and public URL. |
storage.object.set_metadata | POST /v1/storage/object/set_metadata/{bucket}/{key} | Update a stored object's content-type, cache-control, and custom metadata. |
End-to-end example
A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
# only your project key. No SDK, no install.
# Get your key: sign in with Google/GitHub at the console for a project key
# + $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..." # from the console
# 2) storage.bucket.create
curl -X POST https://api.infrai.cc/v1/storage/bucket/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "..."}'
# 3) storage.bucket.list
curl -X GET https://api.infrai.cc/v1/storage/bucket/list \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 4) storage.object.presign
curl -X POST https://api.infrai.cc/v1/storage/object/presign/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"bucket_id": "bkt_42", "key": "uploads/photo.jpg", "ttl_seconds": 3600}'
# 5) storage.object.delete
curl -X DELETE https://api.infrai.cc/v1/storage/object/delete/BUCKET/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 6) storage.bucket.get
curl -X GET https://api.infrai.cc/v1/storage/bucket/get/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 7) storage.bucket.delete
curl -X DELETE https://api.infrai.cc/v1/storage/bucket/delete/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 8) storage.bucket.usage
curl -X GET https://api.infrai.cc/v1/storage/bucket/usage/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 9) storage.bucket.set_cors
curl -X POST https://api.infrai.cc/v1/storage/bucket/set_cors/BUCKET \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rules": []}'