Skip to main content
PUT
/
management
/
responses
/
{id}
Update a response
curl --request PUT \
  --url https://app.formbricks.com/api/v2/management/responses/{id} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "finished": true,
  "endingId": "<string>",
  "data": {},
  "variables": {},
  "ttc": {},
  "language": "<string>"
}
'
import requests

url = "https://app.formbricks.com/api/v2/management/responses/{id}"

payload = {
"finished": True,
"endingId": "<string>",
"data": {},
"variables": {},
"ttc": {},
"language": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
finished: true,
endingId: '<string>',
data: {},
variables: {},
ttc: {},
language: '<string>'
})
};

fetch('https://app.formbricks.com/api/v2/management/responses/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app.formbricks.com/api/v2/management/responses/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'finished' => true,
'endingId' => '<string>',
'data' => [

],
'variables' => [

],
'ttc' => [

],
'language' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://app.formbricks.com/api/v2/management/responses/{id}"

payload := strings.NewReader("{\n \"finished\": true,\n \"endingId\": \"<string>\",\n \"data\": {},\n \"variables\": {},\n \"ttc\": {},\n \"language\": \"<string>\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://app.formbricks.com/api/v2/management/responses/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"finished\": true,\n \"endingId\": \"<string>\",\n \"data\": {},\n \"variables\": {},\n \"ttc\": {},\n \"language\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.formbricks.com/api/v2/management/responses/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"finished\": true,\n \"endingId\": \"<string>\",\n \"data\": {},\n \"variables\": {},\n \"ttc\": {},\n \"language\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "createdAt": "2021-01-01T00:00:00.000Z",
  "updatedAt": "2021-01-01T00:00:00.000Z",
  "finished": true,
  "surveyId": "<string>",
  "contactId": "<string>",
  "endingId": "<string>",
  "data": {
    "question1": "answer1",
    "question2": 2,
    "question3": [
      "answer3",
      "answer4"
    ],
    "question4": {
      "subquestion1": "answer5"
    }
  },
  "variables": {
    "variable1": "answer1",
    "variable2": 2
  },
  "ttc": {
    "question1": 10,
    "question2": 20
  },
  "meta": {
    "source": "https://example.com",
    "url": "https://example.com",
    "userAgent": {
      "browser": "Chrome",
      "os": "Windows",
      "device": "Desktop"
    },
    "country": "US",
    "action": "click"
  },
  "contactAttributes": {
    "attribute1": "value1",
    "attribute2": "value2"
  },
  "singleUseId": "<string>",
  "language": "en",
  "displayId": "<string>"
}

Authorizations

x-api-key
string
header
required

Use your Formbricks x-api-key to authenticate.

Path Parameters

id
string
required

The ID of the response

Body

application/json

The response fields to update

finished
boolean
endingId
string | null
data
object
variables
object
ttc
object
language
string

Response

200 - application/json

Response updated successfully.

id
string

The ID of the response

createdAt
string

The date and time the response was created

Example:

"2021-01-01T00:00:00.000Z"

updatedAt
string

The date and time the response was last updated

Example:

"2021-01-01T00:00:00.000Z"

finished
boolean

Whether the response is finished

Example:

true

surveyId
string

The ID of the survey

contactId
string | null

The ID of the contact

endingId
string | null

The ID of the ending

data
object

The data of the response

Example:
{
"question1": "answer1",
"question2": 2,
"question3": ["answer3", "answer4"],
"question4": { "subquestion1": "answer5" }
}
variables
object

The variables of the response

Example:
{ "variable1": "answer1", "variable2": 2 }
ttc
object

The TTC of the response

Example:
{ "question1": 10, "question2": 20 }
meta
object

The meta data of the response

Example:
{
"source": "https://example.com",
"url": "https://example.com",
"userAgent": {
"browser": "Chrome",
"os": "Windows",
"device": "Desktop"
},
"country": "US",
"action": "click"
}
contactAttributes
object | null

The attributes of the contact

Example:
{
"attribute1": "value1",
"attribute2": "value2"
}
singleUseId
string | null

The single use ID of the response

language
string | null

The language of the response

Example:

"en"

displayId
string | null

The display ID of the response