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.
https://api.ratefy.ioapplication/jsonCore concepts
Six objects make up everything you build. Skim this once and the rest of the API reads as plumbing.
- 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.
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.
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.
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.
Exchange email + password for an access_token and the authenticated user's profile.
Send the token on every subsequent request:
Authorization: Bearer <access_token>POST /auth/login once a token expires (a 401 response is your signal to do so).Password recovery
| Method | Path | Purpose |
|---|---|---|
| POST | /auth/forgot-password | Request a reset email. Always returns a generic success message, whether or not the address exists. |
| POST | /auth/reset-password | Consume a reset token (valid for 1 hour) and set a new password. |
Team & roles
Every user on your tenant holds one of three roles, forming a strict hierarchy.
| Role | Can do |
|---|---|
| root | Full control of your tenant, including irreversible actions like deleting environments or granting the root role itself. |
| admin | Manage team members, environments, data-integration settings, and all survey content. |
| moderator | Baseline 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.
| Method | Path | Role required | Purpose |
|---|---|---|---|
| POST | /invitations | admin+ | Invite a user by email, first/last name, and role. |
| GET | /invitations | admin+ | List pending/accepted invitations. |
| GET | /invitations/by-token/:token | none | Resolve an invitation for the accept-invite screen. |
| POST | /invitations/accept | none | Accept the invite and set a password to create the account. |
| PATCH | /invitations/:id/cancel | admin+ | Cancel a pending invitation. |
| PATCH | /invitations/:id/resend | admin+ | Reissue the invitation with a fresh token. |
Environments
Environments separate your survey work by deployment stage. Every survey, and every data-integration setting, belongs to exactly one.
| Method | Path | Role | Purpose |
|---|---|---|---|
| POST | /client-environments | admin+ | Create an environment. |
| GET | /client-environments | any | List all of your environments. |
| GET | /client-environments/active | any | List only active environments. |
| PUT | /client-environments/:id | admin+ | Rename, describe, or activate/deactivate. |
| DELETE | /client-environments/:id | root | Remove an environment. |
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 type | When it's called |
|---|---|
| fetch_survey_data | On every GET /surveys/start — returns the JSON payload used to resolve variables and evaluate branching conditions. |
| fetch_auth_token | Before calling your other endpoints, if they require a bearer token. Ratefy fetches, caches, and auto-refreshes it for you. |
| send_survey_data | Reserved for pushing completed response data back to your systems. |
| send_logs | Reserved for streaming survey-session events to your logging pipeline. |
Example configuration
{
"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:
{
"baseUrl": "https://api.yourcompany.com/v1/auth/token",
"method": "POST",
"body": { "clientId": "...", "clientSecret": "..." },
"tokenPath": "data.token",
"expiresInPath": "data.expiresIn",
"tokenHeaderName": "Authorization",
"tokenPrefix": "Bearer "
}fetch_auth_token endpoint won't be called on every survey start.Reference
| Method | Path | Purpose |
|---|---|---|
| GET | /client-configs/mine | Fetch your full configuration. |
| PUT | /client-configs/mine | Replace top-level settings (button style presets, etc). |
| GET | /client-configs/environments/:environmentId/apis | Get all four API configs for an environment. |
| PUT | /client-configs/environments/:environmentId/apis/:apiType | Create or update one integration. |
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.
| Field | Type | Notes |
|---|---|---|
| label | string | Human-readable name shown in the builder. |
| name | string | Lookup key in your externalData response, e.g. customerTier. |
| type | enum | string · 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.
| Method | Path | Purpose |
|---|---|---|
| POST | /variables | Create a variable. |
| GET | /variables | List your variables. |
| PUT | /variables/:id | Update a variable. |
| DELETE | /variables/:id | Remove a variable. |
Surveys
A survey is a title, an environment, and the ordered questions inside it.
| Method | Path | Purpose |
|---|---|---|
| POST | /surveys | Create a survey (environmentId, title). |
| GET | /surveys?environmentId= | List surveys, optionally by environment. |
| GET | /surveys/:id | Fetch a survey and its questions. |
| PUT | /surveys/:id | Rename or move to a different environment. |
| PUT | /surveys/:id/link | Splice another survey's questions in at a given position (parentSurveyId, insertAtParentOrder). |
| DELETE | /surveys/:id | Delete a survey. |
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.
| Method | Path | Purpose |
|---|---|---|
| POST | /surveys/:surveyId/questions | Create a question. |
| GET | /surveys/:surveyId/questions | List questions in order. |
| PUT | .../questions/:questionId/base | Update prompt text, suffix, description. |
| PUT | .../questions/:questionId/buttons | Replace the attached buttons and their goTo targets. |
| PUT | .../questions/:questionId/variables | Replace the attached variables. |
| PUT | .../questions/:questionId/conditions | Replace branching conditions. |
| DELETE | .../questions/:questionId | Delete a question. |
Conditions
Each condition compares a variable's resolved value against a target, then either skips a question or jumps to another one.
| Operator | Actions |
|---|---|
equal · greater than · less than · greater than or equal · less than or equal | skip or go to |
exists · not exists | |
contains · not contains · starts with · ends with |
{
"conditions": [
{
"field": "customerTier",
"conditionType": "equal",
"value": "enterprise",
"action": "go to",
"targetQuestionId": "9"
}
]
}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.
Starts an asynchronous render. Returns 202 Accepted immediately; the question's videoStatus becomes generating. Scripts are capped at 3,000 characters.
Poll for render progress. Once complete, videoStatus becomes ready and videoUrl is populated.
Prefer your own footage? Upload an MP4 directly (up to 200MB) instead of generating one.
Video status lifecycle
No video yet
Default state for a new question.
Render in progress
Set the moment /video/generate is called. Poll /video/status until it changes.
Done
ready populates videoUrl; failed populates videoError with the reason.
/video/generate again while status is generating returns 409 Conflict.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.
token is forwarded to your fetch_survey_data endpoint — it identifies the respondent to your system, not to Ratefy.
Calls Ratefy
GET /surveys/start with the survey ID and your tenant slug.
Resolves the survey
Loads the survey and, if it's linked to a parent, splices its questions into the flow.
Fetches live data
Calls your fetch_survey_data endpoint (attaching a cached auth token if configured) and receives externalData.
Resolves variables & conditions
Populates every question's variables from externalData and evaluates branching, producing isVisible / nextQuestionId per question.
Returns the session
{ survey, externalData, startedAt } — render questions and start collecting answers.
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
| Method | Path | Best for |
|---|---|---|
| POST | /surveys/:surveyId/responses | Answers only, no media. |
| POST | .../responses/submit | Answers + base64-encoded video in one JSON call. |
| POST | .../responses/submit-multipart | Answers + video file (MP4/WebM, ≤200MB) — the recommended browser path. |
| POST | .../responses/video/upload-url | Presigned 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.
| Method | Path | Purpose |
|---|---|---|
| POST | /temp-pictures/upload | Upload a photo before a response exists yet (base64, ≤35MB); returns a tempKey to bind on submission. |
| POST | .../responses/:responseId/pictures/upload-direct | One-shot base64 upload bound to an existing response. |
| POST | .../responses/:responseId/pictures/upload-url | Presigned URL, then PATCH .../pictures/attach. |
Reviewing responses
Back on the management side, your team can list, filter, and play back what respondents submitted.
| Method | Path | Purpose |
|---|---|---|
| GET | /survey-responses?status=&from=&to= | Paginated list across all your surveys. |
| GET | /surveys/:surveyId/responses | Responses for one survey. |
| GET | .../responses/:responseId/video | Presigned playback URL. |