Update click

POST /v2/client/clicks/{clickId}

Updates the click with the action and returns the changed state of the click, hence the GET click endpoint does not have to be called after calling this endpoint.

The action can be one of the following:

  • answer - answers a question
  • skip - skip a question, if skipping is allowed
  • leave - either leaves the survey or the click flow with a supplied reason
  • rate - when a survey is completed, this action can be used to rate the survey

Path parameters

application/json

Body Required

  • Hide answer_question attribute Show answer_question attribute
  • Hide leave_survey attribute Show leave_survey attribute
    • reason string Required

      Values are OTHER, TECHNICAL, SENSITIVE, TOO_LONG, or UNINTERESTING.

  • Hide rate_survey attribute Show rate_survey attribute
    • rating integer Required

      Minimum value is 1, maximum value is 5.

  • sc_token string

    Optional samplechain token. Can be ignored by most implementations.

Responses

  • 200 application/json

    OK

    Hide response attribute Show response attribute object
    • data object
      Hide data attributes Show data attributes
      • Hide answer_question attribute Show answer_question attribute
        • question object Required
          Hide question attributes Show question attributes
          • id string Required

            unique identifier of the question

          • language string(ISO 639-1) Required
          • type string Required

            Values are TEXT, SINGLE, MULTI, NUMBER, or DATE.

          • localized_text string Required
          • answers array[object] Required
            Hide answers attributes Show answers attributes object
          • can_skip boolean Required
          • is_duplicate boolean Required

            Indicates if a similar question was already asked to the user.

          • example string

            Optional example answer for this question.

          • Validation info for a question.

            • If regex is not null, every answer value must match the regex.
            • If the question is of type TEXT, this object will contain the min and max length of the answer.
            • If the question is of type NUMBER, this object will contain the min and max value of the answer.
            • If the question is of type DATE, this object will contain the min and max date of the answer. The BIRTHDATE question is a special case, min & max are the min and max age of the user.
            • If the question is of type SINGLE or MULTI, min and max will contain the min and max number of answers that the user can select.
            Hide validation_info attributes Show validation_info attributes
      • redirect object
        Hide redirect attribute Show redirect attribute
      • answered_questions integer Required
      • required_questions integer Required
      • click_type string Required

        survey = this is a regular click; start_bonus = this is a start bonus click;

        Values are survey or start_bonus.

      • question_mode string Required

        default = this is a regular click; first = this is the first click with more questions than usual;

        Values are default or first.

      • survey_details object Required
        Hide survey_details attributes Show survey_details attributes
        • id string Required
        • cpi string Required

          CPI of this survey in USD without any formatting applied.

        • value string Required

          CPI formatted according to your app settings. Can be shown to the user directly.

        • loi number(float) Required

          Assumed length of the survey in minutes

        • country string(ISO 3166-1 alpha-2) Required
        • language string(ISO 639-1) Required
        • rating integer Required

          Difficulty ranking of this survey. 1-5 (1 = hard, 5 = easy)

          Minimum value is 1, maximum value is 5.

        • category object Required
          Hide category attributes Show category attributes
          • name string Required

            Localized category name

          • icon_name string Required
          • icon_url string Required

            If not empty: url to an icon for the category.

          • name_internal string Required

            Internal, un-localized, machine-friendly name of the category

  • 422 application/json

    Bad Request

    Hide response attribute Show response attribute object
    • data object
      Hide data attributes Show data attributes
      • code string

        Values are REGEX_MISMATCH, BELOW_MIN, ABOVE_MAX, CANNOT_OVERRIDE, NOT_FOUND, DISALLOWED_ANSWER, CANNOT_SKIP, or TOO_MANY_SKIPS.

      • reason string
POST /v2/client/clicks/{clickId}
curl \
 -X POST https://api.bitlabs.ai/v2/client/clicks/{clickId} \
 -H "Content-Type: application/json" \
 -d '{"answer_question":{"answers":["1","2"]},"skip_question":true,"leave_survey":{"reason":"OTHER"},"rate_survey":{"rating":42},"sc_token":"string"}'
Request example
{
  "answer_question": {
    "answers": [
      "1",
      "2"
    ]
  },
  "skip_question": true,
  "leave_survey": {
    "reason": "OTHER"
  },
  "rate_survey": {
    "rating": 42
  },
  "sc_token": "string"
}
Response examples (200)
{
  "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": "string",
        "validation_info": {
          "min": 1,
          "max": 1,
          "regex": "^.{1,30}$"
        }
      }
    },
    "redirect": {
      "url": "https://web.bitlabs.ai"
    },
    "answered_questions": 42,
    "required_questions": 42,
    "click_type": "survey",
    "question_mode": "default",
    "survey_details": {
      "id": "string",
      "cpi": "1.2",
      "value": "120",
      "loi": 5.3,
      "country": "US",
      "language": "en",
      "rating": 4,
      "category": {
        "name": "Automotive",
        "icon_name": "string",
        "icon_url": "string",
        "name_internal": "automotive"
      }
    }
  }
}
Response examples (422)
{
  "data": {
    "code": "REGEX_MISMATCH",
    "reason": "string"
  }
}