The base URL for all API endpoints is the root of your deployed application.
Most endpoints require authentication using Privy JWT tokens. Some endpoints also require a Chip Auth JWT token.
Authorization: Bearer <privyJwt> <chipAuthJwt>
Note: Some endpoints only require the Privy JWT token.
URL: /api/users
Method: POST
Authentication: Privy JWT required
{
"username": "string",
"phone": "string",
"birthday": "string" (ISO 8601 date format)
}Success: 200 OK
{
"_id": "string",
"privyDid": "string",
"wallet": "string",
"email": "string",
"username": "string",
"phone": "string",
"birthday": "string",
"colors": ["string", "string", "string"],
"contactsCount": 0,
"createdAt": "string"
}Error: 400 Bad Request, 401 Unauthorized, 500 Internal Server Error
URL: /api/users
Method: GET
Authentication: Privy JWT required
Success: 200 OK
[
{
"_id": "string",
"privyDid": "string",
"email": "string",
"username": "string",
"chip": {
"uid": "string",
"groupId": number
},
"colors": ["string", "string", "string"],
"contactsCount": number,
"createdAt": "string",
"contacts": [
{
"receiver": {
"privyDid": "string",
"email": "string",
"username": "string",
"chip": {
"uid": "string",
"groupId": number
},
"colors": ["string", "string", "string"]
},
"receiverColorsSnapshot": ["string", "string", "string"],
"createdAt": "string"
}
]
}
]Error: 500 Internal Server Error
URL: /api/users/[id]
Method: PUT
Authentication: Privy JWT required
{
"phone": "string",
"username": "string",
"birthday": "string" (ISO 8601 date format)
}Success: 200 OK
{
"_id": "string",
"privyDid": "string",
"email": "string",
"phone": "string",
"username": "string",
"birthday": "string",
"chip": {
"uid": "string",
"groupId": number
},
"colors": ["string", "string", "string"],
"contactsCount": number,
"createdAt": "string"
}Error: 401 Unauthorized, 404 Not Found, 500 Internal Server Error
URL: /api/users/[id]
Method: GET
Success: 200 OK
{
"_id": "string",
"privyDid": "string",
"email": "string",
"username": "string",
"chip": {
"uid": "string",
"groupId": number
},
"colors": ["string", "string", "string"],
"contactsCount": number,
"createdAt": "string",
"contacts": [
{
"receiver": {
"privyDid": "string",
"email": "string",
"username": "string",
"chip": {
"uid": "string",
"groupId": number
},
"colors": ["string", "string", "string"]
},
"receiverColorsSnapshot": ["string", "string", "string"],
"createdAt": "string"
}
]
}Error: 404 Not Found, 500 Internal Server Error
URL: /api/users
Method: PUT
Authentication: Privy JWT and Chip Auth JWT required
{
"username": "string",
"phone": "string",
"birthday": "string" (ISO 8601 date format)
}Success: 200 OK
{
"_id": "string",
"privyDid": "string",
"wallet": "string",
"email": "string",
"username": "string",
"phone": "string",
"birthday": "string",
"chip": {
"uid": "string",
"groupId": number
},
"colors": ["string", "string", "string"],
"contactsCount": number,
"createdAt": "string"
}Error: 400 Bad Request, 401 Unauthorized, 404 Not Found, 500 Internal Server Error
URL: /api/contacts
Method: POST
Authentication: Privy JWT and Chip Auth JWT required
Success: 200 OK
{
"_id": "string",
"initiator": "string",
"receiver": "string",
"receiverColorsSnapshot": ["string", "string", "string"],
"lotteryIndex": number,
"createdAt": "string"
}Error: 400 Bad Request, 401 Unauthorized, 404 Not Found, 500 Internal Server Error
URL: /api/contacts
Method: GET
Success: 200 OK
[
{
"_id": "string",
"initiator": "string",
"receiver": "string",
"receiverColorsSnapshot": ["string", "string", "string"],
"lotteryIndex": number,
"createdAt": "string"
}
]Error: 500 Internal Server Error
URL: /api/leaderboard
Method: GET
Success: 200 OK
{
"leaderboard": [
{
"email": "string",
"username": "string",
"contactsCount": number,
"ranking": number
}
],
"user": {
"email": "string",
"username": "string",
"contactsCount": number,
"ranking": number
}
}Notes:
Error: 404 Not Found (if userId is provided but not found), 500 Internal Server Error