Skip to content

Storage

S3-compatible buckets and objects with presigned URLs.

Overview

Base path: https://api.infrai.cc/v1/storage
Auth header: Authorization: Bearer $INFRAI_API_KEY
bash
# 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

POST /v1/storage/bucket/create

Create an object-storage bucket on a chosen vendor and region.

Parameters

NameTypeRequiredDescription
bucketstring
Required
Bucket name.
vendorstringOptionalPin a specific vendor instead of auto-routing.
regionstringOptionalStorage region.
acl"private" | "public"OptionalBucket access control.

Returns

Bucket { bucket, vendor, region, created_at, acl? }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

GET /v1/storage/bucket/list

List your buckets.

Returns

{ items: Bucket[] }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/storage/bucket/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

storage.object.presign

POST /v1/storage/object/presign/{bucket}/{key}

Create a presigned URL for uploading or downloading an object.

Parameters

NameTypeRequiredDescription
bucketstring
Required
Bucket name.
keystring
Required
Object key (path) within the bucket.
method"GET" | "PUT"OptionalHTTP method the presigned URL authorizes.
expires_secondsnumberOptionalPresigned URL lifetime in seconds.

Returns

PresignedUrl { url, method, expires_at, headers? }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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 /v1/storage/object/delete/{bucket}/{key}

Delete an object from a bucket.

Parameters

NameTypeRequiredDescription
bucketstring
Required
Bucket name.
keystring
Required
Object key (path) within the bucket.

Returns

{ ok: boolean }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
curl -X DELETE https://api.infrai.cc/v1/storage/object/delete/BUCKET/KEY \
  -H "Authorization: Bearer $INFRAI_API_KEY"

storage.bucket.get

GET /v1/storage/bucket/get/{bucket}

获取存储桶元信息

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称

Returns

Bucket { bucket_id, name, vendor, region, acl, created_at, cors_rules, lifecycle_rules }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/storage/bucket/get/BUCKET \
  -H "Authorization: Bearer $INFRAI_API_KEY"

storage.bucket.delete

DELETE /v1/storage/bucket/delete/{bucket}

删除存储桶

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
idempotency_keystringOptional幂等键;省略时自动派生

Returns

BucketDeleteResult { deleted }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
curl -X DELETE https://api.infrai.cc/v1/storage/bucket/delete/BUCKET \
  -H "Authorization: Bearer $INFRAI_API_KEY"

storage.bucket.usage

GET /v1/storage/bucket/usage/{bucket}

查询存储桶用量

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称

Returns

BucketUsageResult { byte_count, object_count, as_of }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/storage/bucket/usage/BUCKET \
  -H "Authorization: Bearer $INFRAI_API_KEY"

storage.bucket.set_cors

POST /v1/storage/bucket/set_cors/{bucket}

设置存储桶 CORS 规则

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
rulesCorsRule[]
Required
CORS 规则列表(允许的来源、方法、头等)
idempotency_keystringOptional幂等键;省略时自动派生

Returns

Bucket { bucket_id, name, vendor, region, acl, created_at, cors_rules, lifecycle_rules }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

POST /v1/storage/bucket/set_lifecycle/{bucket}

设置存储桶生命周期规则

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
rulesLifecycleRule[]
Required
生命周期规则列表(前缀、过期天数、分层转换等)
idempotency_keystringOptional幂等键;省略时自动派生

Returns

Bucket { bucket_id, name, vendor, region, acl, created_at, cors_rules, lifecycle_rules }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

POST /v1/storage/bucket/set_notification/{bucket}

订阅存储桶对象事件

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
eventsstring[]
Required
要订阅的事件类型列表(至少一个)
target{ webhook_id?: string; url?: string }
Required
回调目标:webhook_id(推荐,复用 scheduling.webhook.*)或裸 url
idempotency_keystringOptional幂等键;省略时自动派生

Returns

BucketSetNotificationResult { subscription_id }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

PUT /v1/storage/object/put/{bucket}/{key}

服务端直接写入对象

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
keystring
Required
对象键(路径)
bodybytes
Required
对象字节内容,作为原始请求体上传
content_typestringOptional对象的 MIME 类型
metadataRecord<string, string>Optional任意用户自定义元数据键值对
cache_controlstringOptionalCache-Control 头
storage_classstringOptional存储类别(默认 standard)
idempotency_keystringOptional幂等键;省略时按内容哈希自动派生

Returns

StorageObject { bucket_id, key, size_bytes, etag, content_type, metadata, created_at, last_modified }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

GET /v1/storage/object/get/{bucket}/{key}

下载对象内容

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
keystring
Required
对象键(路径)

Returns

object bytes (application/octet-stream)

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/storage/object/get/BUCKET/KEY \
  -H "Authorization: Bearer $INFRAI_API_KEY"

storage.object.head

GET /v1/storage/object/head/{bucket}/{key}

查询对象元信息

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
keystring
Required
对象键(路径)

Returns

ObjectHeadResult { found, status, key, size_bytes, etag, content_type, metadata, last_modified }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/storage/object/head/BUCKET/KEY \
  -H "Authorization: Bearer $INFRAI_API_KEY"

storage.object.list

GET /v1/storage/object/list/{bucket}

列举存储桶内对象

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
prefixstringOptional仅列举键以此前缀开头的对象
delimiterstringOptionalS3 风格的目录分隔符(如 /),将键归并为 common_prefixes
cursorstringOptional来自上次 next_cursor 的分页游标
limitnumberOptional本次返回的最大条数(1-1000)

Returns

ObjectListResult { items: StorageObject[], next_cursor, common_prefixes }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/storage/object/list/BUCKET \
  -H "Authorization: Bearer $INFRAI_API_KEY"

storage.object.copy

POST /v1/storage/object/copy

复制对象

Parameters

NameTypeRequiredDescription
src_bucketstring
Required
源存储桶名称
src_keystring
Required
源对象键
dst_bucketstring
Required
目标存储桶名称
dst_keystring
Required
目标对象键
idempotency_keystringOptional幂等键;省略时自动派生

Returns

StorageObject { bucket_id, key, size_bytes, etag, content_type, metadata, created_at, last_modified }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

POST /v1/storage/object/delete_batch/{bucket}

批量删除对象

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
keysstring[]
Required
要删除的对象键列表(1-1000 个)
idempotency_keystringOptional幂等键;省略时按键集合内容哈希自动派生

Returns

ObjectDeleteBatchResult { deleted, errors }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

POST /v1/storage/object/set_acl/{bucket}/{key}

设置对象访问权限

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
keystring
Required
对象键(路径)
acl"private" | "public"
Required
访问权限:private 或 public
idempotency_keystringOptional幂等键;省略时自动派生

Returns

ObjectSetAclResult { acl, public_url }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

POST /v1/storage/object/set_metadata/{bucket}/{key}

设置对象元数据

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
keystring
Required
对象键(路径)
content_typestringOptional对象的 MIME 类型
cache_controlstringOptionalCache-Control 头
metadataRecord<string, string>Optional任意用户自定义元数据键值对
idempotency_keystringOptional幂等键;省略时自动派生

Returns

StorageObject { bucket_id, key, size_bytes, etag, content_type, metadata, created_at, last_modified }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

POST /v1/storage/multipart/create/{bucket}

发起分片上传

Parameters

NameTypeRequiredDescription
bucketstring
Required
存储桶名称
keystring
Required
对象键(路径)
content_typestringOptional对象的 MIME 类型
idempotency_keystringOptional幂等键;省略时自动派生

Returns

MultipartUpload { upload_id, bucket_id, key, started_at, part_size_min, part_count_max }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

POST /v1/storage/multipart/presign_part/{upload_id}/{part_number}

为分片生成预签名 URL

Parameters

NameTypeRequiredDescription
upload_idstring
Required
分片上传 ID
part_numbernumber
Required
分片序号(从 1 开始)

Returns

MultipartPresignPartResult { url, method, headers, expires_at }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

PUT /v1/storage/multipart/upload_part/{upload_id}/{part_number}

上传单个分片

Parameters

NameTypeRequiredDescription
upload_idstring
Required
分片上传 ID
part_numbernumber
Required
分片序号(从 1 开始)
bodybytes
Required
分片字节内容
idempotency_keystringOptional幂等键;省略时自动派生

Returns

MultipartPart { part_number, etag }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

POST /v1/storage/multipart/complete/{upload_id}

完成分片上传

Parameters

NameTypeRequiredDescription
upload_idstring
Required
分片上传 ID
partsMultipartPart[]
Required
已上传分片列表(每项含 part_number 与 etag,1-10000 个)
idempotency_keystringOptional幂等键;省略时自动派生

Returns

StorageObject { bucket_id, key, size_bytes, etag, content_type, metadata, created_at, last_modified }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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

DELETE /v1/storage/multipart/abort/{upload_id}

中止分片上传

Parameters

NameTypeRequiredDescription
upload_idstring
Required
分片上传 ID
idempotency_keystringOptional幂等键;省略时自动派生

Returns

MultipartAbortResult { aborted }

Example

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
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.

CapabilityEndpointDescription
storage.bucket.createPOST /v1/storage/bucket/createCreate an object storage bucket (idempotent).
storage.bucket.deleteDELETE /v1/storage/bucket/delete/{bucket}Delete an object storage bucket (idempotent).
storage.bucket.getGET /v1/storage/bucket/get/{bucket}Retrieve a bucket's metadata (provider, region, ACL, CORS, and lifecycle rules).
storage.bucket.listGET /v1/storage/bucket/listList the account's object storage buckets.
storage.bucket.set_corsPOST /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_lifecyclePOST /v1/storage/bucket/set_lifecycle/{bucket}Set lifecycle rules on a bucket for automatic expiration and cold-storage tiering.
storage.bucket.set_notificationPOST /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.usageGET /v1/storage/bucket/usage/{bucket}Query a bucket's usage statistics: object count, bytes stored, and measurement timestamp.
storage.multipart.abortDELETE /v1/storage/multipart/abort/{upload_id}Abort a multipart upload and clean up uploaded parts (idempotent).
storage.multipart.completePOST /v1/storage/multipart/complete/{upload_id}Complete a multipart upload, assembling parts into the final StorageObject.
storage.multipart.createPOST /v1/storage/multipart/create/{bucket}Initiate a multipart upload, returning an upload_id and part size/count limits.
storage.multipart.presign_partPOST /v1/storage/multipart/presign_part/{upload_id}/{part_number}Generate a presigned upload URL for a single part.
storage.multipart.upload_partPUT /v1/storage/multipart/upload_part/{upload_id}/{part_number}Upload the bytes of a single part, returning that part's etag.
storage.object.copyPOST /v1/storage/object/copyCopy an object within or across buckets and providers (server-side read/write bridging).
storage.object.deleteDELETE /v1/storage/object/delete/{bucket}/{key}Delete a storage object (idempotent).
storage.object.delete_batchPOST /v1/storage/object/delete_batch/{bucket}Delete up to 1000 objects in a single call, with partial-success semantics.
storage.object.getGET /v1/storage/object/get/{bucket}/{key}Download an object's contents, returning the raw byte stream.
storage.object.headGET /v1/storage/object/head/{bucket}/{key}Fetch an object's existence and metadata (size, etag, content_type, metadata) without the body.
storage.object.listGET /v1/storage/object/list/{bucket}List objects in a bucket, supporting prefix, delimiter, and cursor pagination.
storage.object.presignPOST /v1/storage/object/presign/{bucket}/{key}Generate a presigned URL for direct client upload or download of an object (idempotent).
storage.object.putPUT /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_aclPOST /v1/storage/object/set_acl/{bucket}/{key}Toggle an object's public/private access, returning the new ACL and public URL.
storage.object.set_metadataPOST /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.

一次性前置(每个范例都假定已完成):

bash
# 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_..."
bash
# 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": []}'