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

# Add student

> Create a new student record in the system.

Creates a new student and persists it to the database. Returns the created student object including the generated `_id`.

<Info>
  This endpoint does not require authentication. It is publicly accessible.
</Info>

## Request body

<ParamField body="name" type="string" required>
  Full name of the student.
</ParamField>

<ParamField body="email" type="string" required>
  Email address of the student. Used for identification and communication.
</ParamField>

<ParamField body="class" type="string" required>
  The class (grade level) the student is enrolled in, for example `"10"` or `"Grade 5"`.
</ParamField>

<ParamField body="section" type="string" required>
  The section within the class, for example `"A"` or `"B"`.
</ParamField>

<ParamField body="rollNumber" type="number" required>
  The student's unique roll number within their class and section.
</ParamField>

## Response

Returns the newly created student object.

<ResponseField name="_id" type="string" required>
  MongoDB-generated unique identifier for the student.
</ResponseField>

<ResponseField name="name" type="string" required>
  Full name of the student.
</ResponseField>

<ResponseField name="email" type="string" required>
  Email address of the student.
</ResponseField>

<ResponseField name="class" type="string" required>
  The class the student is enrolled in.
</ResponseField>

<ResponseField name="section" type="string" required>
  The section within the class.
</ResponseField>

<ResponseField name="rollNumber" type="number" required>
  The student's roll number.
</ResponseField>

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

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://your-api-host/api/student/add \
    --header 'Content-Type: application/json' \
    --data '{
      "name": "Priya Sharma",
      "email": "priya.sharma@school.edu",
      "class": "10",
      "section": "A",
      "rollNumber": 42
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "_id": "64f1a2b3c4d5e6f7a8b9c0d1",
    "name": "Priya Sharma",
    "email": "priya.sharma@school.edu",
    "class": "10",
    "section": "A",
    "rollNumber": 42,
    "__v": 0
  }
  ```
</ResponseExample>
