Skip to main content
This guide walks you through your first complete standalone test flow. By the end, you will have verified your connection, authenticated a participant, submitted answers, and retrieved a result from the Braintest API.

Prerequisites

  • A Braintest partner account with API access
  • Your API key from the organizer panel
  • curl or any HTTP client

Authentication paths

Every record includes an organizer setting called tests_auth_required:
  • true (default): profile authentication requires SMS verification. POST /record/{token}/auth/ returns a draft_token, then you finish with PUT /record/{token}/auth/verify/ and the SMS code.
  • false: POST /record/{token}/auth/ creates the profile immediately.
The quickstart shows both paths so you can adapt to whichever your account uses.

Step-by-step flow

1

Get your API key

Log in to the Braintest organizer panel and generate an API key. Send it in the API-KEY header on every request.
2

Verify the connection

Test that your key works by calling the connection endpoint.
Expected response:
3

List available records

Fetch the list of records and find one with status: 2 (ready) and auth_required: true. Note the tests_auth_required field so you know which path to follow.
Example response (truncated):
Save the token value for the next step.
4

Start authentication

Send the participant profile to the auth endpoint. The request body is the same regardless of the path.
Branch on the response.SMS path (tests_auth_required: true) returns a draft_token and sends an SMS code to the participant’s mobile:
Instant path (tests_auth_required: false) returns the profile immediately. Skip the next step.
5

Verify the SMS code (SMS path only)

Ask the participant for the code they received and submit it with the draft_token. The draft token is valid for 5 minutes.
Expected response:
Skip this step when tests_auth_required is false.
6

Fetch questions

Retrieve the test questions for the authenticated record.
Example response:
7

Submit answers

Send the participant answers back. The record array maps question IDs to selected option values.
Expected response:
8

Retrieve the result

After submission, fetch the scored result.
Example response:
You can also request HTML output by calling /result/html/ instead.

Next steps