All routes require authentication with a valid JWT token. Parents can be created by managers or coaches within an organization.
All requests must include the JWT token in the Authorization header:
Authorization: Bearer <YOUR_JWT_TOKEN>
Retrieves all parents for a specific organization.
Example Request:
GET /api/organizations/60d21b4667d0d8992e610c95/parents
Example Response:
{
"status": "success",
"results": 2,
"data": {
"parents": [
{
"_id": "60d21b4667d0d8992e610c100",
"name": "John Smith",
"email": "john.smith@example.com",
"role": "parent",
"organization": "60d21b4667d0d8992e610c95",
"teams": [
{
"_id": "60d21b4667d0d8992e610c70",
"name": "Varsity Soccer"
}
],
"children": [
{
"_id": "60d21b4667d0d8992e610c101",
"name": "Alex Smith",
"email": "alex.smith@example.com"
}
],
"isPro": true,
"createdAt": "2023-01-01T00:00:00.000Z"
},
{
"_id": "60d21b4667d0d8992e610c102",
"name": "Mary Johnson",
"email": "mary.johnson@example.com",
"role": "parent",
"organization": "60d21b4667d0d8992e610c95",
"teams": [],
"children": [
{
"_id": "60d21b4667d0d8992e610c103",
"name": "Emma Johnson",
"email": "emma.johnson@example.com"
}
],
"isPro": true,
"createdAt": "2023-01-02T00:00:00.000Z"
}
]
}
}Creates a new parent account for a specific organization.
Example Request:
POST /api/organizations/60d21b4667d0d8992e610c95/parents
Request Body:
{
"name": "David Brown",
"email": "david.brown@example.com",
"password": "password123",
"teams": ["60d21b4667d0d8992e610c70"]
}Example Response:
{
"status": "success",
"data": {
"parent": {
"_id": "60d21b4667d0d8992e610c104",
"name": "David Brown",
"email": "david.brown@example.com",
"role": "parent",
"organization": "60d21b4667d0d8992e610c95",
"teams": ["60d21b4667d0d8992e610c70"],
"children": [],
"isPro": true,
"createdAt": "2023-06-23T12:34:56.789Z",
"planInfo": {
"planType": "premium",
"startDate": "2023-01-01T00:00:00.000Z"
}
}
}
}Retrieves information about a specific parent.
Example Request:
GET /api/organizations/parents/60d21b4667d0d8992e610c100
Example Response:
{
"status": "success",
"data": {
"parent": {
"_id": "60d21b4667d0d8992e610c100",
"name": "John Smith",
"email": "john.smith@example.com",
"role": "parent",
"organization": "60d21b4667d0d8992e610c95",
"teams": [
{
"_id": "60d21b4667d0d8992e610c70",
"name": "Varsity Soccer"
}
],
"children": [
{
"_id": "60d21b4667d0d8992e610c101",
"name": "Alex Smith",
"email": "alex.smith@example.com",
"dateOfBirth": "2010-05-15T00:00:00.000Z"
}
],
"isPro": true,
"createdAt": "2023-01-01T00:00:00.000Z",
"planInfo": {
"planType": "premium",
"startDate": "2023-01-01T00:00:00.000Z"
}
}
}
}Updates a specific parent's information.
Example Request:
PATCH /api/organizations/parents/60d21b4667d0d8992e610c100
Request Body:
{
"name": "John David Smith",
"teams": ["60d21b4667d0d8992e610c70", "60d21b4667d0d8992e610c71"]
}Example Response:
{
"status": "success",
"data": {
"parent": {
"_id": "60d21b4667d0d8992e610c100",
"name": "John David Smith",
"email": "john.smith@example.com",
"role": "parent",
"organization": "60d21b4667d0d8992e610c95",
"teams": [
{
"_id": "60d21b4667d0d8992e610c70",
"name": "Varsity Soccer"
},
{
"_id": "60d21b4667d0d8992e610c71",
"name": "JV Basketball"
}
],
"children": [
{
"_id": "60d21b4667d0d8992e610c101",
"name": "Alex Smith",
"email": "alex.smith@example.com"
}
],
"isPro": true,
"createdAt": "2023-01-01T00:00:00.000Z"
}
}
}Deletes a specific parent and all their associated athlete children.
Example Request:
DELETE /api/organizations/parents/60d21b4667d0d8992e610c100
Example Response:
Status: 204 No Content
-
Admin users can access all parents across all organizations.
-
Organization owners can manage parents only within their own organization.
-
Managers and coaches can manage parents only within their assigned organization.
-
Parents can view and update their own profile information.
{
"status": "fail",
"message": "Parent not found"
}{
"status": "fail",
"message": "You do not have permission to create parents for this organization"
}{
"status": "fail",
"message": "One or more teams are invalid or do not belong to this organization"
}-
Authenticate using the login endpoint to get a JWT token:
- POST
/api/auth/login - Body:
{ "email": "manager@example.com", "password": "password" } - Save the returned token
- POST
-
For all Parent API requests:
- Set the Authorization header:
Bearer <your_token> - Select the appropriate HTTP method (GET, POST, PATCH, DELETE)
- Enter the full URL (e.g.,
http://localhost:3000/api/organizations/60d21b4667d0d8992e610c95/parents) - For POST and PATCH requests, set the body to JSON format and include the required fields
- Send the request
- Set the Authorization header: