REST API

Base URL: https://getsurvey.dev. Auth varies per endpoint. All bodies are JSON; all responses are typed by Zod schemas in @getsurvey/schema.

Auth

  • x-survey-key — project-scoped publishable key. SDK render path only.
  • Authorization: Bearer <serviceKey> — server-side reads from your backend.
  • Dashboard routes use Clerk session cookies (or the dev x-survey-owner header when Clerk is not configured).

Surveys

POST   /api/v1/surveys                 # create draft (dashboard)
GET    /api/v1/surveys?projectId=...   # list (dashboard)
GET    /api/v1/surveys/:id             # latest (dashboard) | published (publishable key)
PATCH  /api/v1/surveys/:id             # save new draft version
POST   /api/v1/surveys/:id/publish     # publish a version

Responses

POST  /api/v1/responses                          # submit a response (publishable key)
GET   /api/v1/surveys/:id/responses              # list raw rows (dashboard | bearer)
GET   /api/v1/surveys/:id/summary                # summarized analytics (dashboard | bearer)

Projects

POST  /api/v1/projects             # create project + keys (dashboard)
GET   /api/v1/projects             # list user's projects (dashboard)
GET   /api/v1/projects/:id         # project details (dashboard)

Submitting a response

POST /api/v1/responses
x-survey-key: pk_...
content-type: application/json

{
  "surveyId": "srv_...",
  "surveyVersionId": "srv_...@3",
  "answers": [
    { "questionId": "q_abc", "type": "nps", "score": 9 }
  ],
  "idempotencyKey": "client-issued-uuid"
}

Reading a summary

GET /api/v1/surveys/srv_.../summary
Authorization: Bearer sk_...

See Schema for the full SurveySummary shape.