PutRolePolicy
  • 17 Sep 2026
  • Dark
    Light

PutRolePolicy

  • Dark
    Light

Article summary

Post
/#/PutRolePolicy

Availability

Early Access: July 1, 2026

Early Access is gated; contact the Backblaze Sales team for access.

Limited Availability: July 1, 2026

This API is available only to customers with access to the Backblaze Enterprise Web Console. For more information, contact the Backblaze Sales team.

Add or replace an inline policy on a role

Actual request: POST / to iam.backblazeb2.com with Action=PutRolePolicy.

Request parameters

ParameterTypeRequiredDescription
ActionstringyesPutRolePolicy
Versionstringyes2010-05-08
RoleNamestringyesRole name.
PolicyNamestringyesPolicy name (up to 128 characters).
PolicyDocumentstringyesURL-encoded policy JSON (up to 131,072 characters after decoding).

Example: Inline role policy allowing uploads only to a specific prefix

 {
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowUploadPrefixOnly",
      "Effect": "Allow",
      "Action": ["s3:PutObject"],
      "Resource": ["arn:aws:s3:::analytics-bucket/uploads/*"]
    }
  ]
} 

Errors

  • NoSuchEntity
  • MalformedPolicyDocument
  • ValidationError
  • LimitExceeded
Security
API Key: sigv4
Header parameter nameAuthorization

AWS Signature Version 4. The Authorization header takes the form AWS4-HMAC-SHA256 Credential=..., SignedHeaders=..., Signature=.... For IAM and STS requests, the signing region is not validated; use any non-empty region value consistently. The signing service must be iam for IAM requests and sts for STS requests. When using temporary credentials, also include X-Amz-Security-Token: <session-token>.

Body parameters
object
Action
string Required
Valid values[ "PutRolePolicy" ]
Version
string Required
Valid values[ "2010-05-08" ]
RoleName
string Required
PolicyName
string Required
Max length128
PolicyDocument
string Required

URL-encoded policy JSON.

Responses
200

The request succeeded. The response body is an XML document specific to the Action invoked, with a ResponseMetadata block containing a RequestId.

string

Action-specific XML response. See the example response for each operation.

400

The request was malformed or failed validation.

HTTP StatusCodeDescription
400ValidationErrorInvalid input parameter or failed validation.
400MalformedPolicyDocumentPolicy JSON is invalid or unsupported.
string
403

The caller is not authorized. For operations that reference IAM resources, authorization may be evaluated before resource existence is disclosed.

HTTP StatusCodeDescription
403AccessDeniedThe authenticated principal lacks permission for this action.
string
404

For an authorized caller, the referenced entity does not exist.

HTTP StatusCodeDescription
404NoSuchEntityReferenced role, user, policy, or key does not exist.
string
409

A quota or size limit was exceeded.

HTTP StatusCodeDescription
409LimitExceededQuota or size limit exceeded.
string
429

The request was rate-limited.

HTTP StatusCodeDescription
429ThrottlingToo many requests. Use exponential backoff.
string
500

The server encountered an unexpected condition.

HTTP StatusCodeDescription
500InternalFailureUnexpected server error.
string

Was this article helpful?