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

# Replace a policy's application list

> Replaces the set of applications attached to a policy. The provided list fully overwrites the policy's current applications (it is not additive).



## OpenAPI

````yaml PUT /api/v1/policies/{policy_id}/applications
openapi: 3.0.0
info:
  description: REST API for AccessOwl third-party integrations
  title: AccessOwl API
  version: 1.0.0
servers:
  - url: https://api.accessowl.com
    variables: {}
security:
  - bearer: []
tags: []
paths:
  /api/v1/policies/{policy_id}/applications:
    put:
      tags:
        - policies
      summary: Replace a policy's application list
      description: >-
        Replaces the set of applications attached to a policy. The provided list
        fully overwrites the policy's current applications (it is not additive).
      operationId: AccessOwlApi.PolicyController.set_applications
      parameters:
        - description: >-
            Optional key (1–255 chars) for safely retrying a request. Reusing
            the same key for the same request returns `409 Conflict` and is not
            processed again — this confirms the request was already received.
            Keys are retained for 14 days.
          in: header
          name: Idempotency-Key
          required: false
          schema:
            maxLength: 255
            minLength: 1
            type: string
        - description: ''
          in: path
          name: policy_id
          required: true
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetApplications'
        description: Set applications parameters
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Policy'
          description: Policy
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
          description: Bad request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictError'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
          description: Validation error
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
          description: Too many requests
          headers:
            Retry-After:
              description: Seconds to wait before retrying
              schema:
                type: integer
              style: simple
      callbacks: {}
components:
  schemas:
    SetApplications:
      description: >-
        Replaces a policy's complete application list. `application_ids` fully
        replace the policy's applications (empty list clears them).
      example:
        application_ids:
          - 7488a646-e31f-11e4-aace-600308960670
        elevated: false
      properties:
        application_ids:
          description: The complete set of application IDs for this policy.
          items:
            format: uuid
            type: string
          type: array
        elevated:
          default: false
          description: When true, the policy applies only to elevated access requests.
          type: boolean
      required:
        - application_ids
      title: SetApplications
      type: object
    Policy:
      description: >-
        A policy that gates access requests for a list of applications. When
        elevated, the policy applies only to elevated access requests; otherwise
        it applies to all access requests. Assign applications via PUT
        /policies/{id}/applications.
      example:
        application_ids:
          - 8599b757-f42a-22f5-bbdf-711419071781
        approval_steps:
          - approver_types:
              - manager
            specific_approver_user_ids: []
            step: 1
            strategy: first_to_respond
        default_policy: false
        elevated: false
        id: 7488a646-e31f-11e4-aace-600308960670
        inserted_at: '2023-01-01T00:00:00Z'
        lock_version: 1
        title: Engineering manager approval
        updated_at: '2023-01-01T00:00:00Z'
      properties:
        application_ids:
          description: IDs of the applications this policy applies to
          items:
            format: uuid
            type: string
          type: array
        approval_steps:
          description: >-
            The approval path: the ordered steps a matching access request must
            pass. An empty list means the policy auto-approves (no approval
            needed).
          items:
            properties:
              approver_types:
                description: Role-based approvers for this step
                items:
                  enum:
                    - manager
                    - application_admin
                    - business_owner
                  type: string
                type: array
              specific_approver_user_ids:
                description: Specific users named as approvers for this step
                items:
                  format: uuid
                  type: string
                type: array
              step:
                description: 1-based position of the step in the approval path
                type: integer
              strategy:
                description: >-
                  How the step is satisfied: `first_to_respond` needs a single
                  approval, `all` needs every approver to approve
                enum:
                  - first_to_respond
                  - all
                type: string
            type: object
          type: array
        default_policy:
          description: Whether this is the default policy
          type: boolean
        elevated:
          description: When true, the policy applies only to elevated access requests
          type: boolean
        id:
          description: Policy ID
          format: uuid
          type: string
        inserted_at:
          format: date-time
          type: string
        lock_version:
          description: Optimistic lock version
          type: integer
        title:
          description: Policy title
          type: string
        updated_at:
          format: date-time
          type: string
      required:
        - id
        - title
        - default_policy
        - elevated
        - approval_steps
      title: Policy
      type: object
    BadRequestError:
      additionalProperties: false
      description: Error response for a malformed or invalid request
      example:
        error: invalid_params
        errors:
          - field: application_id
            messages:
              - is invalid
        message: Invalid request parameters
      properties:
        error:
          description: >-
            `invalid_params` when a parameter or the body fails validation;
            `bad_request` or `idempotency_key_invalid_length` otherwise
          example: invalid_params
          type: string
        errors:
          description: >-
            One entry per rejected parameter. Present when a query or path
            parameter or the body fails validation, and omitted for other bad
            requests.
          items:
            additionalProperties: false
            properties:
              field:
                description: Name of the rejected parameter
                example: application_id
                type: string
              messages:
                description: Reasons the value was rejected
                example:
                  - is invalid
                items:
                  type: string
                type: array
            required:
              - field
              - messages
            type: object
          type: array
        message:
          description: Human-readable error message
          example: Invalid request parameters
          type: string
      required:
        - error
        - message
      title: BadRequestError
      type: object
    UnauthorizedError:
      additionalProperties: false
      description: >-
        The bearer token is missing, malformed or not valid. Unlike other
        errors, this body carries no error code and no `message`.
      example:
        error: Invalid bearer token.
      properties:
        error:
          description: Human-readable reason the token was refused
          example: Invalid bearer token.
          type: string
      required:
        - error
      title: UnauthorizedError
      type: object
    ForbiddenError:
      additionalProperties: false
      description: >-
        The API token's scopes or the user's role do not allow this action on
        this record
      example:
        error: forbidden
        message: Access denied
      properties:
        error:
          enum:
            - forbidden
          type: string
        message:
          example: Access denied
          type: string
      required:
        - error
        - message
      title: ForbiddenError
      type: object
    Error:
      description: Standard error response
      example:
        error: not_found
        message: Resource not found
      properties:
        error:
          description: Error code
          example: not_found
          type: string
        message:
          description: Human-readable error message
          example: Resource not found
          type: string
      required:
        - error
        - message
      title: Error
      type: object
    ConflictError:
      additionalProperties: false
      description: The request conflicts with an earlier request or a concurrent change
      example:
        error: idempotency_key_already_used
        message: This idempotency key has already been used
      properties:
        error:
          description: >-
            `idempotency_key_already_used` when the `Idempotency-Key` was
            already used for this request; `conflict` when the record was
            changed concurrently or the `lock_version` is stale
          enum:
            - idempotency_key_already_used
            - conflict
          type: string
        message:
          example: This idempotency key has already been used
          type: string
      required:
        - error
        - message
      title: ConflictError
      type: object
    ValidationError:
      additionalProperties: false
      description: The request is well-formed but cannot be carried out
      example:
        error: validation_failed
        errors:
          status:
            - access request was already granted
        message: The request contains invalid data
      properties:
        detail:
          description: Present on `idempotency_key_params_mismatch`
          type: string
        error:
          description: >-
            `validation_failed` for invalid data or a record in the wrong state;
            `validation_error` (without `errors`) when a bulk access request has
            a blank `request_reason`; `idempotency_key_params_mismatch` when the
            `Idempotency-Key` was already used with a different body
          example: validation_failed
          type: string
        errors:
          additionalProperties:
            items:
              oneOf:
                - type: string
                - type: object
            type: array
          description: >-
            Reasons, keyed by field. For a field that is a list (such as
            `access` rows), the entry holds one object per list item, keyed the
            same way and empty for a valid item. Present on `validation_failed`.
          type: object
        message:
          example: The request contains invalid data
          type: string
      required:
        - error
        - message
      title: ValidationError
      type: object
    RateLimitError:
      additionalProperties: false
      description: More than 1000 requests in an hour were made with this token
      example:
        error: rate_limit_exceeded
        message: Too many requests. Please retry after 1200 seconds.
      properties:
        error:
          enum:
            - rate_limit_exceeded
          type: string
        message:
          example: Too many requests. Please retry after 1200 seconds.
          type: string
      required:
        - error
        - message
      title: RateLimitError
      type: object
  securitySchemes:
    bearer:
      description: >-
        Bearer token authentication. Pass your AccessOwl API token in the
        `Authorization` header as `Bearer <token>`.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.