Basecoat Portal API — Quick Reference Card¶
🎯 At a Glance¶
| Aspect | Details |
|---|---|
| Version | 1.0.0 |
| Base URL | https://api.basecoat.dev/v1 |
| Spec Format | OpenAPI 3.0.0 |
| Auth | JWT Bearer (1h expiration) + OAuth 2.0 |
| Rate Limit | 500 req/min per user |
| Scalability | 1000+ concurrent requests |
| Endpoints | 17 paths / 28 operations |
| Schemas | 8 core + nested objects |
| Error Codes | 8 standardized types |
| Status Codes | 200, 201, 204, 400, 401, 403, 404, 409, 429, 500 |
🔐 Authentication Quick Start¶
Login¶
curl -X POST https://api.basecoat.dev/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","password":"pass123"}'
Response: {token, user, expiresIn: 3600}
Using Token in Requests¶
Refresh Token¶
Logout¶
👥 User Roles & Permissions¶
| Role | Auth | Teams | Repos | Audits | Compliance | Reports |
|---|---|---|---|---|---|---|
| admin | ✓ | ✓✓ | ✓✓ | ✓✓ | ✓✓ | ✓ |
| auditor | ✓ | ✗ | ✗ | ✓✓ | ✓✓ | ✓ |
| developer | ✓ | ✗ | ✓ | ✓ | ✗ | ✓ |
| viewer | ✓ | ✗ | ✗ | ✗ | ✗ | ✓ |
📊 Core Endpoints (28 operations)¶
Authentication (4)¶
POST /auth/login— User loginPOST /auth/refresh— Refresh tokenPOST /auth/logout— LogoutGET /auth/oauth/github— GitHub OAuth
Teams (6)¶
GET /teams— List teamsPOST /teams— Create teamGET /teams/{id}— Get teamPATCH /teams/{id}— Update teamDELETE /teams/{id}— Delete teamPOST /teams/{id}/members— Add member
Repositories (5)¶
GET /repositories— List reposPOST /repositories— Register repoGET /repositories/{id}— Get repoPATCH /repositories/{id}— Update repoDELETE /repositories/{id}— Delete repo
Audits (4)¶
GET /audits— List auditsPOST /audits— Create auditGET /audits/{id}— Get auditPOST /audits/batch— Batch create
Compliance (3)¶
GET /compliance/policies— List policiesPOST /compliance/policies— Create policyGET /compliance/status— Get compliance
Reports (4)¶
GET /reports— List reportsPOST /reports— Generate reportGET /analytics/dashboard— Dashboard
📋 Pagination Pattern¶
Query Parameters:
❌ Error Response Format¶
{
"code": "ERROR_CODE",
"message": "Human readable message",
"details": { "field": "context" },
"timestamp": "2023-01-01T12:00:00Z",
"requestId": "req-12345"
}
Error Codes¶
AUTH_UNAUTHORIZED(401) — Missing/invalid tokenAUTH_INVALID_CREDENTIALS(401) — Wrong email/passwordINSUFFICIENT_PERMISSIONS(403) — User lacks roleRESOURCE_NOT_FOUND(404) — Entity not foundVALIDATION_ERROR(400) — Invalid parametersCONFLICT_DUPLICATE(409) — Already existsRATE_LIMIT_EXCEEDED(429) — Over quotaINTERNAL_ERROR(500) — Server error
⏱️ Rate Limiting¶
Headers in Response:
When Exceeded (429):
🗂️ Data Schemas Summary¶
User¶
{
"id": "uuid",
"email": "user@example.com",
"name": "John Doe",
"role": "admin|auditor|developer|viewer",
"createdAt": "2023-01-01T00:00:00Z"
}
Team¶
{
"id": "uuid",
"name": "Platform Engineering",
"members": [{userId, role, joinedAt}],
"createdAt": "2023-01-01T00:00:00Z"
}
Repository¶
{
"id": "uuid",
"name": "basecoat",
"url": "https://github.com/...",
"complianceLevel": "level1|level2|level3|level4",
"team": "uuid",
"lastAuditAt": "2023-01-15T12:00:00Z"
}
Audit¶
{
"id": "uuid",
"repositoryId": "uuid",
"type": "security|compliance|code-quality|dependency",
"status": "pending|in_progress|completed|failed",
"findings": [{id, severity, category, description}]
}
Finding¶
{
"id": "uuid",
"severity": "critical|high|medium|low|info",
"category": "secrets-in-code|dependency-vulnerability|...",
"description": "...",
"remediation": "...",
"status": "open|acknowledged|resolved|false_positive"
}
🎯 Implementation Checklist¶
- [ ] Read PORTAL_API_v1.0.yml
- [ ] Study IMPLEMENTATION_NOTES.md
- [ ] Install dependencies (jsonwebtoken, bcryptjs, redis, bull)
- [ ] Implement JWT service
- [ ] Create auth middleware
- [ ] Implement RBAC checks
- [ ] Set up database schema
- [ ] Implement auth endpoints
- [ ] Implement team endpoints
- [ ] Implement repository endpoints
- [ ] Implement audit endpoints
- [ ] Implement compliance endpoints
- [ ] Add error handling
- [ ] Add rate limiting
- [ ] Write tests (>80% coverage)
- [ ] Load test (1000+ concurrent)
- [ ] Deploy and monitor
📚 Documentation Files¶
- PORTAL_API_v1.0.yml — OpenAPI specification (import into Swagger/Postman)
- API_DOCUMENTATION.md — Developer guide with examples
- IMPLEMENTATION_NOTES.md — Backend implementation patterns
- API_DELIVERY_SUMMARY.md — Executive overview
🚀 Sample Workflow¶
# 1. Login
TOKEN=$(curl -s -X POST https://api.basecoat.dev/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","password":"pass"}' \
| jq -r '.token')
# 2. List teams
curl -X GET https://api.basecoat.dev/v1/teams \
-H "Authorization: Bearer $TOKEN"
# 3. Create audit
AUDIT_ID=$(curl -s -X POST https://api.basecoat.dev/v1/audits \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"repositoryId":"repo-uuid","type":"security"}' \
| jq -r '.id')
# 4. Check audit status
curl -X GET https://api.basecoat.dev/v1/audits/$AUDIT_ID \
-H "Authorization: Bearer $TOKEN"
# 5. Logout
curl -X POST https://api.basecoat.dev/v1/auth/logout \
-H "Authorization: Bearer $TOKEN"
📞 Support¶
- Documentation: See API_DOCUMENTATION.md
- Implementation: See IMPLEMENTATION_NOTES.md
- Spec: See PORTAL_API_v1.0.yml
- Email: api-support@basecoat.dev
- Issues: https://github.com/IBuySpy-Shared/basecoat/issues
Deadline: May 5, 2024