OpenAPI 3.0 documentation for the Nova Rewards backend REST API.
Start the backend server:
cd novaRewards/backend
npm run devOpen your browser at:
http://localhost:3001/api/docs
The /api/docs route is protected by HTTP Basic Auth in production.
Set the following environment variables on your server:
DOCS_USER=nova # username (default: nova)
DOCS_PASS=<your-secret> # password — leave unset to disable the gate
When prompted by the browser, enter the credentials above.
- Open Postman and click Import (top-left).
- Select the File tab and choose
docs/api/openapi.jsonfrom this repository. - Postman will create a new collection with all 31 endpoints pre-configured, including example request bodies.
- Set the
baseUrlvariable tohttp://localhost:3001/api(or your production URL).
To regenerate openapi.json after route changes:
cd novaRewards/backend
npm run generate:openapiMost user-facing endpoints require a JWT Bearer token.
- Call
POST /auth/loginwith your email and password. - Copy the
accessTokenvalue from the response. - In the Swagger UI, click the Authorize button (🔒) at the top-right.
- In the bearerAuth field, paste the token (without the
Bearerprefix — Swagger adds it automatically). - Click Authorize, then Close.
All subsequent requests from the UI will include the Authorization: Bearer <token> header.
Merchant endpoints use an x-api-key header instead of a Bearer token.
- Register a merchant via
POST /merchants/register— the plain-text API key is returned once in the response. Store it securely. - In the Swagger UI, click Authorize (🔒).
- In the merchantApiKey field, paste the API key.
- Click Authorize, then Close.
| Endpoint group | Auth method |
|---|---|
POST /auth/* |
None (public) |
POST /users |
None (public) |
GET /users/:walletAddress/points |
None (public) |
GET /campaigns/:merchantId |
None (public) |
GET /users/:id, PATCH, DELETE |
Bearer JWT |
GET /redemptions, POST /redemptions |
Bearer JWT |
GET /leaderboard |
Bearer JWT |
GET /admin/* |
Bearer JWT (admin role) |
GET /drops/eligible, POST /drops/:id/claim |
Bearer JWT |
POST /rewards/distribute |
Merchant API key |
POST /campaigns, GET /campaigns |
Merchant API key |
GET /contract-events |
Merchant API key |
GET /admin/email-logs |
Merchant API key |
GET /transactions/merchant-totals |
Merchant API key |
When the server is running, the spec is also served at:
GET /api/docs/openapi.json
This is useful for CI pipelines that need to validate or diff the spec automatically.