REST API (v1)
Access your Massu cloud data programmatically with the REST API.
Authentication
All API requests require a valid API key passed in the Authorization header:
curl -H "Authorization: Bearer ms_live_XXXXXXXX_your_secret_key" \
https://massu.ai/api/v1/sessionsCreate API keys in Settings > API Keys in your dashboard.
Rate Limits
| Plan | Requests/Minute |
|---|---|
| Cloud Pro | 100 |
| Cloud Team | 500 |
| Cloud Enterprise | 2,000 |
Rate limit headers are included in all responses:
X-RateLimit-Limit: Total requests allowed per minuteX-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Unix timestamp when the limit resets
Response Format
All responses are JSON. Successful responses return a 2xx status code with data:
{
"data": [...],
"pagination": {
"page": 1,
"per_page": 50,
"total": 245
}
}Error responses return a 4xx or 5xx status code:
{
"error": "Invalid API key",
"code": "UNAUTHORIZED"
}Endpoints
Sessions
List Sessions
GET /api/v1/sessionsQuery parameters:
page(integer): Page number (default: 1)per_page(integer): Results per page (default: 50, max: 100)project(string): Filter by project namedate_from(string): ISO 8601 date (e.g., "2026-02-01")date_to(string): ISO 8601 datesort(string): Sort field ("created_at", "estimated_cost", "turns")order(string): Sort order ("asc" or "desc")
Example response:
{
"data": [
{
"id": "sess_abc123",
"project_name": "my-project",
"turns": 12,
"estimated_cost": 0.45,
"quality_score": 87,
"created_at": "2026-02-15T10:30:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 123
}
}Get Session Details
GET /api/v1/sessions/:session_idReturns full session data including turns, observations, and analysis.
Quality Scores
Get Quality Overview
GET /api/v1/qualityQuery parameters:
project(string): Filter by project namedate_from(string): ISO 8601 datedate_to(string): ISO 8601 date
Example response:
{
"average_score": 85,
"total_sessions": 245,
"trend": "up",
"scores_by_date": [
{ "date": "2026-02-14", "score": 82 },
{ "date": "2026-02-15", "score": 87 }
]
}Get Session Quality Score
GET /api/v1/quality/:session_idReturns quality score breakdown for a specific session.
Cost
Get Cost Summary
GET /api/v1/costQuery parameters:
project(string): Filter by project namedate_from(string): ISO 8601 datedate_to(string): ISO 8601 dategroup_by(string): "day", "week", or "month"
Example response:
{
"total_cost": 145.67,
"current_month": 89.23,
"by_period": [
{ "period": "2026-02-01", "cost": 12.34 },
{ "period": "2026-02-02", "cost": 15.67 }
],
"by_project": [
{ "project": "frontend", "cost": 45.12 },
{ "project": "backend", "cost": 44.11 }
]
}Get Budget Status
GET /api/v1/cost/budgetReturns current budget configuration and usage.
Security
Get Security Alerts
GET /api/v1/security/alertsQuery parameters:
severity(string): "critical", "high", "medium", "low"status(string): "open", "acknowledged", "resolved"page(integer): Page numberper_page(integer): Results per page
Example response:
{
"data": [
{
"id": "alert_xyz789",
"severity": "high",
"title": "Hardcoded API key detected",
"description": "Found potential API key in session turn 3",
"session_id": "sess_abc123",
"status": "open",
"created_at": "2026-02-15T10:30:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 8
}
}Get Security Score
GET /api/v1/security/scoreReturns overall security score and breakdown.
Team
List Team Members
GET /api/v1/team/membersExample response:
{
"data": [
{
"id": "user_123",
"email": "alice@example.com",
"display_name": "Alice Smith",
"role": "admin",
"joined_at": "2026-01-15T09:00:00Z"
}
]
}Get Team Activity
GET /api/v1/team/activityQuery parameters:
user_id(string): Filter by user IDdate_from(string): ISO 8601 datedate_to(string): ISO 8601 date
Returns activity logs for team members.
Audit
Get Audit Logs
GET /api/v1/auditQuery parameters:
action(string): Filter by action typeuser_id(string): Filter by userdate_from(string): ISO 8601 datedate_to(string): ISO 8601 datepage(integer): Page numberper_page(integer): Results per page
Example response:
{
"data": [
{
"id": "log_abc123",
"action": "session.sync",
"user_id": "user_123",
"details": { "session_id": "sess_xyz" },
"ip_address": "192.0.2.1",
"created_at": "2026-02-15T10:30:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 1234
}
}PR Risk Scores
List PR Risk Scores
GET /api/v1/risk/prsQuery parameters:
repo(string): Filter by repositoryrating(string): "low", "medium", "high", "critical"page(integer): Page numberper_page(integer): Results per page
Example response:
{
"data": [
{
"id": "risk_abc123",
"repo": "org/repo",
"pr_number": 42,
"pr_title": "Add new feature",
"risk_score": 65,
"impact_score": 70,
"regression_score": 55,
"security_score": 60,
"coupling_score": 75,
"files_changed": 12,
"created_at": "2026-02-15T10:30:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 50,
"total": 87
}
}Webhooks
List Webhook Endpoints
GET /api/v1/webhooksExample response:
{
"data": [
{
"id": "hook_abc123",
"url": "https://api.example.com/webhooks",
"events": ["*"],
"enabled": true,
"description": "Production webhook",
"created_at": "2026-02-01T09:00:00Z"
}
]
}Create Webhook Endpoint
POST /api/v1/webhooksRequest body:
{
"url": "https://api.example.com/webhooks",
"events": ["session.completed", "quality.score_changed"],
"description": "Optional description"
}Update Webhook Endpoint
PATCH /api/v1/webhooks/:webhook_idRequest body (all fields optional):
{
"url": "https://api.example.com/new-webhook",
"events": ["*"],
"enabled": false,
"description": "Updated description"
}Delete Webhook Endpoint
DELETE /api/v1/webhooks/:webhook_idReturns 204 No Content on success.
Test Webhook Endpoint
POST /api/v1/webhooks/:webhook_id/testSends a test event to the webhook endpoint.
Webhook Events
Webhook payloads are sent as POST requests with a JSON body:
{
"event": "session.completed",
"timestamp": "2026-02-15T10:30:00Z",
"data": {
"session_id": "sess_abc123",
"project_name": "my-project",
"quality_score": 87
}
}Event Types
| Event | Description | Data Fields |
|---|---|---|
session.completed | A session sync completed | session_id, project_name, quality_score |
quality.score_changed | Quality score updated | session_id, old_score, new_score |
security.alert | Security alert created | alert_id, severity, title |
cost.budget_exceeded | Budget threshold exceeded | budget_id, current_cost, limit |
team.member_joined | New team member joined | user_id, email, role |
compliance.report_ready | Compliance report generated | report_id, report_type, date_range |
Webhook Security
All webhook requests include these headers:
X-Massu-Signature: HMAC-SHA256 signature of the payloadX-Massu-Event: Event typeX-Massu-Delivery: Unique delivery ID
To verify the signature:
const crypto = require('crypto')
function verifySignature(payload, signature, secret) {
const hmac = crypto.createHmac('sha256', secret)
const digest = 'sha256=' + hmac.update(payload).digest('hex')
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(digest)
)
}Quality Badges
Embed live quality score badges in your README or documentation:
Markdown


HTML
<img src="https://massu.ai/api/badge/your-org/quality" alt="Quality Score">
<img src="https://massu.ai/api/badge/your-org/security" alt="Security Score">
<img src="https://massu.ai/api/badge/your-org/cost" alt="Cost Efficiency">Badge URLs:
- Quality:
/api/badge/:org_slug/quality - Security:
/api/badge/:org_slug/security - Cost:
/api/badge/:org_slug/cost
Configure badge appearance in Settings > Badges.
Error Codes
| Code | Description |
|---|---|
UNAUTHORIZED | Invalid or missing API key |
FORBIDDEN | Insufficient permissions |
NOT_FOUND | Resource not found |
RATE_LIMITED | Rate limit exceeded |
VALIDATION_ERROR | Invalid request parameters |
INTERNAL_ERROR | Server error |
SDKs
Official SDKs are available for:
- Node.js:
npm install @massu/node-sdk - Python:
pip install massu - Go:
go get github.com/massu-ai/go-sdk
Example (Node.js):
const { MassuClient } = require('@massu/node-sdk')
const client = new MassuClient({
apiKey: process.env.MASSU_API_KEY
})
const sessions = await client.sessions.list({
project: 'my-project',
page: 1
})
console.log(sessions)Support
- Email: api-support@massu.ai
- Documentation: https://massu.ai/docs
- Status: https://status.massu.ai