Game Loom
  1. Survey
Game Loom
  • Game Loom
    • 👋 Welcome to Game Loom
  • Getting started
    • Introduction
    • 👤 Authentication
  • User Registration
    • Introduction
    • Single user registration
      POST
    • Bulk Register Users
      POST
  • Notifications
    • Overview
    • Receiving Event Notifications via Webhooks
    • Get All notifications for specific user
      GET
  • Rewards
    • Overview
    • Points
      • Record user point event
      • Get user points
      • Get Specific user point
    • Levels
      • Record user level event
      • Get user levels
      • Get Specific user level
    • Badges
      • Award badge to user
      • Get user badges
      • Get Specific user badge
  • Challenges (Gamification elements)
    • Introduction
    • Leaderboard
      • Get available leaderboards for user
      • Submit score to a leaderboard
      • Get user's leaderboard participation history
      • Get leaderboard details
      • Get leaderboard ranking
      • Get user's record for a leaderboard
      • Get user's entry history for a leaderboard
    • Survey
      • Overview
      • Get available surveys for user
        GET
      • Start a new survey participation
        POST
      • Get detailed user participation
        GET
      • Get user's survey participation history
        GET
      • Abandon survey participation
        DELETE
      • Save individual answer to survey question
        POST
      • Submit completed survey
        PUT
      • Submit Survey with answers (One-Step Submission)
        POST
    • Open Challenge
      • Overview
      • Get available open challenges for user
      • Complete an open challenge
      • Get user's open challenge participation history
      • Get user open challenge by ID
    • Schemas
      • Survey Schame
  1. Survey

Save individual answer to survey question

POST
api/v1/user/{userkey}/surveys/{userSurveyId}/answers
info
Saves or updates an answer for a specific survey question, with built-in validation, progress tracking, and participation state management.

Description#

This endpoint is used to submit or update a user’s answer to an individual survey question.
It ensures the answer is valid for the question type, updates the survey’s progress, and keeps the participation state in sync.

Usage Examples#

Save text answer
{
  "questionId": "uuid",
  "answer": "My response"
}
Multiple-choice answer
{
  "questionId": "uuid",
  "answer": "Option A"
}
Yes / No question
{
  "questionId": "uuid",
  "answer": "yes"
}
{
  "questionId": "uuid",
  "answer": "true"
}

Path Parameters#

NameTypeDescription
userKeystringUnique identifier of the user (derived from authentication context)
userSurveyIdUUIDUnique identifier of the user survey participation (retrieved from the /mine endpoint)

Answer Validation Rules#

Validation is automatically applied based on the question type:
Text / OpenEnded
Any non-empty string
YesNo
Accepted values: "yes", "no", "true", "false" (case-insensitive)
MultipleChoice
The answer must exactly match one of the values defined in the choices field
localizedChoices are not used for validation and are intended for display purposes only
Important
When submitting answers for multiple-choice questions, always send the canonical value from the choices field, not the localized label.

Response#

The response includes:
Updated user survey participation
Newly saved or updated answer
Current progress and completion percentage
All previously saved answers
Updated timestamps

Common Errors#

Error CodeDescription
USER_SURVEY_NOT_FOUNDInvalid user survey ID or access denied
SURVEY_ALREADY_COMPLETEDCompleted surveys cannot be modified
QUESTION_NOT_FOUND_IN_SURVEYThe question does not belong to this survey
INVALID_ANSWER_FORMATAnswer does not match the required question type

Request

Path Params

Header Params

Body Params application/jsonRequired

Examples

Responses

🟢200Success
application/json
Body

Request Request Example
Shell
JavaScript
Java
Swift
curl --location -g --request POST 'api/v1/user/{{user-key}}/surveys/{{survey_id}}/answers' \
--header 'x-api-key: {{api-key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "questionId": "f72d1e11-e3c3-426f-b81e-f1305ac41e79",
  "answer": "true"
}'
Response Response Example
{
    "id": "b7a2ca72-b490-4fba-8ced-f26196d4dee4",
    "surveyId": "e1acdc8b-e09c-4d4e-87e8-5361cc1685c0",
    "userKey": "1765132434113",
    "companyId": "c8e815c6-5d28-489e-a0eb-b0aa735b8c57",
    "status": 1,
    "startedAt": "2025-12-23T16:29:50.558612Z",
    "completedAt": null,
    "updatedDate": "2025-12-23T21:30:03.0855477Z",
    "createdDate": "2025-12-23T16:29:50.586387Z",
    "surveyName": "Test survey Name",
    "surveyDescription": "Test survey description ",
    "surveyStartDate": "2025-12-23T16:14:16.236Z",
    "surveyEndDate": null,
    "totalQuestions": 3,
    "answeredQuestions": 1,
    "progressPercentage": 33.33,
    "questions": [
        {
            "id": "f72d1e11-e3c3-426f-b81e-f1305ac41e79",
            "surveyId": "e1acdc8b-e09c-4d4e-87e8-5361cc1685c0",
            "questionType": 1,
            "question": "Test Yes no question",
            "orderQuestion": 1,
            "choices": [
                "Yes",
                "No"
            ],
            "createdDate": "2025-12-23T16:14:16.954642Z",
            "updatedDate": "2025-12-23T16:14:16.954642Z",
            "localizedQuestions": {
                "ar": "تجربة اسئلة نعم ولا",
                "en": "Test Yes no question"
            },
            "localizedChoices": {
                "ar": [
                    "نعم",
                    "لا"
                ],
                "en": [
                    "Yes",
                    "No"
                ]
            }
        },
        {
            "id": "df41a808-279c-4843-a5de-aafc51cacdd3",
            "surveyId": "e1acdc8b-e09c-4d4e-87e8-5361cc1685c0",
            "questionType": 2,
            "question": "Test Multiple choices question",
            "orderQuestion": 2,
            "choices": [
                "Choice 1",
                "Choice 2"
            ],
            "createdDate": "2025-12-23T16:14:16.954727Z",
            "updatedDate": "2025-12-23T16:14:16.954727Z",
            "localizedQuestions": {
                "ar": "تجربة اسئلة الخيارات المتعددة",
                "en": "Test Multiple choices question"
            },
            "localizedChoices": {
                "ar": [
                    "خيار الاول",
                    "خيار ٢"
                ],
                "en": [
                    "Choice 1",
                    "Choice 2"
                ]
            }
        },
        {
            "id": "690e5f3f-cc79-471f-bc74-f1fd914154d6",
            "surveyId": "e1acdc8b-e09c-4d4e-87e8-5361cc1685c0",
            "questionType": 3,
            "question": "Test Open-ended question",
            "orderQuestion": 3,
            "choices": [],
            "createdDate": "2025-12-23T16:14:16.954735Z",
            "updatedDate": "2025-12-23T16:14:16.954735Z",
            "localizedQuestions": {
                "ar": "تجربة السؤال المفتوح",
                "en": "Test Open-ended question"
            },
            "localizedChoices": null
        }
    ],
    "answers": [
        {
            "id": "064771d6-c990-4c53-b224-7a0af6162afb",
            "questionId": "f72d1e11-e3c3-426f-b81e-f1305ac41e79",
            "question": "Test Yes no question",
            "answer": "true",
            "answeredAt": "0001-01-01T00:00:00"
        }
    ]
}
Modified at 2025-12-23 21:51:59
Previous
Abandon survey participation
Next
Submit completed survey
Built with