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

# Approve a change of a request

> Approve the pending change of an approved request on behalf of the user who created the API token. Only the approvers of the change (or an admin) can do this. When the last needed approval is in, the change is applied, the request gets the next revision and `change.status` becomes `applied`; otherwise it stays `pending`. Fails with 409 when the change is no longer pending or when `revision` does not match the request, and with 400 when the allowance no longer covers the change.



## OpenAPI

````yaml https://api.absentify.com/api/v1/openapi.json post /requests/{id}/changes/{changeId}/approve
openapi: 3.1.0
info:
  title: absentify CRUD API
  description: OpenAPI compliant REST API
  version: 1.0.0
servers:
  - url: https://api.absentify.com/api/v1
security: []
tags:
  - name: Departments
  - name: Leave types
  - name: Members
  - name: Requests
  - name: Public holidays
  - name: Workspace
  - name: Absences
  - name: Allowance Management
  - name: Out of office
externalDocs:
  url: https://absentify.com/docs/en/api-reference
paths:
  /requests/{id}/changes/{changeId}/approve:
    post:
      tags:
        - Requests
      summary: Approve a change of a request
      description: >-
        Approve the pending change of an approved request on behalf of the user
        who created the API token. Only the approvers of the change (or an
        admin) can do this. When the last needed approval is in, the change is
        applied, the request gets the next revision and `change.status` becomes
        `applied`; otherwise it stays `pending`. Fails with 409 when the change
        is no longer pending or when `revision` does not match the request, and
        with 400 when the allowance no longer covers the change.
      operationId: request-approveRequestChange
      parameters:
        - in: path
          name: id
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
          required: true
        - in: path
          name: changeId
          schema:
            type: integer
            exclusiveMinimum: 0
            maximum: 9007199254740991
          required: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                revision:
                  description: >-
                    Revision you last saw (from GET /requests/{id} or the
                    webhook). If the request was changed since, the call fails
                    with 409 and nothing happens.
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 9007199254740991
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  change:
                    type: object
                    properties:
                      id:
                        type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      revision:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                        description: >-
                          The revision the request gets when this change is
                          applied. Null while the change is pending, declined or
                          withdrawn.
                      kind:
                        type: string
                        enum:
                          - reason
                          - shortened
                          - extended
                          - moved
                          - leave_type
                      status:
                        type: string
                        enum:
                          - pending
                          - approved
                          - declined
                          - withdrawn
                          - applied
                        description: >-
                          `pending` waits for approvers, `applied` is in force,
                          `declined` and `withdrawn` never changed the request.
                      previous:
                        type: object
                        properties:
                          start:
                            type: string
                          end:
                            type: string
                          start_at:
                            type: string
                            enum:
                              - morning
                              - afternoon
                            description: >-
                              For day-based leave types: whether the absence
                              starts in the `morning` (the whole first day
                              counts) or `afternoon` (only the second half of
                              the first day). Ignored for hour-based leave
                              types.
                          end_at:
                            type: string
                            enum:
                              - lunchtime
                              - end_of_day
                            description: >-
                              For day-based leave types: whether the absence
                              ends at `lunchtime` (only the first half of the
                              last day) or `end_of_day` (the whole last day
                              counts). Ignored for hour-based leave types.
                          leave_type:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                            required:
                              - id
                              - name
                            additionalProperties: false
                          duration:
                            type: number
                          workday_absence_duration:
                            type: number
                          reason:
                            anyOf:
                              - type: string
                              - type: 'null'
                        required:
                          - start
                          - end
                          - start_at
                          - end_at
                          - leave_type
                          - duration
                          - workday_absence_duration
                          - reason
                        additionalProperties: false
                        description: The request as it was before this change.
                      proposed:
                        type: object
                        properties:
                          start:
                            type: string
                          end:
                            type: string
                          start_at:
                            type: string
                            enum:
                              - morning
                              - afternoon
                            description: >-
                              For day-based leave types: whether the absence
                              starts in the `morning` (the whole first day
                              counts) or `afternoon` (only the second half of
                              the first day). Ignored for hour-based leave
                              types.
                          end_at:
                            type: string
                            enum:
                              - lunchtime
                              - end_of_day
                            description: >-
                              For day-based leave types: whether the absence
                              ends at `lunchtime` (only the first half of the
                              last day) or `end_of_day` (the whole last day
                              counts). Ignored for hour-based leave types.
                          leave_type:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                            required:
                              - id
                              - name
                            additionalProperties: false
                          duration:
                            type: number
                          workday_absence_duration:
                            type: number
                          reason:
                            anyOf:
                              - type: string
                              - type: 'null'
                        required:
                          - start
                          - end
                          - start_at
                          - end_at
                          - leave_type
                          - duration
                          - workday_absence_duration
                          - reason
                        additionalProperties: false
                        description: >-
                          The request as this change wants it. Only for
                          `applied` changes is this what is in force.
                      changed_by:
                        anyOf:
                          - type: object
                            properties:
                              id:
                                type: string
                              name:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                            required:
                              - id
                              - name
                            additionalProperties: false
                          - type: 'null'
                      decided_by:
                        anyOf:
                          - type: object
                            properties:
                              id:
                                type: string
                              name:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                            required:
                              - id
                              - name
                            additionalProperties: false
                          - type: 'null'
                      created_at:
                        type: string
                      decided_at:
                        anyOf:
                          - type: string
                          - type: 'null'
                      decision_reason:
                        anyOf:
                          - type: string
                          - type: 'null'
                    required:
                      - id
                      - revision
                      - kind
                      - status
                      - previous
                      - proposed
                      - changed_by
                      - decided_by
                      - created_at
                      - decided_at
                      - decision_reason
                    additionalProperties: false
                required:
                  - success
                  - message
                  - change
                additionalProperties: false
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Authorization not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
        '403':
          description: Insufficient access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.FORBIDDEN'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
      security:
        - ApiKey: []
components:
  schemas:
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Invalid input data error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.UNAUTHORIZED:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Authorization not provided
        code:
          type: string
          description: The error code
          example: UNAUTHORIZED
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Authorization not provided error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Authorization not provided
        issues: []
    error.FORBIDDEN:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Insufficient access
        code:
          type: string
          description: The error code
          example: FORBIDDEN
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Insufficient access error (403)
      description: The error information
      example:
        code: FORBIDDEN
        message: Insufficient access
        issues: []
    error.INTERNAL_SERVER_ERROR:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Internal server error
        code:
          type: string
          description: The error code
          example: INTERNAL_SERVER_ERROR
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Internal server error error (500)
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
  securitySchemes:
    ApiKey:
      type: apiKey
      name: X-API-KEY
      in: header

````

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