Base URL
bash
# Production (AWS EKS)http://a9a18d9bb21ed4e6e9b07bbd4b8d9f16-251019334.sa-east-1.elb.amazonaws.com# Local Developmenthttp://localhost:3001Authentication
API Key Authentication
TODO - All API requests SHOULD include an API key in the Authorization header (Coming Soon):
bash
Authorization: Bearer YOUR_API_KEYUsers API
Create User
POSTbash
POST /usersRequest Body
json
{ "email": "trader@crypto.com", "name": "Crypto Trader", "push_subscription": { "endpoint": "https://fcm.googleapis.com/...", "keys": { "p256dh": "BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA...", "auth": "s3VJd6nSsU9JlGgRZ5vJQGXWz9dR8vQyQzQc8..." } }}Response
json
{ "id": "550e8400-e29b-41d4-a716-446655440000", "email": "trader@crypto.com", "name": "Crypto Trader", "created_at": "2024-01-15T10:00:00Z", "updated_at": "2024-01-15T10:00:00Z"}Get User
GETbash
GET /users/{id}Path Parameters
id - User UUIDResponse
json
{ "id": "550e8400-e29b-41d4-a716-446655440000", "email": "trader@crypto.com", "name": "Crypto Trader", "push_subscription": {...}, "created_at": "2024-01-15T10:00:00Z", "updated_at": "2024-01-15T10:00:00Z"}Update User
PUTbash
PUT /users/{id}Request Body
json
{ "name": "Updated Name", "push_subscription": { // Updated push subscription }}Delete User
DELETEbash
DELETE /users/{id}Response
bash
204 No ContentNotifications API
Send Notification
POSTbash
POST /notificationsRequest Body
json
{ "user_id": "550e8400-e29b-41d4-a716-446655440000", "template_id": "purchase_confirmed", "language": "en", "template_variables": { "userName": "Crypto Trader", "amount": "0.5", "currency": "BTC", "txHash": "0xabc123def456", "exchangeName": "Crypto Exchange" }, "notification_type": "purchase", "channel": "both", // "email", "push", or "both" "metadata": { "priority": "high", "tags": ["crypto", "purchase"] }}Response
json
{ "id": "123e4567-e89b-12d3-a456-426614174000", "user_id": "550e8400-e29b-41d4-a716-446655440000", "status": "queued", "channel": "both", "created_at": "2024-01-15T10:00:00Z"}Notification Types
alertinforeminderpromotionpurchasedepositwithdrawalsaleGet Notification Status
GETbash
GET /notifications/{id}Response
json
{ "id": "123e4567-e89b-12d3-a456-426614174000", "user_id": "550e8400-e29b-41d4-a716-446655440000", "title": "Purchase Confirmed", "body": "Your purchase of 0.5 BTC has been confirmed...", "notification_type": "purchase", "channel": "both", "status": "sent", "sent_at": "2024-01-15T10:00:05Z", "created_at": "2024-01-15T10:00:00Z", "metadata": { "email_delivered": true, "push_delivered": true }}Status Values
pendingqueuedsentfailedGet User Notifications
GETbash
GET /users/{id}/notifications?limit=20&offset=0&status=sentQuery Parameters
limit - Number of results (default: 20, max: 100)offset - Pagination offset (default: 0)status - Filter by status (optional)type - Filter by notification type (optional)Response
json
{ "notifications": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "title": "Purchase Confirmed", "body": "Your purchase of 0.5 BTC has been confirmed...", "notification_type": "purchase", "status": "sent", "created_at": "2024-01-15T10:00:00Z" }, // More notifications... ], "pagination": { "total": 150, "limit": 20, "offset": 0, "has_more": true }}Templates API
Templates are managed through Contentful CMS. The following template IDs are available:
| Template ID | Description | Languages | Variables |
|---|---|---|---|
purchase_confirmed | Crypto purchase confirmation | en, es | userName, amount, currency, txHash |
deposit_confirmed | Deposit confirmation | en, es | userName, amount, currency |
withdrawal_completed | Withdrawal completed | en, es | userName, amount, currency, address |
Error Responses
All error responses follow a consistent format:
json
{ "error": { "code": "INVALID_REQUEST", "message": "The request body is invalid", "details": { "field": "email", "reason": "Invalid email format" } }}Common Error Codes
400 Bad RequestInvalid request parameters401 UnauthorizedMissing or invalid API key404 Not FoundResource not found429 Too Many RequestsRate limit exceeded500 Internal Server ErrorServer error