> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mottostreaming.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set iam policy

> SetIamPolicy

 Set IAM policy for a resource.
 This method replaces all existing policy bindings for the resource.
 To prevent overwriting existing policy bindings that were written concurrently, use the etag field
 to perform a read-modify-write operation.
 For example: Making a new account to become a resource owner would require reading IAM Policy
 for the resource, add new binding or update existing binding with role_id: owner,
 and then set the new policy with etag returned by GetIamPolicy.



## OpenAPI

````yaml put /iam/auth/v1/policies/{resource_key}
openapi: 3.0.3
info:
  title: Studio API - Motto
  version: 0.0.0
servers:
  - url: https://api.mottostreaming.com
    description: Production server
security:
  - BearerAuth: []
tags:
  - name: AccountService
    description: Account management service
  - name: ActionConfigurationService
    description: Action configuration service definition
  - name: ActionSecretService
    description: Action type service definition
  - name: ActionService
    description: Action service definition
  - name: ActionTypeService
    description: Action type service definition
  - name: ActivityService
    description: Activity service definition
  - name: AdService
    description: Ad management service.
  - name: AnnotationService
    description: Annotation service definition
  - name: AnnotationSetService
    description: Annotation service definition
  - name: AnnotationTypeService
    description: Annotation service definition
  - name: AssetService
    description: Asset management service.
  - name: AuthService
    description: Auth service definition
  - name: BannerService
    description: Banner service definition
  - name: BannerV2Service_v2
    description: Banner service definition
  - name: CleengService
    description: CleengService service definition
  - name: ClipService
    description: ClipService is the service that handles Clip operations.
  - name: ConfigurationService
    description: >-
      Configuration management service. These configurations allow modifying the
      behavior of streams, uploads, simulcasts, etc.
  - name: ContentTypeService
    description: ContentType service definition
  - name: CreativeWorkService
    description: CreativeWork service definition
  - name: EntitlementService
    description: Entitlement service definition
  - name: EntityService
    description: Entity service definition
  - name: EventService
    description: Event service definition
  - name: FileService
    description: OTT files management.
  - name: IngestService
    description: Ingest management service.
  - name: IngestService_v2
    description: Ingest management service.
  - name: LiveStreamService
    description: LiveStream management service.
  - name: LiveStreamService_v2
    description: LiveStream management service.
  - name: OfferService
    description: Offer service definition
  - name: OrganizationService
    description: Organization management service.
  - name: PageService
    description: Page service definition
  - name: PlatformService
    description: Platform service definition
  - name: PlaylistService
    description: Playlist management service.
  - name: ProjectService
    description: Project management service.
  - name: SimulcastService
    description: Simulcast management service.
  - name: SlugService
    description: Slug service definition
  - name: SpiideoService
    description: SpiideoService service definition
  - name: StandingService
    description: Standing service definition
  - name: StitcherService
    description: StitcherService is the service that handles stitching operations.
  - name: StripeService
    description: StripeService service definition
  - name: SubscriptionService
    description: Subscription service definition
  - name: SubtitleService
    description: SubtitleService is the service that handles Subtitle operations.
  - name: TransactionService
    description: Transaction service definition
  - name: UploadService
    description: Upload management service.
  - name: UsageService
    description: The UsageService provides methods to retrieve usage data for SKUs.
  - name: UserService
    description: User management service
  - name: VODService
    description: VODService is the service that handles VOD operations.
  - name: VODService_v2
    description: VODService is the service that handles VOD operations.
  - name: VideoProtectionService
    description: VideoProtection management service.
  - name: VideoProtectionService_v2
    description: VideoProtection management service.
  - name: VideoService
    description: Video management service.
paths:
  /iam/auth/v1/policies/{resource_key}:
    put:
      tags:
        - AuthService
      description: |-
        SetIamPolicy

         Set IAM policy for a resource.
         This method replaces all existing policy bindings for the resource.
         To prevent overwriting existing policy bindings that were written concurrently, use the etag field
         to perform a read-modify-write operation.
         For example: Making a new account to become a resource owner would require reading IAM Policy
         for the resource, add new binding or update existing binding with role_id: owner,
         and then set the new policy with etag returned by GetIamPolicy.
      operationId: AuthService_SetIamPolicy
      parameters:
        - name: resource_key
          in: path
          description: |-
            A resource key for which policy is being set.

             For organizations, this key consists of two components: the organization ID and string "organization", joined by a forward slash.
             For all other resources, this key consists of three components: the resource ID, the project ID, and the resource type (e.g. "event" or project"),
             joined by forward slashes (for projects specifically, this contains the same resource ID twice).

             Examples:
             For organization "example", use `example/organization`
             For project "demo", use `demo/demo/project`
             For event "r8efdFD9sMSaa93" inside the project "demo", use `r8efdFD9sMSaa93/demo/event`
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/motto.iam.auth.v1.SetIamPolicyRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/motto.iam.auth.v1.SetIamPolicyResponse'
        default:
          description: Default error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/google.rpc.Status'
components:
  schemas:
    motto.iam.auth.v1.SetIamPolicyRequest:
      required:
        - resource_key
        - policy
      type: object
      properties:
        resource_key:
          type: string
          description: |-
            A resource key for which policy is being set.

             For organizations, this key consists of two components: the organization ID and string "organization", joined by a forward slash.
             For all other resources, this key consists of three components: the resource ID, the project ID, and the resource type (e.g. "event" or project"),
             joined by forward slashes (for projects specifically, this contains the same resource ID twice).

             Examples:
             For organization "example", use `example/organization`
             For project "demo", use `demo/demo/project`
             For event "r8efdFD9sMSaa93" inside the project "demo", use `r8efdFD9sMSaa93/demo/event`
        policy:
          allOf:
            - $ref: '#/components/schemas/motto.iam.auth.v1.Policy'
          description: New policy value to set for the resource
        etag:
          type: string
          description: >-
            If not empty, the request succeeds only if value matches the
            currently stored IAM policy
          format: bytes
    motto.iam.auth.v1.SetIamPolicyResponse:
      type: object
      properties: {}
      description: When there is no error result is empty
    google.rpc.Status:
      type: object
      properties:
        code:
          type: integer
          description: >-
            The status code, which should be an enum value of
            [google.rpc.Code][google.rpc.Code].
          format: int32
        message:
          type: string
          description: >-
            A developer-facing error message, which should be in English. Any
            user-facing error message should be localized and sent in the
            [google.rpc.Status.details][google.rpc.Status.details] field, or
            localized by the client.
        details:
          type: array
          items:
            $ref: '#/components/schemas/google.protobuf.Any'
          description: >-
            A list of messages that carry the error details.  There is a common
            set of message types for APIs to use.
      description: >-
        The `Status` type defines a logical error model that is suitable for
        different programming environments, including REST APIs and RPC APIs. It
        is used by [gRPC](https://github.com/grpc). Each `Status` message
        contains three pieces of data: error code, error message, and error
        details. You can find out more about this error model and how to work
        with it in the [API Design
        Guide](https://cloud.google.com/apis/design/errors).
    motto.iam.auth.v1.Policy:
      type: object
      properties:
        bindings:
          type: array
          items:
            $ref: '#/components/schemas/motto.iam.auth.v1.Binding'
          description: >-
            List of bindings to the policy. If empty, the policy will not have
            any effect.
             Total number of accounts referenced in the bindings should be up to 1500.
             If same account has multiple roles - it is counted multiple times.
      description: Authorization policy.
    google.protobuf.Any:
      type: object
      properties:
        '@type':
          type: string
          description: The type of the serialized message.
      additionalProperties: true
      description: >-
        Contains an arbitrary serialized message along with a @type that
        describes the type of the serialized message.
    motto.iam.auth.v1.Binding:
      type: object
      properties:
        role_id:
          type: string
          description: >-
            Role ID - it can be either a predefined role ID (`owner`,
            `projects.admin`) or custom role ID
            (`projects:PROJECT_ID:role:ROLE_ID`)
        account_ids:
          type: array
          items:
            type: string
          description: >-
            List of account identifiers (referencing
            `motto.iam.account.v1.Account`) that have the role.
        all_organization_accounts:
          type: boolean
          description: >-
            If true, the role is granted to any account that has at least one
            binding to the organization or its descendant resources.
      description: Associates `account_ids` with a `role`.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````