Survey API

Survey API Overview

The Survey API allows you to retrieve surveys for individual users by making calls from either the client side or your backend. Responses are tailored, returning only the surveys for which the user is eligible. You can also use an import to share any previously collected information with us.

As a user-based API, the Survey API requires a separate call each time a user wishes to view available surveys. Ensure that all necessary information is provided to accurately identify the user on our side.

Target Audience / Use Case
This API is intended for scenarios where you want to display surveys within your application or design. Your responsibility is limited to presenting the surveys — all other processing is handled by the API.

Get Surveys Endpoint

By calling the Get Surveys Endpoint, you can retrieve an up-to-date list of available surveys for a specific user.

This endpoint is primarily designed for client-side calls. If you intend to call it from your backend, ensure that all client parameters (e.g., clientip) are provided. Backend usage requires prior activation — please contact our team to enable this functionality.

Example Response

{
    "data": {
        "surveys": [
            {
                "category": {
                    "icon_name": "shapes",
                    "icon_url": "https://static.bitlabs.ai/categories/other.svg",
                    "name": "Allgemeines",
                    "name_internal": "Other"
                },
                "click_url": "https://api.bitlabs.ai/v2/client/clicks?i=7e0ae30e-96af-4843-b447-e86a05688691&s=e59b6d24-c5c0-4b01-9bb0-1a705dd6b59c",
                "country": "DE",
                "cpi": "1.72",
              	"cr": 0.42,
                "id": "b722f121-484b-4182-832c-849fa5e86cfc",
                "language": "de",
                "loi": 7,
                "rating": 5,
                "tags": [],
                "type": "survey",
                "value": "172"
            },
            {
                "category": {
                    "icon_name": "shapes",
                    "icon_url": "https://static.bitlabs.ai/categories/other.svg",
                    "name": "Allgemeines",
                    "name_internal": "Other"
                },
                "click_url": "https://api.bitlabs.ai/v2/client/clicks?i=05fbe72e-5e0a-4ddc-857b-50710b6183dd&s=e59b6d24-c5c0-4b01-9bb0-1a705dd6b59c",
                "country": "DE",
                "cpi": "0.41",
              	"cr": 0.29,
                "id": "a20fdd9d-bf2f-4e49-af4c-0b1ad2d81e0c",
                "language": "de",
                "loi": 10,
                "rating": 5,
                "tags": [],
                "type": "survey",
                "value": "41"
            }
        ]
    },
    "status": "success",
    "trace_id": "72b27669a61d9888"
}

User restrictions

In edge cases, the response may contain a restriction_reason that indicates why we cannot find any surveys for the given user.

Opening surveys

To open a survey, redirect the user to the survey’s click_url. From that point onward, all further processing is handled on our side.

Important: Always refresh the Get Surveys endpoint after opening a survey. This generates a new impression ID and ensures that subsequent survey openings function correctly.

Passing Additional Parameters

If you want to pass additional parameters into the BitLabs system, you can append tags to the click_url or directly into the get surveys request. We will append the passed parameters to the redirects and callbacks as you send them in.

Please encode the parameters before you send them into the tags like this:

&tags=premium_user%3Dtrue%26my_id%3D12345

The callbacks/redirects will process the tags and return them to you in the callbacks:

https://example.com?user_id=12345&premium_user=true&26my_id=12345

If you get traffic from different sub-sources, please make sure to append a tag with the name sub_1 or sub_2.

Importing user data

The Import User Endpoint lets you send us profile information you have already collected about your users. Users then see surveys they qualify for without answering those questions again. The endpoint also updates existing profiles. Always send the full, up-to-date profile, not only the parts that changed.

Authenticate with your app's S2S token in the X-S2S-Token header.

We recommend sending the basic profile fields (birthdate, gender and zip code) for every user. Profile questions are optional and go in the questions array.

Endpoint: POST https://api.bitlabs.ai/v1/publishers/users

Request fields

FieldDescription
uidThe ID you use for this user. Up to 65 characters.
birthdateFormat YYYY-MM-DD.
genderMALE, FEMALE or OTHER.
zipcodeThe user's zip code.
usernameDisplay name for features like the leaderboard. Letters and numbers only.
questionsList of answered profile questions. Can be empty. See below.

If you send more than one user in a request, it is treated as a bulk import. Only one bulk import can run at a time. Requests with a single user can run in parallel.

Profile questions

Each entry in questions has three fields:

FieldDescription
idThe Question ID from the question list, sent as a string.
network_idThe Network ID from the question list. It is 2 for every question in the list.
direct_valuesThe Precode of each answer the user picked, sent as strings.

Question list

Download the list of profile questions and answers. There is one tab per country and language, named like 9-ENG-US (ID, language, country). Use the tab that matches your user's country and language.

Each tab has these columns:

ColumnDescription
Question IDAppears on the question row. Send as id.
NameInternal name of the question.
TypeThe answer format. Single Punch takes one answer, Multi Punch takes one or more.
QuestionThe question text.
AnswersThe answer text. Appears on the answer rows below the question.
PrecodeThe value to send for an answer.
Network IDSend as network_id. Always 2.

A question is one row with an ID, followed by one row per answer option. Skip questions with the type Dummy. They are internal fields, not profile questions.

For a Multi Punch question, put every selected precode in direct_values.

Example request

The example sends a user with two answers: one Single Punch question and one Multi Punch question with two selected answers.

curl -X POST "https://api.bitlabs.ai/v1/publishers/users" \
  -H "X-S2S-Token: $S2S_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "users": [
      {
        "uid": "your_unique_id",
        "birthdate": "1990-05-15",
        "gender": "MALE",
        "zipcode": "10001",
        "questions": [
          { "id": "724",   "network_id": 2, "direct_values": ["2"] },
          { "id": "61678", "network_id": 2, "direct_values": ["8", "9"] }
        ]
      }
    ]
  }'

Response

{
  "data": {
    "success_count": 1,
    "errors": []
  }
}

success_count is the number of users imported. Users that could not be imported are listed in errors:

FieldMeaning
uidThe user that could not be imported.
invalid_birthdate, invalid_gender, invalid_zipcodeThe value could not be validated.
invalid_questionThe question was not found, or an answer value could not be matched.
invalid_answer_formatThe answer for a question has an invalid format. Includes the question and the reason.
unsupported_languagesThe user was ignored because none of their languages are supported.

User history

If you want to maintain a user history within your product, you can retrieve the latest action for a survey by calling the User History endpoint. This endpoint returns the most recent tracked action — such as opening, leaving, screening out, or completing a survey — along with all stored details associated with the survey.

Privacy actions

We need to be fully transparent about the data we collect. That's why we provide two endpoints to give you control over user data. With these endpoints, you can process data requests (User Data endpoint) and data deletion requests (Delete User Data endpoint).

Please note that you are required by law to forward all privacy requests from your users to all third-party companies with which you work.

Qualification Flow for the Survey API (optional)

The Survey API supports an optional qualification flow that allows you to handle survey qualifications within your own UI. This can help reduce the number of qualifications presented after a user clicks on a survey while giving you full control over the qualification experience.

This flow is not mandatory. Publishers can implement it to display their own UI for qualifications instead of relying on BitLabs’ default UI.

🚧

The Survey API must be fully integrated before implementing the qualification flow.
This section serves as an appendix to the Survey API documentation.

Starting the Qualification Flow

To retrieve the open questions for a specific survey:

1. Create Click

Make a POST request to the click_url obtained from the Get Surveys Endpoint using the Create Click endpoint.

Example Response

{
  "data": {
    "id": "edf06866-e477-40a6-8287-ff987863e2e9"
  }
}

2. Get Next Question

Use the returned click_id to make a GET request to the Get Click endpoint. This retrieves the next question to render for the user.

Example Response

{
  "data": {
    "answer_question": {
      "question": {
        "id": "e9bdff4e7d",
        "language": "en",
        "type": "TEXT",
        "localized_text": "What is your favorite color?",
        "answers": [
          {
            "code": "1",
            "localized_text": "Red"
          }
        ],
        "can_skip": true,
        "is_duplicate": false,
        "example": null,
        "validation_info": {
          "min": 1,
          "max": 1,
          "regex": "^.{1,30}$"
        }
      }
    },
    "redirect": {
      "url": "https://web.bitlabs.ai"
    },
    "answered_questions": 0,
    "required_questions": 0
  },
    "status": "success",
    "trace_id": "72b27669a61d9888"
}

3. Submit Answers

After the user completes a question, POST the answers to the Update Click endpoint. Repeat for each subsequent question. Once all questions are answered, redirect the user to the final URL.

To view all available question types, refer to the Get Click documentation.

Initial Rewarded Profiler (Starting Bonus Survey)

The “Initial Rewarded Profiler” survey for new users follows the same answer structure as qualifications. It is the only survey returned to new users and has the type start_bonus. Learn more about the Initial Rewarded Profile here.


Did this page help you?