Skip to content

Post Answers

Submit a single quiz answer for a user.


Overview

This endpoint allows submitting a single answer to a quiz question. Use this for question-by-question submission flow. It returns the updated answer object with the current progress.

Method: POST

Endpoints by Quiz Type

Quiz TypeEndpoint
Anonymous/api/v1/namespaces/:namespaceId/quizzes/:quizId/users/anonymous/answers
In-App/api/v1/namespaces/:namespaceId/quizzes/:quizId/users/inapp/answers
Invited/api/v1/namespaces/:namespaceId/quizzes/:quizId/users/:invitedUserUUID/answers

See Quiz Types to understand the differences between anonymous, in-app, and invited quizzes.


Request

Path Parameters

ParameterTypeRequiredQuiz TypeDescription
namespaceIdstringAllNamespace unique ID
quizIdstringAllQuiz unique ID
invitedUserUUIDstringInvitedInvited user unique ID

Body Parameters

FieldTypeRequiredQuiz TypeDescription
anonymousUserIdstringAnonymousAnonymous user identifier
sessionIdstringIn-AppIn-app session identifier
questionIdstringAllID of the question being answered
answerstringAllAnswer ID (UUID) from the question's answer options
languagestringAllLanguage code (en for English, es for Spanish)
customParamsstringAllOptional custom parameters

Finding Answer IDs: Use the Get Quiz Public Info endpoint to retrieve the quiz's questions and their available answer options. Each answer option includes an id (UUID) that should be used as the value when submitting answers.

Example Request Bodies

json
{
  "anonymousUserId": "anon_12345",
  "questionId": "fhn1",
  "answer": "4b7e6d70-fd93-494a-874d-ea783f825289",
  "language": "en"
}
json
{
  "sessionId": "session_abc123",
  "questionId": "fhn1",
  "answer": "4b7e6d70-fd93-494a-874d-ea783f825289",
  "language": "en"
}
json
{
  "questionId": "fhn1",
  "answer": "4b7e6d70-fd93-494a-874d-ea783f825289",
  "language": "en"
}

Response

Example Responses

json
{
  "answers": {
    "id": "quiz1234-anon_12345",
    "userId": "anon_12345",
    "quizId": "quiz1234",
    "qAnswers": {
      "fhn1": "4b7e6d70-fd93-494a-874d-ea783f825289"
    },
    "completionStatus": 2,
    "isAnonymous": true
  },
  "anonymousUserId": "anon_12345"
}
json
{
  "answers": {
    "id": "quizid1234-session_abc123",
    "userId": "session_abc123",
    "quizId": "quizid1234",
    "qAnswers": {
      "fhn1": "4b7e6d70-fd93-494a-874d-ea783f825289"
    },
    "completionStatus": 2,
    "isAnonymous": false
  }
}
json
{
  "answers": {
    "id": "abcd12345-user_abcd12345",
    "userId": "user_abcd12345",
    "quizId": "abcd12345",
    "qAnswers": {
      "fhn1": "4b7e6d70-fd93-494a-874d-ea783f825289"
    },
    "completionStatus": 2,
    "isAnonymous": false
  }
}

Response Fields

FieldTypeDescription
idstringUnique answer document ID (format: quizId-userId)
userIdstringUser identifier
quizIdstringQuiz identifier
qAnswersobjectObject containing submitted answers (questionId → answerId)
completionStatusnumber1 = initialized, 2 = in progress, 3 = completed
isAnonymousbooleantrue for anonymous quizzes, false for invited
inappbooleantrue for in-app quizzes (only present for in-app type)
anonymousUserIdstringReturned only for anonymous quizzes

Note: Since this is an unauthenticated endpoint, the response only includes non-identifiable question data (e.g., fhn prefixed questions). Questions containing personally identifiable information are excluded from the response.


Error Responses

  • 400 Bad Request – If the quiz has ended
json
{
  "error": "quiz has ended",
  "errorCode": "quiz/ended"
}
  • 400 Bad Request – If the quiz type doesn't match the endpoint
json
{
  "error": "quiz only takes non anonymous submissions",
  "errorCode": "quiz/not_anonymous"
}
  • 404 Not Found – If the namespace does not exist
json
{
  "error": "namespace not found",
  "errorCode": "namespace/not_found"
}
  • 404 Not Found – If the quiz does not exist
json
{
  "error": "quiz not found",
  "errorCode": "quiz/not_found"
}
  • 404 Not Found – If the answer document doesn't exist (user must call initQuiz first)
json
{
  "error": "Answer document not found. User must call initQuiz first.",
  "errorCode": "request/not_found"
}
  • 404 Not Found – If the invited user does not exist (for invited quizzes)
json
{
  "error": "user does not exist",
  "errorCode": "users/not_found"
}
  • 403 Forbidden – If the invited user is not part of the quiz (for invited quizzes)
json
{
  "error": "user is not part of the quiz",
  "errorCode": "users/unauthorized"
}
  • 422 Unprocessable Entity – If required parameters are missing or validation fails
json
{
  "validationErrors": {
    "body": {
      "questionId": {
        "message": "\"questionId\" is required"
      }
    }
  }
}