> ## 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.

# Send application

> Submit a new application from a student to a teacher.

Creates a new application record and saves it to the database. The application status is automatically set to `PENDING` upon creation.

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

## Request body

<ParamField body="studentId" type="string" required>
  The MongoDB ObjectId of the student submitting the application.
</ParamField>

<ParamField body="teacherId" type="string" required>
  The MongoDB ObjectId of the teacher the application is directed to.
</ParamField>

<ParamField body="type" type="string" required>
  The category of the application. Common values: `LEAVE`, `COMPLAINT`, `REQUEST`.
</ParamField>

<ParamField body="message" type="string" required>
  The body text of the application describing the student's request or complaint.
</ParamField>

## Response

Returns the newly created application object.

<ResponseField name="_id" type="string">
  The unique MongoDB ObjectId assigned to 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 current status of the application. Always `PENDING` on creation.
</ResponseField>

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

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url http://localhost:5000/api/application/send \
    --header 'Content-Type: application/json' \
    --data '{
      "studentId": "64a1f2c3e4b0d5f6a7b8c9d0",
      "teacherId": "64a1f2c3e4b0d5f6a7b8c9d1",
      "type": "LEAVE",
      "message": "I need to take a leave of absence from January 20 to January 25."
    }'
  ```
</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": "PENDING",
    "__v": 0
  }
  ```
</ResponseExample>
