Ratefy API Reference v1.0
← Back to overview
Developer documentation

Build branching video surveys, powered by your own data.

The Ratefy Video API lets you assemble multi-step video surveys — complete with AI-narrated presenter videos, conditional branching, and webcam response capture — and drive every question with live data pulled from your own backend.

Base URL
https://api.ratefy.io
Auth
Bearer JWT
Format
application/json
Token lifetime
60 minutes
Two audiences, one API. Management endpoints (surveys, questions, buttons, variables, team) require a signed-in staff user. Runtime endpoints — starting a session, submitting answers, uploading a webcam clip — are called directly from your respondent's browser and need no login, since the person taking the survey never has a Ratefy account.
Introduction

Core concepts

Six objects make up everything you build. Skim this once and the rest of the API reads as plumbing.

Clientyour organization
Environmentproduction / staging
Surveyan ordered set of questions
Question Button Variable Condition
Responseone respondent's answers
Client
Your organization's tenant on Ratefy. Every object you create is scoped to it — there is no cross-tenant visibility.
Environment
A named deployment target (production, staging, development). Surveys and your data-integration settings both live inside one environment, so you can build against staging data before promoting to production.
Survey
An ordered sequence of questions with a title, tied to one environment. Surveys can also be chained — a survey can splice another survey's questions into itself at a given position.
Question
A single step in the survey: prompt text, an optional video (uploaded or AI-generated), a set of answer buttons, variable bindings, and branching conditions.
Button
A reusable, styled answer option (label, color, type). Defined once, attached to as many questions as you like, each with its own "go to" target.
Variable
A typed, named field (string / number / date) that pulls its value from your own backend at survey start, and can drive branching or personalize question text.
Response
One respondent's full run through a survey: every answer, resolved variable values, device metadata, and any captured video or photos.

Introduction

Quickstart

The shortest path from an empty account to a live, embeddable survey.

Point Ratefy at your data

Configure a fetch_survey_data endpoint on your environment. Ratefy calls it every time a respondent starts a survey, so your questions can be personalized with live, first-party data.

Define your buttons and variables

Create the answer buttons (e.g. "Yes" / "No" / "Continue") and variables (e.g. customerTier) you'll reuse across questions.

Build the survey

Create a survey, then add questions in order — attaching buttons, variables, and branching conditions to each.

Add a presenter video (optional)

Generate an AI narrator video per question, or upload your own MP4.

Launch it

Your respondent-facing app calls GET /surveys/start, renders the returned questions, and posts answers back — no Ratefy login required on that side.


Access

Authentication

The direction that matters for your integration: Ratefy authenticates itself to your systems — you don't authenticate to Ratefy to make this work.

Ratefy → your systems

When Ratefy needs to call your backend — to run fetch_survey_data, for instance — it authenticates itself using a token it fetches from an auth endpoint you configure. Register that endpoint once as fetch_auth_token; Ratefy calls it, caches the resulting token, and attaches it to every subsequent call to your systems — refreshing automatically before it expires. See Data integration for the exact configuration shape.

There's no Ratefy API key for you to request or store. You issue Ratefy a token the same way you'd authenticate any other backend client of yours — Ratefy simply calls the auth endpoint you point it at.

Portal access — for your team, not required for integration

Day-to-day survey building happens in the Portal UI. If your team prefers managing content through this API directly instead, staff authenticate the standard way: email/password for a short-lived JWT.

POST /auth/login no auth

Exchange email + password for an access_token and the authenticated user's profile.

Send the token on every subsequent request:

Authorization: Bearer <access_token>
Tokens expire after 60 minutes and there is no refresh endpoint. Re-authenticate with POST /auth/login once a token expires (a 401 response is your signal to do so).

Password recovery

MethodPathPurpose
POST/auth/forgot-passwordRequest a reset email. Always returns a generic success message, whether or not the address exists.
POST/auth/reset-passwordConsume a reset token (valid for 1 hour) and set a new password.

Access

Team & roles

Every user on your tenant holds one of three roles, forming a strict hierarchy.

RoleCan do
rootFull control of your tenant, including irreversible actions like deleting environments or granting the root role itself.
adminManage team members, environments, data-integration settings, and all survey content.
moderatorBaseline access to view and work with survey content.

Inviting teammates

New team members are added by email invitation rather than direct account creation. An invited user receives an emailed link, accepts it, and sets their own password.

MethodPathRole requiredPurpose
POST/invitationsadmin+Invite a user by email, first/last name, and role.
GET/invitationsadmin+List pending/accepted invitations.
GET/invitations/by-token/:tokennoneResolve an invitation for the accept-invite screen.
POST/invitations/acceptnoneAccept the invite and set a password to create the account.
PATCH/invitations/:id/canceladmin+Cancel a pending invitation.
PATCH/invitations/:id/resendadmin+Reissue the invitation with a fresh token.

Configuration

Environments

Environments separate your survey work by deployment stage. Every survey, and every data-integration setting, belongs to exactly one.

MethodPathRolePurpose
POST/client-environmentsadmin+Create an environment.
GET/client-environmentsanyList all of your environments.
GET/client-environments/activeanyList only active environments.
PUT/client-environments/:idadmin+Rename, describe, or activate/deactivate.
DELETE/client-environments/:idrootRemove an environment.

Configuration

Data integration

This is what makes Ratefy surveys feel like part of your product: instead of asking respondents for information you already have, Ratefy asks you for it, live, the moment a survey starts.

Per environment, you register up to four callbacks describing how Ratefy should talk to your backend:

API typeWhen it's called
fetch_survey_dataOn every GET /surveys/start — returns the JSON payload used to resolve variables and evaluate branching conditions.
fetch_auth_tokenBefore calling your other endpoints, if they require a bearer token. Ratefy fetches, caches, and auto-refreshes it for you.
send_survey_dataReserved for pushing completed response data back to your systems.
send_logsReserved for streaming survey-session events to your logging pipeline.

Example configuration

PUT /client-configs/environments/:environmentId/apis/fetch_survey_data
{
  "baseUrl": "https://api.yourcompany.com/v1/respondents",
  "method": "GET",
  "timeout": 30000,
  "headers": { "X-Source": "ratefy" }
}

For endpoints of your own that require a token, describe how to fetch one and where to find it in the response:

PUT /client-configs/environments/:environmentId/apis/fetch_auth_token
{
  "baseUrl": "https://api.yourcompany.com/v1/auth/token",
  "method": "POST",
  "body": { "clientId": "...", "clientSecret": "..." },
  "tokenPath": "data.token",
  "expiresInPath": "data.expiresIn",
  "tokenHeaderName": "Authorization",
  "tokenPrefix": "Bearer "
}
Tokens fetched this way are cached and refreshed automatically before they expire — your fetch_auth_token endpoint won't be called on every survey start.

Reference

MethodPathPurpose
GET/client-configs/mineFetch your full configuration.
PUT/client-configs/mineReplace top-level settings (button style presets, etc).
GET/client-configs/environments/:environmentId/apisGet all four API configs for an environment.
PUT/client-configs/environments/:environmentId/apis/:apiTypeCreate or update one integration.

Configuration

Buttons

A button is a reusable answer control — define "Yes", "No", or "Continue" once, then attach it to as many questions as you like.

FieldTypeNotes
labelstringText shown to the respondent.
valuestringThe value recorded on the response.
buttonTypeenumprimary · secondary · outline · text
color / iconstringOptional visual overrides.

Once created, a button is attached to a question with its own per-question order and goTo target — so the same "Continue" button can lead to question 4 in one place and question 9 in another.

MethodPathPurpose
POST/buttonsCreate a button.
GET/buttonsList your buttons.
PUT/buttons/:idUpdate a button.
DELETE/buttons/:idRemove a button.

Configuration

Variables

A variable is the bridge between your backend and a survey. Its name is the key Ratefy looks up in the payload your fetch_survey_data endpoint returns.

FieldTypeNotes
labelstringHuman-readable name shown in the builder.
namestringLookup key in your externalData response, e.g. customerTier.
typeenumstring · number · date

Attach a variable to a question and its resolved value becomes available to that question's branching conditions, and is snapshotted onto the respondent's answer for reporting.

MethodPathPurpose
POST/variablesCreate a variable.
GET/variablesList your variables.
PUT/variables/:idUpdate a variable.
DELETE/variables/:idRemove a variable.

Building surveys

Surveys

A survey is a title, an environment, and the ordered questions inside it.

MethodPathPurpose
POST/surveysCreate a survey (environmentId, title).
GET/surveys?environmentId=List surveys, optionally by environment.
GET/surveys/:idFetch a survey and its questions.
PUT/surveys/:idRename or move to a different environment.
PUT/surveys/:id/linkSplice another survey's questions in at a given position (parentSurveyId, insertAtParentOrder).
DELETE/surveys/:idDelete a survey.
Linked surveys let you build a shared module (e.g. a standard NPS block) once and insert it into multiple parent surveys, with button targets automatically rewired around the inserted block.

Building surveys

Questions & branching

Questions are managed under their parent survey. Each one carries its prompt, its answer buttons, its variable bindings, and the conditions that decide what happens next.

MethodPathPurpose
POST/surveys/:surveyId/questionsCreate a question.
GET/surveys/:surveyId/questionsList questions in order.
PUT.../questions/:questionId/baseUpdate prompt text, suffix, description.
PUT.../questions/:questionId/buttonsReplace the attached buttons and their goTo targets.
PUT.../questions/:questionId/variablesReplace the attached variables.
PUT.../questions/:questionId/conditionsReplace branching conditions.
DELETE.../questions/:questionIdDelete a question.

Conditions

Each condition compares a variable's resolved value against a target, then either skips a question or jumps to another one.

OperatorActions
equal · greater than · less than · greater than or equal · less than or equalskip or go to
exists · not exists
contains · not contains · starts with · ends with
PUT /surveys/42/questions/7/conditions
{
  "conditions": [
    {
      "field": "customerTier",
      "conditionType": "equal",
      "value": "enterprise",
      "action": "go to",
      "targetQuestionId": "9"
    }
  ]
}

Building surveys

AI presenter video

Give any question a narrated video without a camera or a studio. Provide a script (or let Ratefy use the question text), pick a presenter and voice, and Ratefy renders the clip for you.

POST /surveys/:surveyId/questions/:questionId/video/generate

Starts an asynchronous render. Returns 202 Accepted immediately; the question's videoStatus becomes generating. Scripts are capped at 3,000 characters.

GET /surveys/:surveyId/questions/:questionId/video/status

Poll for render progress. Once complete, videoStatus becomes ready and videoUrl is populated.

POST /surveys/:surveyId/questions/:questionId/video/upload

Prefer your own footage? Upload an MP4 directly (up to 200MB) instead of generating one.

Video status lifecycle

1
none

No video yet

Default state for a new question.

2
generating

Render in progress

Set the moment /video/generate is called. Poll /video/status until it changes.

3
ready / failed

Done

ready populates videoUrl; failed populates videoError with the reason.

Only one render can be in flight per question — calling /video/generate again while status is generating returns 409 Conflict.

Runtime

Starting a session

This is the one call your respondent-facing app makes to begin a survey. No authentication needed — tenant isolation comes from the survey ID itself.

GET /surveys/start?surveyId=&tenant=&token=&session= no auth

token is forwarded to your fetch_survey_data endpoint — it identifies the respondent to your system, not to Ratefy.

1
Respondent’s browser

Calls Ratefy

GET /surveys/start with the survey ID and your tenant slug.

2
Ratefy

Resolves the survey

Loads the survey and, if it's linked to a parent, splices its questions into the flow.

3
Ratefy → Your backend

Fetches live data

Calls your fetch_survey_data endpoint (attaching a cached auth token if configured) and receives externalData.

4
Ratefy

Resolves variables & conditions

Populates every question's variables from externalData and evaluates branching, producing isVisible / nextQuestionId per question.

5
Ratefy → Respondent’s browser

Returns the session

{ survey, externalData, startedAt } — render questions and start collecting answers.


Runtime

Capturing responses

Choose the submission pattern that fits your client: a single JSON call, multipart for browsers uploading a webcam clip, or a decoupled presigned-URL flow for large files.

Submitting answers

MethodPathBest for
POST/surveys/:surveyId/responsesAnswers only, no media.
POST.../responses/submitAnswers + base64-encoded video in one JSON call.
POST.../responses/submit-multipartAnswers + video file (MP4/WebM, ≤200MB) — the recommended browser path.
POST.../responses/video/upload-urlPresigned S3 URL to upload large video directly, then attach with PATCH .../responses/:responseId/video.

Webcam start/end photos

A survey can capture a still photo at the start and end of the recording, for identity or presence verification.

MethodPathPurpose
POST/temp-pictures/uploadUpload a photo before a response exists yet (base64, ≤35MB); returns a tempKey to bind on submission.
POST.../responses/:responseId/pictures/upload-directOne-shot base64 upload bound to an existing response.
POST.../responses/:responseId/pictures/upload-urlPresigned URL, then PATCH .../pictures/attach.

Reviewing responses

Back on the management side, your team can list, filter, and play back what respondents submitted.

MethodPathPurpose
GET/survey-responses?status=&from=&to=Paginated list across all your surveys.
GET/surveys/:surveyId/responsesResponses for one survey.
GET.../responses/:responseId/videoPresigned playback URL.