-
Notifications
You must be signed in to change notification settings - Fork 2
Team API Docs
Ayoob edited this page Aug 17, 2025
·
4 revisions
METHOD: POST
BODY REQUEST TYPE: JSON
EXAMPLE BODY REQUEST:
{
"auth_email": "leader@hackru.org",
"auth_token": "user.JWT.token",
"team_name": "Team HackRU",
"members": [
"member1@hackru.org",
"member2@hackru.org",
"member3@hackru.org"
]
}REQUIRED FIELDS:
-
auth_email(string, must be valid email format) -
auth_token(string, JWT authentication token) -
team_name(string, 1-50 characters, alphanumeric with spaces, hyphens, underscores only) -
members(array of email strings, maximum 3 members)
RETURN:
| Situation | Return Value |
|---|---|
| Invalid auth token | {'statusCode': 401, message: 'Unauthorized - Invalid token'} |
| Team name is empty | {'statusCode': 400, message: 'Team name cannot be empty'} |
| Team name too long | {'statusCode': 400, message: 'Team name cannot exceed 50 characters'} |
| Invalid team name characters | {'statusCode': 400, message: 'Team name can only contain letters, numbers, spaces, hyphens, and underscores'} |
| Auth user not found | {'statusCode': 404, message: 'Auth user not found'} |
| User already leads a team | {'statusCode': 400, message: 'User already leads a team'} |
| User already part of a team | {'statusCode': 400, message: 'User is already part of a team'} |
| Some member emails don't exist | {'statusCode': 400, message: 'Some users do not exist', invalid_emails: [array]} |
| Some members already in teams | {'statusCode': 400, message: 'Some users are already part of teams', users_in_teams: [array]} |
| Team size exceeds limit | {'statusCode': 400, message: 'Team size cannot exceed 4 members (including leader)'} |
| Successful team creation | {'statusCode': 200, message: 'Team created successfully', team_id: 'uuid'} |
| Team creation failed | {'statusCode': 500, message: 'Failed to create team', error: 'error-details'} |
| Internal error | {'statusCode': 500, message: 'Internal server error', error: 'error-details'} |
NOTES:
- Team size limit is 4 total members (1 leader + up to 3 members)
- Team name must be unique and follow character restrictions
- All member emails must exist in the database and not be part of existing teams
- Upon successful creation, the leader is automatically added to the team and invitations are sent to all specified members
- If invitation sending fails, the team is automatically deleted and the leader's team status is reset
- Team leader gets
confirmed_team: trueandteam_info.role: 'leader'immediately - Members receive invitations and must accept to join the team