Management API

Responses API

The Public Client API is designed for the JavaScript SDK and does not require authentication. It's primarily used for creating persons, sessions, and responses within the Formbricks platform. This API is ideal for client-side interactions, as it doesn't expose sensitive information.


GET/api/v1/management/responses

List all responses

Retrieve all the responses you have received for all your surveys.

Mandatory Headers

  • Name
    x-Api-Key
    Type
    string
    Description

    Your Formbricks API key.

Optional Query Params

  • Name
    surveyId
    Type
    string
    Description

    SurveyId to filter responses by.

Request

GET
/api/v1/management/responses
curl --location \
'https://app.formbricks.com/api/v1/management/responses' \
--header \
'x-api-key: <your-api-key>'

Response

{
  "data":[
    {
      "id":"cllnfybxd051rpl0gieavthr9",
      "createdAt":"2023-08-23T07:56:33.121Z",
      "updatedAt":"2023-08-23T07:56:41.793Z",
      "surveyId":"cllnfy2780fromy0hy7uoxvtn",
      "finished":true,
      "data":{
          "ec7agikkr58j8uonhioinkyk":"Loved it!",
          "gml6mgy71efgtq8np3s9je5p":"clicked",
          "klvpwd4x08x8quesihvw5l92":"Product Manager",
          "kp62fbqe8cfzmvy8qwpr81b2":"Very disappointed",
          "lkjaxb73ulydzeumhd51sx9g":"Not interesed.",
          "ryo75306flyg72iaeditbv51":"Would love if it had dark theme."
      },
      "meta":{
          "url":"https://app.formbricks.com/s/cllnfy2780fromy0hy7uoxvtn",
          "userAgent":{
            "os":"Linux",
            "browser":"Chrome"
          }
      },
      "personAttributes":null,
      "person":null,
      "notes":[],
      "tags":[]
    }
  ]
}

POST/api/v1/client/responses

Create a response

Add a new response to a survey.

Mandatory Body Fields

  • Name
    surveyId
    Type
    string
    Description

    The id of the survey the response belongs to.

  • Name
    finished
    Type
    boolean
    Description

    Marks whether the response is complete or not.

  • Name
    data
    Type
    string
    Description

    The data of the response as JSON object (key: questionId, value: answer).

Optional Body Fields

  • Name
    personId
    Type
    string
    Description

    Internal Formbricks id to identify the user sending the response

Parameters Explained

field namerequireddefaultdescription
datayes-The response data object (answers to the survey). In this object the key is the questionId, the value the answer of the user to this question.
personIdno-The person this response is connected to.
surveyIdyes-The survey this response is connected to.
finishedyesfalseMark a response as complete to be able to filter accordingly.

Request

POST
/api/v1/client/responses
curl --location --request POST 'https://app.formbricks.com/api/v1/client/responses' \
--data-raw '{
  "surveyId":"clfqz1esd0000yzah51trddn8",
  "personId": "clfqjny0v000ayzgsycx54a2c",
  "finished": true,
  "data": {
      "clfqjny0v0003yzgscnog1j9i": 10,
      "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks"
    }
}'

Response

{
"data": {
  "id": "clisyqeoi000219t52m5gopke",
  "surveyId": "clfqz1esd0000yzah51trddn8",
  "finished": true,
  "person": {
    "id": "clfqjny0v000ayzgsycx54a2c",
    "attributes": {
      "email": "me@johndoe.com"
    }
  },
  "data": {
      "clfqjny0v0003yzgscnog1j9i": 10,
      "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks"
    }
  }
}

POST/api/v1/client/responses/[responseId]

Update a response

Update an existing response in a survey.

Mandatory Body Fields

  • Name
    data
    Type
    string
    Description

    The data of the response as JSON object (key: questionId, value: answer).

Parameters Explained

field namerequireddefaultdescription
datayes-The response data object (answers to the survey). In this object the key is the questionId, the value the answer of the user to this question.
finishedyesfalseMark a response as complete to be able to filter accordingly.

Request

POST
/api/v1/client/responses/[responseId]
curl --location --request POST 'https://app.formbricks.com/api/v1/client/responses/[responseId]' \
--data-raw '{
  "personId": "clfqjny0v000ayzgsycx54a2c",
  "surveyId": "clfqz1esd0000yzah51trddn8",
  "finished": true,
  "data": {
      "clggpvpvu0009n40g8ikawby8": 5,
  }
}'

Response

{
  "data": {
    "id": "clisyqeoi000219t52m5gopke",
    "surveyId": "clfqz1esd0000yzah51trddn8",
    "finished": true,
    "person": {
      "id": "clfqjny0v000ayzgsycx54a2c",
      "attributes": {
        "email": "me@johndoe.com"
      }
    },
    "data": {
      "clfqjny0v0003yzgscnog1j9i": 10,
      "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks",
      "clggpvpvu0009n40g8ikawby8": 5
    }
  }
}

Was this page helpful?