Naijacloud
Docs

Storage

Every /v1 route for storage. This page is generated from the API's OpenAPI contract, so it always matches what the API accepts and returns.

Authentication, pagination, errors and idempotency work the same on every route. They are described once, in the API overview.

A workspace's buckets in one region

GET /v1/workspaces/{workspaceId}/buckets

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.

Query parameters

NameTypeRequiredNotes
limitintegernoRows per page. Ignored when a cursor is given.
cursorstringnoThe nextCursor of the previous page, unchanged.
regionstringno

Returns

  • 200 with a page: { data: V1StorageBucket[], nextCursor }, where each item is V1StorageBucket.
bash
curl "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets" \ -H "Authorization: Bearer $NC_API_KEY"

Create a bucket

POST /v1/workspaces/{workspaceId}/buckets

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.

Query parameters

NameTypeRequiredNotes
regionstringnoThe bucket's region; the workspace default when omitted.

Headers

NameTypeRequiredNotes
Idempotency-KeystringnoAny unique string (1–255 printable characters). A retry with the same key and body returns the first response instead of acting twice, for 24 hours.

Body

FieldTypeRequiredNotes
namestringyes3–63 lowercase letters, digits, dots and hyphens; unique across Naijacloud.
visibilityPRIVATE, PUBLIC_READno

Returns

bash
curl -X POST "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets" \ -H "Authorization: Bearer $NC_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"name":"…"}'

Delete a bucket

DELETE /v1/workspaces/{workspaceId}/buckets/{bucket}

Refused while it holds objects unless force=true, which deletes them too.

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.
bucketstringyes

Query parameters

NameTypeRequiredNotes
regionstringnoThe bucket's region; the workspace default when omitted.
forcebooleanno

Returns

  • 204 with no body.
bash
curl -X DELETE "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets/$BUCKET" \ -H "Authorization: Bearer $NC_API_KEY"

The workspace's storage access keys (IDs only, never secrets)

GET /v1/workspaces/{workspaceId}/storage/access-keys

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.

Returns

  • 200 with a page: { data: V1StorageAccessKey[], nextCursor }, where each item is V1StorageAccessKey.
bash
curl "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/storage/access-keys" \ -H "Authorization: Bearer $NC_API_KEY"

A bucket's CORS rules

GET /v1/workspaces/{workspaceId}/buckets/{bucket}/cors

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.
bucketstringyes

Query parameters

NameTypeRequiredNotes
regionstringnoThe bucket's region; the workspace default when omitted.

Returns

  • 200 with a page: { data: V1CorsRule[], nextCursor }, where each item is V1CorsRule.
bash
curl "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets/$BUCKET/cors" \ -H "Authorization: Bearer $NC_API_KEY"

Replace a bucket's CORS rules

PUT /v1/workspaces/{workspaceId}/buckets/{bucket}/cors

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.
bucketstringyes

Query parameters

NameTypeRequiredNotes
regionstringnoThe bucket's region; the workspace default when omitted.

Body

FieldTypeRequiredNotes

Returns

  • 204 with no body.
bash
curl -X PUT "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets/$BUCKET/cors" \ -H "Authorization: Bearer $NC_API_KEY" \ -H "Content-Type: application/json" \ -d '{}'

Remove a bucket's CORS rules

DELETE /v1/workspaces/{workspaceId}/buckets/{bucket}/cors

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.
bucketstringyes

Query parameters

NameTypeRequiredNotes
regionstringnoThe bucket's region; the workspace default when omitted.

Returns

  • 204 with no body.
bash
curl -X DELETE "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets/$BUCKET/cors" \ -H "Authorization: Bearer $NC_API_KEY"

A bucket's policy document, or null

GET /v1/workspaces/{workspaceId}/buckets/{bucket}/policy

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.
bucketstringyes

Query parameters

NameTypeRequiredNotes
regionstringnoThe bucket's region; the workspace default when omitted.

Returns

bash
curl "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets/$BUCKET/policy" \ -H "Authorization: Bearer $NC_API_KEY"

Replace a bucket's policy

PUT /v1/workspaces/{workspaceId}/buckets/{bucket}/policy

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.
bucketstringyes

Query parameters

NameTypeRequiredNotes
regionstringnoThe bucket's region; the workspace default when omitted.

Body

FieldTypeRequiredNotes
policystringyesAn S3 bucket policy document, as JSON text.

Returns

  • 204 with no body.
bash
curl -X PUT "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets/$BUCKET/policy" \ -H "Authorization: Bearer $NC_API_KEY" \ -H "Content-Type: application/json" \ -d '{"policy":"…"}'

Remove a bucket's policy (makes it private)

DELETE /v1/workspaces/{workspaceId}/buckets/{bucket}/policy

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
workspaceIdstringyesThe workspace's id.
bucketstringyes

Query parameters

NameTypeRequiredNotes
regionstringnoThe bucket's region; the workspace default when omitted.

Returns

  • 204 with no body.
bash
curl -X DELETE "https://api.naijacloud.com/v1/workspaces/$WORKSPACE_ID/buckets/$BUCKET/policy" \ -H "Authorization: Bearer $NC_API_KEY"

Types

V1BucketPolicy

FieldTypeNotes
policystring, or null

V1CorsRule

FieldTypeNotes
allowedHeadersarray of string, or null
allowedMethodsarray of string
allowedOriginsarray of string
exposeHeadersarray of string, or null
maxAgeSecondsinteger, or null

V1StorageAccessKey

FieldTypeNotes
accessKeyIdstringThe S3 access key ID. Safe to show.
createdAtstring (date-time)
idstring
namestringWhat the key is for, e.g. "storefront uploads".
updatedAtstring (date-time)

V1StorageBucket

FieldTypeNotes
createdAtstring, or null
endpointstring
namestring
publicBaseUrlstring, or null
regionstring
visibilityPRIVATE, PUBLIC_READ, or null