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

# Approve application

> Approve a pending application by its ID.

Updates an existing application's status to `APPROVED`. The application is located by its MongoDB ObjectId supplied as a path parameter.

<Note>
  No authentication is required to call this endpoint.
</Note>

## Path parameters

<ParamField path="id" type="string" required>
  The MongoDB ObjectId of the application to approve.
</ParamField>

## Response

Returns the updated application object with `status` set to `APPROVED`.

<ResponseField name="_id" type="string">
  The unique MongoDB ObjectId of the application.
</ResponseField>

<ResponseField name="studentId" type="string">
  The MongoDB ObjectId of the student who submitted the application.
</ResponseField>

<ResponseField name="teacherId" type="string">
  The MongoDB ObjectId of the teacher the application is addressed to.
</ResponseField>

<ResponseField name="type" type="string">
  The application category (e.g., `LEAVE`, `COMPLAINT`, `REQUEST`).
</ResponseField>

<ResponseField name="message" type="string">
  The application message body.
</ResponseField>

<ResponseField name="status" type="string">
  The updated status of the application. Always `APPROVED` after a successful call.
</ResponseField>

<ResponseField name="__v" type="number">
  Internal MongoDB document version key.
</ResponseField>

<Warning>
  If the provided `id` does not match any application, the server will return `null`. Ensure the ObjectId is valid and exists before calling this endpoint.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl --request PUT \
    --url http://localhost:5000/api/application/approve/64b3e7a2f1c0d2e3a4b5c6d7
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "_id": "64b3e7a2f1c0d2e3a4b5c6d7",
    "studentId": "64a1f2c3e4b0d5f6a7b8c9d0",
    "teacherId": "64a1f2c3e4b0d5f6a7b8c9d1",
    "type": "LEAVE",
    "message": "I need to take a leave of absence from January 20 to January 25.",
    "status": "APPROVED",
    "__v": 0
  }
  ```
</ResponseExample>
