s3.buckets.temporary-key

A temporary key for this bucket only, for N hours, acting as you

POST /s3/api/buckets/{name}/temporary-credentialsIAM s3:CreateTemporaryCredentialsChanges state

The way to hand out a credential narrower than yourself: it carries a session policy of this bucket only (read by default, or read and write, optionally one prefix) under your own policies, and it expires. 409 when your own policies allow nothing of it. For a long-lived credential, use create-access-key: a service account with a policy for the bucket.

Request syntax

POST /s3/api/buckets/{name}/temporary-credentials
{
  "hours": "number",
  "access": "enum",
  "prefix": "string",
  "description": "string"
}

Path parameters

  • nameRequired

    string

    Constraints: 3-63 chars, /^[a-z0-9][a-z0-9-]*[a-z0-9]$/

Request body

  • hoursOptional

    number

    How long the key lives, 0.25 to 12 hours; default 1

    Constraints: 0.25-12

  • accessOptional

    enum

    read (default): list and download; readwrite: also upload and delete

    One of: read, readwrite

  • prefixOptional

    string

    Only objects under this key prefix, e.g. uploads/

    Constraints: max 512 chars

  • descriptionOptional

    string

    What the key is for

    Constraints: max 200 chars

Response

201; data is { accessKeyId, secretAccessKey, sessionToken, expiresAt, bucket, address, endpoint, region, access, prefix, reach }. The secret and the session token are in this response only.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow s3:CreateTemporaryCredentials on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud s3 buckets temporary-key name

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_s3_buckets_temporary-key.