API Reference
Moonlight exposes a REST API at http://localhost:3000. Interactive documentation is available via Swagger UI at /api/docs.
The API is being shipped alongside the rest of Moonlight, which is in active development. Endpoint paths, request and response shapes for endpoints marked as exploratory may change between minor releases. Where an endpoint is stable enough for integration work, the per-endpoint page says so. When in doubt, pin to a specific server version and watch the changelog.
Authentication
Most endpoints require a JWT Bearer token. See Authentication for details.
Base URL
| Environment | URL |
|---|---|
| Local | http://localhost:3000 |
| Stage | https://stage-api.moon-light.app |
| Production | https://api.moon-light.app |
Response Format
All responses are JSON. Monetary amounts are expressed in cents (integer).
{
"id": 1,
"amountCents": 50000,
"baseCurrency": "USD"
}
50000 cents = $500.00
Error Responses
{
"statusCode": 400,
"message": "Entry is already voided",
"error": "Bad Request"
}
Endpoints Overview
| Group | Base Path | Auth | Description |
|---|---|---|---|
| Auth | /auth | Public / JWT | Login, token refresh, current user |
| Entries | /entries | JWT | Financial entries CRUD, status, void, refund, reimburse |
| Documents | /entries/:id/documents | JWT | Upload, request, fulfill, approve, reject |
| Accounting | /accounting | JWT | Connections, push/pull sync |
| Webhooks | /webhooks/accounting/:connectionId | None | Incoming webhooks from accounting systems |
| Workspaces | /workspaces | JWT | Workspace CRUD, user assignments |
| Projects | /projects | JWT | Project CRUD, user assignments |
| Parties | /parties | JWT | Party listing, details, accounts |
| Tags | /tags | JWT | Tag listing by workspace |
| Users | /users | JWT | User CRUD, role assignments |
| Roles | /roles | JWT | Role listing |
| Reports | /reports | JWT | Summary, timeline, by-party, by-tag, by-project, flows, calendar, distribution |
| Integrations | /integrations | JWT | Integration CRUD, API key rotation |
| Ingest | /api/v1/ingest | API Key | Data ingestion (JSON, CSV, images) |
| Submissions | /api/v1/submissions | API Key | Submission status and listing |
Reporting
Report endpoints return aggregated financial data. Some reports are exploratory and not suitable for control-grade decisions. See Reports API for details on each endpoint and its trust level.