Communication Service API Reference
Complete API reference for the Communication Service.
Base URL
http://localhost:8010/api/v1
Authentication
All API endpoints require authentication via IAM headers from the Gateway service.
GraphQL API
Endpoint
POST /api/graphql
Send Email
mutation SendEmail($input: SendEmailInput!) {
sendEmail(input: $input) {
id
status
provider
sentAt
}
}
Variables:
{
"input": {
"to": "user@example.com",
"subject": "Welcome",
"template": "welcome",
"variables": {
"name": "John"
}
}
}
Send SMS
mutation SendSMS($input: SendSMSInput!) {
sendSMS(input: $input) {
id
status
provider
sentAt
}
}
Send Push Notification
mutation SendPush($input: SendPushInput!) {
sendPush(input: $input) {
id
status
sentAt
}
}
REST API
Health Check
GET /health
Response:
{
"status": "healthy",
"database": "connected",
"redis": "connected"
}
Send Email
POST /emails
Content-Type: application/json
{
"to": "user@example.com",
"subject": "Welcome",
"template": "welcome",
"variables": {
"name": "John"
}
}
Send SMS
POST /sms
Content-Type: application/json
{
"to": "+1234567890",
"message": "Your verification code is 123456"
}
Send Push Notification
POST /push
Content-Type: application/json
{
"deviceToken": "device-token",
"title": "Notification Title",
"body": "Notification body",
"data": {
"key": "value"
}
}
Error Responses
All endpoints return standard error responses:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": {}
}
}
Rate Limits
- Email: 100 requests/minute
- SMS: 50 requests/minute
- Push: 200 requests/minute