Amazon IAM Iam Role Policy API

The Iam Role Policy API from Amazon IAM — 6 operation(s) for iam role policy.

Business capability
Identity & Access Management BC-620.20

Operations 6

POST /?Action=AttachRolePolicy Attach Role Policy #
POST /?Action=DeleteRolePolicy Delete Role Policy #
POST /?Action=DetachRolePolicy Detach Role Policy #
POST /?Action=GetRolePolicy Get Role Policy #
POST /?Action=ListRolePolicies List Role Policies #
POST /?Action=PutRolePolicy Put Role Policy #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/amazon-iam:amazon-iam-role-policy-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

amazon-iam-role-policy-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: AWS Identity and Access Management Role Policy API
  version: '2010-05-08'
  description: Generated from AWS's published Smithy model for AWS Identity and Access Management. 6 operation(s).
  contact:
    name: Amazon Web Services
    url: https://aws.amazon.com/contact-us/
  license:
    name: Apache 2.0
    identifier: Apache-2.0
    url: https://github.com/aws/api-models-aws/blob/main/LICENSE
servers:
- url: https://iam.{region}.amazonaws.com
  variables:
    region:
      default: us-east-1
security:
- sigv4: []
tags:
- name: Role Policy
paths:
  /?Action=AttachRolePolicy:
    post:
      operationId: AttachRolePolicy
      summary: Attach Role Policy
      description: Attaches the specified managed policy to the specified IAM role. When you attach a managed policy to a role, the managed policy becomes part of the role's permission (access) policy. You cannot use a managed policy as the role's trust policy. The role's trust policy is created at the same time as the role, using CreateRole . You can update a role's trust policy using UpdateAssumerolePolicy . Use this operation to attach a managed policy to a role. To embed an inline policy in a role, use PutRolePolicy . For more information about policies, see Managed policies and inline policies in the IAM User Guide. As a best practice, you can validate your IAM policies. To learn more, see Validating IAM policies in the IAM User Guide.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                type: string
        '400':
          description: InvalidInputException; PolicyNotAttachableException; UnmodifiableEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/InvalidInputException'
        '409':
          description: LimitExceededException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/LimitExceededException'
        '404':
          description: NoSuchEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchEntityException'
        '500':
          description: ServiceFailureException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/ServiceFailureException'
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: AttachRolePolicy
                  Version:
                    type: string
                    const: '2010-05-08'
              - $ref: '#/components/schemas/AttachRolePolicyRequest'
            example:
              RoleName: ReadOnlyRole
              PolicyArn: arn:aws:iam::aws:policy/ReadOnlyAccess
      tags:
      - Role Policy
  /?Action=DeleteRolePolicy:
    post:
      operationId: DeleteRolePolicy
      summary: Delete Role Policy
      description: Deletes the specified inline policy that is embedded in the specified IAM role. A role can also have managed policies attached to it. To detach a managed policy from a role, use DetachRolePolicy. For more information about policies, refer to Managed policies and inline policies in the IAM User Guide.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                type: string
        '409':
          description: LimitExceededException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/LimitExceededException'
        '404':
          description: NoSuchEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchEntityException'
        '500':
          description: ServiceFailureException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/ServiceFailureException'
        '400':
          description: UnmodifiableEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/UnmodifiableEntityException'
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: DeleteRolePolicy
                  Version:
                    type: string
                    const: '2010-05-08'
              - $ref: '#/components/schemas/DeleteRolePolicyRequest'
            example:
              RoleName: Test-Role
              PolicyName: ExamplePolicy
      tags:
      - Role Policy
  /?Action=DetachRolePolicy:
    post:
      operationId: DetachRolePolicy
      summary: Detach Role Policy
      description: Removes the specified managed policy from the specified role. A role can also have inline policies embedded with it. To delete an inline policy, use DeleteRolePolicy. For information about policies, see Managed policies and inline policies in the IAM User Guide.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                type: string
        '400':
          description: InvalidInputException; UnmodifiableEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/InvalidInputException'
        '409':
          description: LimitExceededException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/LimitExceededException'
        '404':
          description: NoSuchEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchEntityException'
        '500':
          description: ServiceFailureException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/ServiceFailureException'
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: DetachRolePolicy
                  Version:
                    type: string
                    const: '2010-05-08'
              - $ref: '#/components/schemas/DetachRolePolicyRequest'
      tags:
      - Role Policy
  /?Action=GetRolePolicy:
    post:
      operationId: GetRolePolicy
      summary: Get Role Policy
      description: Retrieves the specified inline policy document that is embedded with the specified IAM role. Policies returned by this operation are URL-encoded compliant with RFC 3986. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the decode method of the java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs provide similar functionality, and some SDKs do this decoding automatically. An IAM role can also have managed policies attached to it. To retrieve a managed policy document that is attached to a role, use GetPolicy to determine the policy's default version, then use GetPolicyVersion to retrieve the policy document. For more information about policies, see Managed policies and inline policies in the IAM User Guide. For more information about roles, see IAM roles in the IAM User Guide.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/GetRolePolicyResponse'
        '404':
          description: NoSuchEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchEntityException'
        '500':
          description: ServiceFailureException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/ServiceFailureException'
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: GetRolePolicy
                  Version:
                    type: string
                    const: '2010-05-08'
              - $ref: '#/components/schemas/GetRolePolicyRequest'
      tags:
      - Role Policy
  /?Action=ListRolePolicies:
    post:
      operationId: ListRolePolicies
      summary: List Role Policies
      description: Lists the names of the inline policies that are embedded in the specified IAM role. An IAM role can also have managed policies attached to it. To list the managed policies that are attached to a role, use ListAttachedRolePolicies. For more information about policies, see Managed policies and inline policies in the IAM User Guide. You can paginate the results using the MaxItems and Marker parameters. If there are no inline policies embedded with the specified role, the operation returns an empty list.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/ListRolePoliciesResponse'
        '404':
          description: NoSuchEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchEntityException'
        '500':
          description: ServiceFailureException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/ServiceFailureException'
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: ListRolePolicies
                  Version:
                    type: string
                    const: '2010-05-08'
              - $ref: '#/components/schemas/ListRolePoliciesRequest'
      tags:
      - Role Policy
  /?Action=PutRolePolicy:
    post:
      operationId: PutRolePolicy
      summary: Put Role Policy
      description: Adds or updates an inline policy document that is embedded in the specified IAM role. When you embed an inline policy in a role, the inline policy is used as part of the role's access (permissions) policy. The role's trust policy is created at the same time as the role, using CreateRole . You can update a role's trust policy using UpdateAssumeRolePolicy . For more information about roles, see IAM roles in the IAM User Guide. A role can also have a managed policy attached to it. To attach a managed policy to a role, use AttachRolePolicy . To create a new managed policy, use CreatePolicy . For information about policies, see Managed policies and inline policies in the IAM User Guide. For information about the maximum number of inline policies that you can embed with a role, see IAM and STS quotas in the IAM User Guide. Because policy documents can be large, you should use POST rather than GET when calling PutRolePolicy. For general information about using the Query API with IAM, see Making query requests in the IAM User Guide.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                type: string
        '409':
          description: LimitExceededException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/LimitExceededException'
        '400':
          description: MalformedPolicyDocumentException; UnmodifiableEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/MalformedPolicyDocumentException'
        '404':
          description: NoSuchEntityException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchEntityException'
        '500':
          description: ServiceFailureException
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/ServiceFailureException'
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - type: object
                required:
                - Action
                - Version
                properties:
                  Action:
                    type: string
                    const: PutRolePolicy
                  Version:
                    type: string
                    const: '2010-05-08'
              - $ref: '#/components/schemas/PutRolePolicyRequest'
            example:
              RoleName: S3Access
              PolicyName: S3AccessPolicy
              PolicyDocument: '{"Version":"2012-10-17","Statement":{"Effect":"Allow","Action":"s3:*","Resource":"*"}}'
      tags:
      - Role Policy
components:
  schemas:
    MalformedPolicyDocumentException:
      type: object
      properties:
        message:
          type: string
    ListRolePoliciesResponse:
      type: object
      properties:
        PolicyNames:
          type: array
          items:
            type: string
          description: A list of policy names.
        IsTruncated:
          type: boolean
          description: A flag that indicates whether there are more items to return. If your results were truncated, you can make a subsequent pagination request using the Marker request parameter to retrieve more items. Note that IAM might return fewer than the MaxItems number of results even when there are more results available. We recommend that you check IsTruncated after every call to ensure that you receive all your results.
        Marker:
          type: string
          description: When IsTruncated is true, this element is present and contains the value to use for the Marker parameter in a subsequent pagination request.
      required:
      - PolicyNames
    NoSuchEntityException:
      type: object
      properties:
        message:
          type: string
    GetRolePolicyRequest:
      type: object
      properties:
        RoleName:
          type: string
          description: 'The name of the role associated with the policy. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
        PolicyName:
          type: string
          description: 'The name of the policy document to get. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
      required:
      - RoleName
      - PolicyName
    DetachRolePolicyRequest:
      type: object
      properties:
        RoleName:
          type: string
          description: 'The name (friendly name, not ARN) of the IAM role to detach the policy from. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
        PolicyArn:
          type: string
          description: The Amazon Resource Name (ARN) of the IAM policy you want to detach. For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
      required:
      - RoleName
      - PolicyArn
    LimitExceededException:
      type: object
      properties:
        message:
          type: string
    PutRolePolicyRequest:
      type: object
      properties:
        RoleName:
          type: string
          description: 'The name of the role to associate the policy with. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
        PolicyName:
          type: string
          description: 'The name of the policy document. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
        PolicyDocument:
          type: string
          description: 'The policy document. You must provide policies in JSON format in IAM. However, for CloudFormation templates formatted in YAML, you can provide the policy in JSON or YAML format. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM. The regex pattern used to validate this parameter is a string of characters consisting of the following: Any printable ASCII character ranging from the space character (\u0020) through the end of the ASCII character range The printable characters in the Basic Latin and Latin-1 Supplement character set (through \u00FF) The special c'
      required:
      - RoleName
      - PolicyName
      - PolicyDocument
    DeleteRolePolicyRequest:
      type: object
      properties:
        RoleName:
          type: string
          description: 'The name (friendly name, not ARN) identifying the role that the policy is embedded in. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
        PolicyName:
          type: string
          description: 'The name of the inline policy to delete from the specified IAM role. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
      required:
      - RoleName
      - PolicyName
    UnmodifiableEntityException:
      type: object
      properties:
        message:
          type: string
    AttachRolePolicyRequest:
      type: object
      properties:
        RoleName:
          type: string
          description: 'The name (friendly name, not ARN) of the role to attach the policy to. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
        PolicyArn:
          type: string
          description: The Amazon Resource Name (ARN) of the IAM policy you want to attach. For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
      required:
      - RoleName
      - PolicyArn
    InvalidInputException:
      type: object
      properties:
        message:
          type: string
    GetRolePolicyResponse:
      type: object
      properties:
        RoleName:
          type: string
          description: The role the policy is associated with.
        PolicyName:
          type: string
          description: The name of the policy.
        PolicyDocument:
          type: string
          description: The policy document. IAM stores policies in JSON format. However, resources that were created using CloudFormation templates can be formatted in YAML. CloudFormation always converts a YAML policy to JSON format before submitting it to IAM.
      required:
      - RoleName
      - PolicyName
      - PolicyDocument
    ListRolePoliciesRequest:
      type: object
      properties:
        RoleName:
          type: string
          description: 'The name of the role to list policies for. This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-'
        Marker:
          type: string
          description: Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.
        MaxItems:
          type: integer
          description: Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true. If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true, and Marker contains a value to include in the subsequent call that tells the service where to continue from.
      required:
      - RoleName
    ServiceFailureException:
      type: object
      properties:
        message:
          type: string
  securitySchemes:
    sigv4:
      type: apiKey
      in: header
      name: Authorization
      description: AWS Signature Version 4. The Authorization header carries an AWS4-HMAC-SHA256 signature over the canonical request, with X-Amz-Date (and X-Amz-Security-Token for temporary credentials). Not a bearer token.
      x-aws-sigv4:
        signingName: iam
x-provenance:
  method: harvested
  publisher: Amazon Web Services
  source: https://raw.githubusercontent.com/aws/api-models-aws/582e55931c45b944739742a2c1620b6026dd2d13/models/iam/service/2010-05-08/iam-2010-05-08.json
  note: converted by smithy-to-openapi.py from AWS's Smithy model (roadmap#1001)