curl --request POST \
--url https://app.formbricks.com/api/v2/management/responses \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"surveyId": "<string>",
"finished": true,
"data": {
"question1": "answer1",
"question2": 2,
"question3": [
"answer3",
"answer4"
],
"question4": {
"subquestion1": "answer5"
}
},
"createdAt": "2021-01-01T00:00:00.000Z",
"updatedAt": "2021-01-01T00:00:00.000Z",
"displayId": "<string>",
"singleUseId": "<string>",
"endingId": "<string>",
"language": "en",
"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"
},
"userId": "<string>"
}
'import requests
url = "https://app.formbricks.com/api/v2/management/responses"
payload = {
"surveyId": "<string>",
"finished": True,
"data": {
"question1": "answer1",
"question2": 2,
"question3": ["answer3", "answer4"],
"question4": { "subquestion1": "answer5" }
},
"createdAt": "2021-01-01T00:00:00.000Z",
"updatedAt": "2021-01-01T00:00:00.000Z",
"displayId": "<string>",
"singleUseId": "<string>",
"endingId": "<string>",
"language": "en",
"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"
},
"userId": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
surveyId: '<string>',
finished: true,
data: {
question1: 'answer1',
question2: 2,
question3: ['answer3', 'answer4'],
question4: {subquestion1: 'answer5'}
},
createdAt: '2021-01-01T00:00:00.000Z',
updatedAt: '2021-01-01T00:00:00.000Z',
displayId: '<string>',
singleUseId: '<string>',
endingId: '<string>',
language: 'en',
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'
},
userId: '<string>'
})
};
fetch('https://app.formbricks.com/api/v2/management/responses', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'surveyId' => '<string>',
'finished' => true,
'data' => [
'question1' => 'answer1',
'question2' => 2,
'question3' => [
'answer3',
'answer4'
],
'question4' => [
'subquestion1' => 'answer5'
]
],
'createdAt' => '2021-01-01T00:00:00.000Z',
'updatedAt' => '2021-01-01T00:00:00.000Z',
'displayId' => '<string>',
'singleUseId' => '<string>',
'endingId' => '<string>',
'language' => 'en',
'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'
],
'userId' => '<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"
payload := strings.NewReader("{\n \"surveyId\": \"<string>\",\n \"finished\": true,\n \"data\": {\n \"question1\": \"answer1\",\n \"question2\": 2,\n \"question3\": [\n \"answer3\",\n \"answer4\"\n ],\n \"question4\": {\n \"subquestion1\": \"answer5\"\n }\n },\n \"createdAt\": \"2021-01-01T00:00:00.000Z\",\n \"updatedAt\": \"2021-01-01T00:00:00.000Z\",\n \"displayId\": \"<string>\",\n \"singleUseId\": \"<string>\",\n \"endingId\": \"<string>\",\n \"language\": \"en\",\n \"variables\": {\n \"variable1\": \"answer1\",\n \"variable2\": 2\n },\n \"ttc\": {\n \"question1\": 10,\n \"question2\": 20\n },\n \"meta\": {\n \"source\": \"https://example.com\",\n \"url\": \"https://example.com\",\n \"userAgent\": {\n \"browser\": \"Chrome\",\n \"os\": \"Windows\",\n \"device\": \"Desktop\"\n },\n \"country\": \"US\",\n \"action\": \"click\"\n },\n \"userId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://app.formbricks.com/api/v2/management/responses")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"surveyId\": \"<string>\",\n \"finished\": true,\n \"data\": {\n \"question1\": \"answer1\",\n \"question2\": 2,\n \"question3\": [\n \"answer3\",\n \"answer4\"\n ],\n \"question4\": {\n \"subquestion1\": \"answer5\"\n }\n },\n \"createdAt\": \"2021-01-01T00:00:00.000Z\",\n \"updatedAt\": \"2021-01-01T00:00:00.000Z\",\n \"displayId\": \"<string>\",\n \"singleUseId\": \"<string>\",\n \"endingId\": \"<string>\",\n \"language\": \"en\",\n \"variables\": {\n \"variable1\": \"answer1\",\n \"variable2\": 2\n },\n \"ttc\": {\n \"question1\": 10,\n \"question2\": 20\n },\n \"meta\": {\n \"source\": \"https://example.com\",\n \"url\": \"https://example.com\",\n \"userAgent\": {\n \"browser\": \"Chrome\",\n \"os\": \"Windows\",\n \"device\": \"Desktop\"\n },\n \"country\": \"US\",\n \"action\": \"click\"\n },\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.formbricks.com/api/v2/management/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"surveyId\": \"<string>\",\n \"finished\": true,\n \"data\": {\n \"question1\": \"answer1\",\n \"question2\": 2,\n \"question3\": [\n \"answer3\",\n \"answer4\"\n ],\n \"question4\": {\n \"subquestion1\": \"answer5\"\n }\n },\n \"createdAt\": \"2021-01-01T00:00:00.000Z\",\n \"updatedAt\": \"2021-01-01T00:00:00.000Z\",\n \"displayId\": \"<string>\",\n \"singleUseId\": \"<string>\",\n \"endingId\": \"<string>\",\n \"language\": \"en\",\n \"variables\": {\n \"variable1\": \"answer1\",\n \"variable2\": 2\n },\n \"ttc\": {\n \"question1\": 10,\n \"question2\": 20\n },\n \"meta\": {\n \"source\": \"https://example.com\",\n \"url\": \"https://example.com\",\n \"userAgent\": {\n \"browser\": \"Chrome\",\n \"os\": \"Windows\",\n \"device\": \"Desktop\"\n },\n \"country\": \"US\",\n \"action\": \"click\"\n },\n \"userId\": \"<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>"
}Create a response
Creates a response in the database. This will trigger the response pipeline, including webhooks, integrations, follow-up emails, and other configured actions.
curl --request POST \
--url https://app.formbricks.com/api/v2/management/responses \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"surveyId": "<string>",
"finished": true,
"data": {
"question1": "answer1",
"question2": 2,
"question3": [
"answer3",
"answer4"
],
"question4": {
"subquestion1": "answer5"
}
},
"createdAt": "2021-01-01T00:00:00.000Z",
"updatedAt": "2021-01-01T00:00:00.000Z",
"displayId": "<string>",
"singleUseId": "<string>",
"endingId": "<string>",
"language": "en",
"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"
},
"userId": "<string>"
}
'import requests
url = "https://app.formbricks.com/api/v2/management/responses"
payload = {
"surveyId": "<string>",
"finished": True,
"data": {
"question1": "answer1",
"question2": 2,
"question3": ["answer3", "answer4"],
"question4": { "subquestion1": "answer5" }
},
"createdAt": "2021-01-01T00:00:00.000Z",
"updatedAt": "2021-01-01T00:00:00.000Z",
"displayId": "<string>",
"singleUseId": "<string>",
"endingId": "<string>",
"language": "en",
"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"
},
"userId": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
surveyId: '<string>',
finished: true,
data: {
question1: 'answer1',
question2: 2,
question3: ['answer3', 'answer4'],
question4: {subquestion1: 'answer5'}
},
createdAt: '2021-01-01T00:00:00.000Z',
updatedAt: '2021-01-01T00:00:00.000Z',
displayId: '<string>',
singleUseId: '<string>',
endingId: '<string>',
language: 'en',
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'
},
userId: '<string>'
})
};
fetch('https://app.formbricks.com/api/v2/management/responses', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'surveyId' => '<string>',
'finished' => true,
'data' => [
'question1' => 'answer1',
'question2' => 2,
'question3' => [
'answer3',
'answer4'
],
'question4' => [
'subquestion1' => 'answer5'
]
],
'createdAt' => '2021-01-01T00:00:00.000Z',
'updatedAt' => '2021-01-01T00:00:00.000Z',
'displayId' => '<string>',
'singleUseId' => '<string>',
'endingId' => '<string>',
'language' => 'en',
'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'
],
'userId' => '<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"
payload := strings.NewReader("{\n \"surveyId\": \"<string>\",\n \"finished\": true,\n \"data\": {\n \"question1\": \"answer1\",\n \"question2\": 2,\n \"question3\": [\n \"answer3\",\n \"answer4\"\n ],\n \"question4\": {\n \"subquestion1\": \"answer5\"\n }\n },\n \"createdAt\": \"2021-01-01T00:00:00.000Z\",\n \"updatedAt\": \"2021-01-01T00:00:00.000Z\",\n \"displayId\": \"<string>\",\n \"singleUseId\": \"<string>\",\n \"endingId\": \"<string>\",\n \"language\": \"en\",\n \"variables\": {\n \"variable1\": \"answer1\",\n \"variable2\": 2\n },\n \"ttc\": {\n \"question1\": 10,\n \"question2\": 20\n },\n \"meta\": {\n \"source\": \"https://example.com\",\n \"url\": \"https://example.com\",\n \"userAgent\": {\n \"browser\": \"Chrome\",\n \"os\": \"Windows\",\n \"device\": \"Desktop\"\n },\n \"country\": \"US\",\n \"action\": \"click\"\n },\n \"userId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://app.formbricks.com/api/v2/management/responses")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"surveyId\": \"<string>\",\n \"finished\": true,\n \"data\": {\n \"question1\": \"answer1\",\n \"question2\": 2,\n \"question3\": [\n \"answer3\",\n \"answer4\"\n ],\n \"question4\": {\n \"subquestion1\": \"answer5\"\n }\n },\n \"createdAt\": \"2021-01-01T00:00:00.000Z\",\n \"updatedAt\": \"2021-01-01T00:00:00.000Z\",\n \"displayId\": \"<string>\",\n \"singleUseId\": \"<string>\",\n \"endingId\": \"<string>\",\n \"language\": \"en\",\n \"variables\": {\n \"variable1\": \"answer1\",\n \"variable2\": 2\n },\n \"ttc\": {\n \"question1\": 10,\n \"question2\": 20\n },\n \"meta\": {\n \"source\": \"https://example.com\",\n \"url\": \"https://example.com\",\n \"userAgent\": {\n \"browser\": \"Chrome\",\n \"os\": \"Windows\",\n \"device\": \"Desktop\"\n },\n \"country\": \"US\",\n \"action\": \"click\"\n },\n \"userId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.formbricks.com/api/v2/management/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"surveyId\": \"<string>\",\n \"finished\": true,\n \"data\": {\n \"question1\": \"answer1\",\n \"question2\": 2,\n \"question3\": [\n \"answer3\",\n \"answer4\"\n ],\n \"question4\": {\n \"subquestion1\": \"answer5\"\n }\n },\n \"createdAt\": \"2021-01-01T00:00:00.000Z\",\n \"updatedAt\": \"2021-01-01T00:00:00.000Z\",\n \"displayId\": \"<string>\",\n \"singleUseId\": \"<string>\",\n \"endingId\": \"<string>\",\n \"language\": \"en\",\n \"variables\": {\n \"variable1\": \"answer1\",\n \"variable2\": 2\n },\n \"ttc\": {\n \"question1\": 10,\n \"question2\": 20\n },\n \"meta\": {\n \"source\": \"https://example.com\",\n \"url\": \"https://example.com\",\n \"userAgent\": {\n \"browser\": \"Chrome\",\n \"os\": \"Windows\",\n \"device\": \"Desktop\"\n },\n \"country\": \"US\",\n \"action\": \"click\"\n },\n \"userId\": \"<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
Use your Formbricks x-api-key to authenticate.
Body
The response to create
The ID of the survey
Whether the response is finished
true
The data of the response
Show child attributes
Show child attributes
{
"question1": "answer1",
"question2": 2,
"question3": ["answer3", "answer4"],
"question4": { "subquestion1": "answer5" }
}The date and time the response was created
"2021-01-01T00:00:00.000Z"
The date and time the response was last updated
"2021-01-01T00:00:00.000Z"
The display ID of the response
The single use ID of the response
The ID of the ending
The language of the response
"en"
The variables of the response
Show child attributes
Show child attributes
{ "variable1": "answer1", "variable2": 2 }The TTC of the response
Show child attributes
Show child attributes
{ "question1": 10, "question2": 20 }The meta data of the response
Show child attributes
Show child attributes
{
"source": "https://example.com",
"url": "https://example.com",
"userAgent": {
"browser": "Chrome",
"os": "Windows",
"device": "Desktop"
},
"country": "US",
"action": "click"
}Response
Response created successfully.
The ID of the response
The date and time the response was created
"2021-01-01T00:00:00.000Z"
The date and time the response was last updated
"2021-01-01T00:00:00.000Z"
Whether the response is finished
true
The ID of the survey
The ID of the contact
The ID of the ending
The data of the response
Show child attributes
Show child attributes
{
"question1": "answer1",
"question2": 2,
"question3": ["answer3", "answer4"],
"question4": { "subquestion1": "answer5" }
}The variables of the response
Show child attributes
Show child attributes
{ "variable1": "answer1", "variable2": 2 }The TTC of the response
Show child attributes
Show child attributes
{ "question1": 10, "question2": 20 }The meta data of the response
Show child attributes
Show child attributes
{
"source": "https://example.com",
"url": "https://example.com",
"userAgent": {
"browser": "Chrome",
"os": "Windows",
"device": "Desktop"
},
"country": "US",
"action": "click"
}The attributes of the contact
Show child attributes
Show child attributes
{
"attribute1": "value1",
"attribute2": "value2"
}The single use ID of the response
The language of the response
"en"
The display ID of the response
Was this page helpful?