Overview

The MyWisy AI Assistant API provides a comprehensive set of endpoints for managing AI-powered educational interactions between assistants, parents, and children. The API is built using FastAPI and follows RESTful principles.

Documentation

This documentation is available in two formats:

  • Interactive Documentation: Available through Swagger UI
  • Reference Documentation: This current page

Base URLs

  • Development: http://localhost:8888
  • Staging: http://localhost:8234
  • Production: http://localhost:8000

Authentication

All API endpoints require authentication using an API key header:

X-API-Key: your_api_key_here

Rate Limiting

  • Default: 100 requests per minute
  • Burst: 200 requests
  • Reset: Every 60 seconds

Endpoints

Create Assistant

POST /api/v1/assistant

Creates a new AI assistant instance. Assistants can be specialized for either child or parent interactions.

Request Body:

{
  "company_name": "string",
  "name": "string",
  "description": "string",
  "is_child_assistant": "boolean"  // Indicates if the assistant is designed for child interactions
}

Response:

{
  "id": "string",
  "name": "string",
  "description": "string",
  "owner": "string",
  "timestamp": "string",
  "is_child_assistant": "boolean"
}

Create Conversation

POST /api/v1/conversation

Creates a new conversation between a human and an AI assistant. Enforces child safety by ensuring child users only interact with child-appropriate assistants.

Request Body:

{
  "api_key": "string",
  "human_id": "string",     // Prefix 'ch-' for child, 'pa-' for parent
  "assistant_id": "string", // Must match human type (child/parent)
  "title": "string",
  "summary": "string"
}

Response:

{
  "id": "string",
  "human_id": "string",
  "assistant_id": "string",
  "title": "string",
  "summary": "string",
  "timestamp": "string"
}

Error Responses:

400 Bad Request:
{
  "detail": "When creating a conversation for a child, the assistant must be designed for children"
}
{
  "detail": "When creating a conversation for a parent, the assistant must not be designed for children"
}

Create Parent

POST /api/v1/parent

Creates a new parent user.

Request Body:

{
  "email": "string",
  "company_name": "string",
  "name": "string",
  "surname": "string",
  "location": "string",
  "age": "integer",
  "gender": "enum"
}

Create Child

POST /api/v1/child

Creates a new child profile.

Request Body:

{
  "company_name": "string",
  "parent_id": "uuid",
  "name": "string",
  "surname": "string",
  "location": "string",
  "birthdate": "date",
  "gender": "enum"
}

WebSocket Endpoints

Real-time Conversation

WS /api/v1/ws/conversation/{conversation_id}

Establishes a WebSocket connection for real-time conversation updates.

Data Types

Gender Enum

  • male
  • female
  • other
  • prefer_not_to_say

Message Types

  • text
  • audio
  • image
  • system

Best Practices

Error Handling

  • Always check response status codes
  • Handle rate limiting gracefully
  • Implement exponential backoff for retries

Security

  • Store API keys securely
  • Use HTTPS for all requests
  • Validate all input data