📚 Peek-a-Boo API Documentation

Complete REST API Reference for Childcare Management System

🔐 Authentication

POST /auth/login

Authenticate a user and receive a JWT token

Request Body

email string required
User's email address
password string required
User's password

Example Request

{
  "email": "admin@p-b.app",
  "password": "Admin@2025"
}

Example Response (200 OK)

{
  "success": true,
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMTAiLCJyb2xlIjoic3VwZXJfYWRtaW4iLCJleHAiOjE3MzcxNjgwMDB9.abc123...",
  "user": {
    "id": "20a100c8-ece2-11f0-b1c2-00163e8be9bd",
    "email": "admin@p-b.app",
    "role": "super_admin",
    "first_name": "Admin",
    "last_name": "User"
  }
}
200 OK 401 Unauthorized
Note: All subsequent API requests require the JWT token in the Authorization header: Authorization: Bearer {token}

👶 Children

GET /children
🔒 Requires Authentication

Get all children (filtered by user's centre/permissions)

Example Response (200 OK)

{
  "success": true,
  "data": [
    {
      "child_id": "40e100c8-ece2-11f0-b1c2-00163e8be9bd",
      "first_name": "Ava",
      "last_name": "Jones",
      "date_of_birth": "2022-03-20",
      "preferred_name": "Ava",
      "room_id": "60a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "centre_id": "10772f8c-ece2-11f0-b1c2-00163e8be9bd",
      "is_active": true,
      "dietary_requirements": "No dairy",
      "allergies": "Peanuts"
    },
    {
      "child_id": "41e100c8-ece2-11f0-b1c2-00163e8be9bd",
      "first_name": "Liam",
      "last_name": "Smith",
      "date_of_birth": "2021-08-15",
      "room_id": "60a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "centre_id": "10772f8c-ece2-11f0-b1c2-00163e8be9bd",
      "is_active": true
    }
  ]
}
200 OK 401 Unauthorized
GET /children/{child_id}
🔒 Requires Authentication

Get detailed information about a specific child

URL Parameters

child_id UUID required

Example Response (200 OK)

{
  "success": true,
  "data": {
    "child_id": "40e100c8-ece2-11f0-b1c2-00163e8be9bd",
    "first_name": "Ava",
    "last_name": "Jones",
    "preferred_name": "Ava",
    "date_of_birth": "2022-03-20",
    "room_id": "60a100c8-ece2-11f0-b1c2-00163e8be9bd",
    "room_name": "Toddler Room",
    "centre_id": "10772f8c-ece2-11f0-b1c2-00163e8be9bd",
    "is_active": true,
    "dietary_requirements": "No dairy products",
    "allergies": "Peanuts, tree nuts",
    "medical_conditions": null,
    "emergency_contact_name": "Sarah Jones",
    "emergency_contact_phone": "+1234567890"
  }
}
200 OK 401 Unauthorized 404 Not Found
PUT /children/{child_id}
🔒 Requires Authentication

Update child profile information

Request Body (all fields optional)

first_name string
last_name string
preferred_name string
dietary_requirements text
allergies text

Example Request

{
  "dietary_requirements": "No dairy products, vegetarian",
  "allergies": "Peanuts, tree nuts, eggs",
  "preferred_name": "Ava"
}

Example Response (200 OK)

{
  "success": true,
  "message": "Child profile updated successfully",
  "data": {
    "child_id": "40e100c8-ece2-11f0-b1c2-00163e8be9bd",
    "dietary_requirements": "No dairy products, vegetarian",
    "allergies": "Peanuts, tree nuts, eggs",
    "preferred_name": "Ava"
  }
}
200 OK 401 Unauthorized 404 Not Found
GET /children/{child_id}/parents
🔒 Requires Authentication

Get all parents/guardians linked to a child

Example Response (200 OK)

{
  "success": true,
  "data": [
    {
      "parent_id": "50a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "first_name": "Sarah",
      "last_name": "Jones",
      "relationship": "mother",
      "email": "sarah.jones@example.com",
      "phone": "+1234567890",
      "is_primary_contact": true,
      "can_pickup": true
    },
    {
      "parent_id": "51a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "first_name": "Michael",
      "last_name": "Jones",
      "relationship": "father",
      "email": "michael.jones@example.com",
      "phone": "+1234567891",
      "is_primary_contact": false,
      "can_pickup": true
    }
  ]
}
200 OK 401 Unauthorized

📝 Observations

GET /observations
🔒 Requires Authentication

Get all observations (filtered by permissions)

Example Response (200 OK)

{
  "success": true,
  "data": [
    {
      "observation_id": "70a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "child_id": "40e100c8-ece2-11f0-b1c2-00163e8be9bd",
      "child_name": "Ava Jones",
      "description": "Ava showed excellent problem-solving skills while building with blocks. She demonstrated spatial awareness and persistence.",
      "observation_type": "learning_moment",
      "created_by": "Emily Smith",
      "created_at": "2026-01-12T10:30:00Z"
    },
    {
      "observation_id": "71a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "child_id": "41e100c8-ece2-11f0-b1c2-00163e8be9bd",
      "child_name": "Liam Smith",
      "description": "Liam displayed great creativity in art class today.",
      "observation_type": "achievement",
      "created_by": "Emily Smith",
      "created_at": "2026-01-12T09:15:00Z"
    }
  ]
}
200 OK 401 Unauthorized
POST /observations
🔒 Requires Authentication

Create a new observation for a child

Request Body

child_id UUID required
centre_id UUID required
description text required
The observation content
observation_type enum
learning_moment, achievement, behavior, social_interaction, etc.

Example Request

{
  "child_id": "40e100c8-ece2-11f0-b1c2-00163e8be9bd",
  "centre_id": "10772f8c-ece2-11f0-b1c2-00163e8be9bd",
  "description": "Ava showed excellent problem-solving skills while building with blocks. She demonstrated spatial awareness and persistence when constructing a tall tower.",
  "observation_type": "learning_moment"
}

Example Response (201 Created)

{
  "success": true,
  "message": "Observation created successfully",
  "data": {
    "observation_id": "70a100c8-ece2-11f0-b1c2-00163e8be9bd",
    "child_id": "40e100c8-ece2-11f0-b1c2-00163e8be9bd",
    "centre_id": "10772f8c-ece2-11f0-b1c2-00163e8be9bd",
    "description": "Ava showed excellent problem-solving skills while building with blocks...",
    "observation_type": "learning_moment",
    "created_by_id": "30a100c8-ece2-11f0-b1c2-00163e8be9bd",
    "created_at": "2026-01-12T10:30:00Z"
  }
}
201 Created 400 Bad Request 401 Unauthorized
GET /children/{child_id}/observations
🔒 Requires Authentication

Get all observations for a specific child

Example Response (200 OK)

{
  "success": true,
  "data": [
    {
      "observation_id": "70a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "description": "Showed excellent problem-solving skills",
      "observation_type": "learning_moment",
      "created_by": "Emily Smith",
      "created_at": "2026-01-12T10:30:00Z"
    }
  ]
}
200 OK 401 Unauthorized
PUT /observations/{observation_id}
🔒 Requires Authentication

Update an existing observation

Example Request

{
  "description": "Updated observation: Ava showed even more advanced problem-solving today.",
  "observation_type": "achievement"
}

Example Response (200 OK)

{
  "success": true,
  "message": "Observation updated successfully",
  "data": {
    "observation_id": "70a100c8-ece2-11f0-b1c2-00163e8be9bd",
    "description": "Updated observation: Ava showed even more advanced problem-solving today.",
    "observation_type": "achievement",
    "updated_at": "2026-01-12T11:00:00Z"
  }
}
200 OK 401 Unauthorized 404 Not Found
DELETE /observations/{observation_id}
🔒 Requires Authentication

Delete an observation

Example Response (200 OK)

{
  "success": true,
  "message": "Observation deleted successfully"
}
200 OK 401 Unauthorized 404 Not Found

🚨 Incidents

GET /incidents
🔒 Requires Authentication

Get all incidents

200 OK 401 Unauthorized
POST /incidents
🔒 Requires Authentication

Create a new incident report

Request Body

child_id UUID required
centre_id UUID required
incident_type enum required
minor_injury, major_injury, illness, behavioral, accident, etc.
title string required
description text required
location string required
incident_date date required
incident_time time required
action_taken text required
severity enum required
minor, moderate, major
201 Created 400 Bad Request 401 Unauthorized
GET /children/{child_id}/incidents
🔒 Requires Authentication

Get all incidents for a specific child

200 OK 401 Unauthorized
PUT /incidents/{incident_id}
🔒 Requires Authentication

Update an existing incident

200 OK 401 Unauthorized 404 Not Found
DELETE /incidents/{incident_id}
🔒 Requires Authentication

Delete an incident

200 OK 401 Unauthorized 404 Not Found

💊 Medications

POST /medications
🔒 Requires Authentication

Create a new medication record

Request Body

child_id UUID required
centre_id UUID required
medication_name string required
medication_type enum required
prescription, over_the_counter, emergency
dosage string required
frequency enum required
once_daily, twice_daily, three_times_daily, as_needed, etc.
administration_method enum required
oral, topical, inhaler, injection
reason text required
start_date date required
end_date date
201 Created 400 Bad Request 401 Unauthorized
GET /children/{child_id}/medications
🔒 Requires Authentication

Get all medications for a child

200 OK 401 Unauthorized
PUT /medications/{medication_id}
🔒 Requires Authentication

Update medication details

200 OK 401 Unauthorized 404 Not Found
DELETE /medications/{medication_id}
🔒 Requires Authentication

Delete a medication record

200 OK 401 Unauthorized 404 Not Found

📅 Attendance

GET /attendance/today?centre_id={centre_id}
🔒 Requires Authentication

Get today's attendance for a centre

Query Parameters

centre_id UUID required
room_id UUID
Optional - filter by room
200 OK 400 Bad Request 401 Unauthorized
POST /attendance/check-in
🔒 Requires Authentication

Check in a child

Request Body

child_id UUID required
centre_id UUID required
check_in_time time
Defaults to current time if not provided
201 Created 400 Bad Request 401 Unauthorized
GET /children/{child_id}/attendance
🔒 Requires Authentication

Get attendance history for a child

200 OK 401 Unauthorized

😴 Naps

GET /naps/current?centre_id={centre_id}
🔒 Requires Authentication

Get currently napping children

Query Parameters

centre_id UUID required
200 OK 400 Bad Request 401 Unauthorized
POST /naps/start
🔒 Requires Authentication

Start a nap for a child

Request Body

child_id UUID required
centre_id UUID required
start_time time
Defaults to current time
201 Created 400 Bad Request 401 Unauthorized

📰 Posts/News Feed

GET /posts
🔒 Requires Authentication

Get news feed posts

Example Response (200 OK)

{
  "success": true,
  "data": [
    {
      "post_id": "c0a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "centre_id": "10772f8c-ece2-11f0-b1c2-00163e8be9bd",
      "post_type": "announcement",
      "title": "Important Centre Closure Notice",
      "content": "The centre will be closed on Friday, January 20th for staff training.",
      "visibility": "all_parents",
      "created_by": "Emily Smith",
      "created_at": "2026-01-12T09:00:00Z"
    },
    {
      "post_id": "c1a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "post_type": "celebration",
      "title": "Birthday Celebration",
      "content": "Join us in celebrating Ava's 4th birthday!",
      "visibility": "all_parents",
      "created_by": "Emily Smith",
      "created_at": "2026-01-11T14:00:00Z"
    }
  ]
}
200 OK 401 Unauthorized
POST /posts
🔒 Requires Authentication

Create a new post

Request Body

centre_id UUID required
post_type enum required
announcement, update, reminder, celebration
title string required
content text required
visibility enum required
all_parents, specific_children, specific_rooms, staff_only
201 Created 400 Bad Request 401 Unauthorized
PUT /posts/{post_id}
🔒 Requires Authentication

Update a post

200 OK 401 Unauthorized 404 Not Found
DELETE /posts/{post_id}
🔒 Requires Authentication

Delete a post

200 OK 401 Unauthorized 404 Not Found

🎉 Events

GET /events
🔒 Requires Authentication

Get all events

Example Response (200 OK)

{
  "success": true,
  "data": [
    {
      "event_id": "d0a100c8-ece2-11f0-b1c2-00163e8be9bd",
      "centre_id": "10772f8c-ece2-11f0-b1c2-00163e8be9bd",
      "event_type": "celebration",
      "title": "Spring Family Picnic",
      "description": "Join us for a fun family picnic in the park!",
      "start_date": "2026-03-15",
      "end_date": "2026-03-15",
      "start_time": "11:00:00",
      "end_time": "14:00:00",
      "location": "Central Park",
      "created_by": "Emily Smith",
      "created_at": "2026-01-10T10:00:00Z"
    }
  ]
}
200 OK 401 Unauthorized
POST /events
🔒 Requires Authentication

Create a new event

Request Body

centre_id UUID required
event_type enum required
parent_meeting, celebration, excursion, workshop, performance, etc.
title string required
description text
start_date date required
end_date date required
start_time time
end_time time
location string
201 Created 400 Bad Request 401 Unauthorized
PUT /events/{event_id}
🔒 Requires Authentication

Update an event

200 OK 401 Unauthorized 404 Not Found
DELETE /events/{event_id}
🔒 Requires Authentication

Delete an event

200 OK 401 Unauthorized 404 Not Found

💬 Messages

GET /messages/conversations
🔒 Requires Authentication

Get all message conversations for the current user

200 OK 401 Unauthorized
POST /messages
🔒 Requires Authentication

Send a new message

Request Body

recipient_id UUID required
User ID of the recipient
subject string
message_text text required
201 Created 400 Bad Request 401 Unauthorized

🔔 Notifications

GET /notifications
🔒 Requires Authentication

Get all notifications for the current user

200 OK 401 Unauthorized
GET /notifications/unread-count
🔒 Requires Authentication

Get count of unread notifications

Example Response (200 OK)

{
  "success": true,
  "count": 5
}
200 OK 401 Unauthorized

👥 Staff

GET /staff
🔒 Requires Authentication

Get all staff members

200 OK 401 Unauthorized

👨‍👩‍👧 Parents

GET /parents
🔒 Requires Authentication

Get all parents

200 OK 401 Unauthorized

🏠 Rooms

GET /rooms
🔒 Requires Authentication

Get all rooms/classrooms

200 OK 401 Unauthorized

📊 Assessments

POST /assessments
🔒 Requires Authentication

Create a new developmental assessment

Request Body

child_id UUID required
centre_id UUID required
assessment_type enum required
developmental, behavioral, learning, social
assessment_date date required
notes text
201 Created 400 Bad Request 401 Unauthorized
GET /children/{child_id}/assessments
🔒 Requires Authentication

Get all assessments for a child

200 OK 401 Unauthorized