API Documentation

Niotio REST API. Base URL: /api

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.

The token stays in your browser and is never sent from this page.
Endpoints overview
Method Path Auth Description
GET/api/campaignsBearer tokenList campaigns
GET/api/campaigns/{id}Bearer tokenGet a campaign by id
POST/api/campaignsBearer tokenCreate a campaign
GET/api/metricsBearer tokenGet overall metrics
GET/api/v1/usage/emailBearer tokenGet survey email usage this month
POST/api/responsesRespondent tokenSubmit response
How to get a user API token
  1. Log in to Niotio.
  2. Go to Settings.
  3. In API Tokens, enter a token name and click Generate New Token.
  4. 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}]}