OpenAPI (Swagger)
Overview
This section presents the backend OpenAPI specification for Raccoon Survey.
From this document, HTTP endpoints are generated and documented together with their parameters,
request/response bodies, status codes, and data schemas.
The source specification lives in src/core/openapi.json and acts as the integration contract
for external clients and validation tools.
How to Read and Use
Endpoints are grouped by tags for easier navigation.
Each endpoint details the HTTP method, path, parameters, request body, responses, and schemas.
Use this page as a reference when integrating, testing, or validating API behavior.
Common Conventions
Set
Content-Type: application/jsonfor JSON requests.Use
Authorization: Bearer <token>for endpoints that require authentication.Error responses include clear codes and messages aligned with the schema definitions.
Quickstart with curl
Authenticate and call typical endpoints from the command line.
# 1) Login (replace credentials if needed)
curl -s -X POST http://localhost:3000/api/v1/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"admin@docs.local","password":"pass_doc_local"}'
# 2) Capture access token (requires jq)
TOKEN=$(curl -s -X POST http://localhost:3000/api/v1/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"admin@docs.local","password":"pass_doc_local"}' | jq -r '.access_token')
# 3) Authenticated profile
curl -s http://localhost:3000/api/v1/auth/me \
-H "Authorization: Bearer $TOKEN"
# 4) List surveys
curl -s http://localhost:3000/api/v1/surveys \
-H "Authorization: Bearer $TOKEN"
# 5) Create a survey (example payload)
curl -s -X POST http://localhost:3000/api/v1/surveys \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $TOKEN" \
-d '{"title":"Quarterly Satisfaction","team_id":1}'
Tip
On Windows PowerShell, replace environment variables with $env:TOKEN and use backticks or backquotes to escape.
Postman Collection
Use the shared Postman collection for ready-to-run requests and environments:
Postman collection link: Click Here!
Rendered Specification
- POST /auth/login
Login
- Status Codes:
200 OK – OK
400 Bad Request – Bad request
401 Unauthorized – Unauthorized
- POST /surveys
- Status Codes:
201 Created – Created
400 Bad Request – Bad request
- GET /surveys/{survey_id}
- Parameters:
survey_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
- PUT /surveys/{survey_id}
- Parameters:
survey_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
400 Bad Request – Bad request
- PATCH /surveys/{survey_id}/state
- Parameters:
survey_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
400 Bad Request – Bad request
- POST /questions
- Status Codes:
201 Created – Created
- GET /questions/{question_id}
- Parameters:
question_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
- PUT /questions/{question_id}
- Parameters:
question_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
400 Bad Request – Bad request
- PATCH /questions/{question_id}/state
- Parameters:
question_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
400 Bad Request – Bad request
- POST /teams
- Status Codes:
201 Created – Created
- GET /teams/{team_id}
- Parameters:
team_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
- PUT /teams/{team_id}
- Parameters:
team_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
- PATCH /teams/{team_id}/state
- Parameters:
team_id (integer)
- Status Codes:
200 OK – OK
404 Not Found – Not found
400 Bad Request – Bad request
- POST /tokens/{survey_id}/generate
- Parameters:
survey_id (integer)
- Status Codes:
201 Created – Created
- GET /tokens/{survey_id}/list
- Parameters:
survey_id (integer)
- Query Parameters:
is_used (boolean)
include_expired (boolean)
- Status Codes:
200 OK – OK
- GET /tokens/{survey_id}/export
- Parameters:
survey_id (integer)
- Query Parameters:
is_used (boolean)
include_expired (boolean)
- Status Codes:
200 OK – OK
- POST /anonymous/responses
Submit anonymous responses
- Status Codes:
201 Created – Created
400 Bad Request – Bad request
404 Not Found – Not found
- GET /anonymous/resolve
Resolve survey by token
- Query Parameters:
token (string) – (Required)
survey_id (integer)
- Status Codes:
200 OK – OK
400 Bad Request – Bad request
404 Not Found – Not found
- POST /auth/logout
Logout and revoke token
- Status Codes:
200 OK – OK
401 Unauthorized – Unauthorized
- POST /auth/refresh
Refresh access token
- Status Codes:
200 OK – OK
401 Unauthorized – Unauthorized
- GET /reports/surveys/{survey_id}/summary
- Parameters:
survey_id (integer)
- Query Parameters:
team_id (integer)
date_from (string)
date_to (string)
- Status Codes:
200 OK – OK
404 Not Found – Not found
400 Bad Request – Bad request
- GET /reports/teams/{team_id}/summary
- Parameters:
team_id (integer)
- Query Parameters:
survey_id (integer)
date_from (string)
date_to (string)
- Status Codes:
200 OK – OK
404 Not Found – Not found
400 Bad Request – Bad request
- GET /reports/export
- Query Parameters:
survey_id (integer)
team_id (integer)
date_from (string)
date_to (string)
- Status Codes:
200 OK – OK
404 Not Found – Not found
400 Bad Request – Bad request
- POST /maintenance/tokens/cleanup
- Status Codes:
200 OK – OK
400 Bad Request – Bad request