API Documentation
Niotio REST API. Base URL: /api
Authorization: Bearer <API_TOKEN> for API requests.Generate authenticated examples
Paste your API token once and the copy buttons on the examples below insert it for you. Nothing is executed from this page.
| Method | Path | Auth | Description |
|---|---|---|---|
GET | /api/campaigns | Bearer token | List campaigns |
GET | /api/campaigns/{id} | Bearer token | Get a campaign by id |
POST | /api/campaigns | Bearer token | Create a campaign |
GET | /api/metrics | Bearer token | Get overall metrics |
GET | /api/v1/usage/email | Bearer token | Get survey email usage this month |
POST | /api/responses | Respondent token | Submit response |
How to get a user API token
- Log in to Niotio.
- Go to Settings.
- In API Tokens, enter a token name and click Generate New Token.
- Copy the token immediately (it is only shown once).
How to use the API
Include your token in the Authorization header:
Authorization: Bearer YOUR_API_TOKEN
List campaigns
curl -X GET "https://maskinen.stigsen.dk/api/campaigns" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Get a campaign by id
curl -X GET "https://maskinen.stigsen.dk/api/campaigns/1" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Create a campaign
A campaign is either a real campaign (real respondents, no simulated data) or a test campaign (simulation only, never sends real mail, excluded from your NPS score). Say so with "campaignType": "REAL" | "TEST" (or the legacy boolean "test": true). The type is fixed at creation; sending a different one to PUT /api/campaigns/<id> returns 400.
curl -X POST "https://maskinen.stigsen.dk/api/campaigns" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Q1 NPS",
"description": "First quarter survey",
"campaignType": "REAL"
}'
Filter campaigns by type
curl -X GET "https://maskinen.stigsen.dk/api/campaigns?test=true" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Submit a response (public survey token)
curl -X POST "https://maskinen.stigsen.dk/api/responses?token=RESPONDENT_TOKEN&rating=10&comment=Great"
Get overall metrics
curl -X GET "https://maskinen.stigsen.dk/api/metrics" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Get survey email usage this month
Same count as the monthly quota (Europe/Copenhagen calendar month). Unlimited plans: limit and remaining are null. Free: limit 100. Add ?include=campaigns for a per-campaign breakdown (this month only, test campaigns excluded).
curl -X GET "https://maskinen.stigsen.dk/api/v1/usage/email?include=campaigns" \
-H "Authorization: Bearer YOUR_API_TOKEN"
{"plan":"PRO",
"period":{"start":"2026-10-01","end":"2026-10-31","resetsOn":"2026-11-01","timezone":"Europe/Copenhagen"},
"emails":{"limit":1000,"used":412,"remaining":588,"percent":41},
"campaigns":[{"id":12,"name":"Q4 NPS","used":300}]}