Skip to main content
POST
/
api
/
v1
/
management
/
responses
Create Response
curl --request POST \
  --url https://{baseurl}/api/v1/management/responses \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "createdAt": "2024-09-05T08:44:16.051Z",
  "data": {
    "hg508afs7lgx8nlni5dtit5u": [
      "Hello World"
    ]
  },
  "finished": false,
  "language": "en",
  "surveyId": "clwj7hi7r0000vfhpfze6vjdg",
  "updatedAt": "2024-09-05T08:44:16.051Z"
}
'
import requests

url = "https://{baseurl}/api/v1/management/responses"

payload = {
    "createdAt": "2024-09-05T08:44:16.051Z",
    "data": { "hg508afs7lgx8nlni5dtit5u": ["Hello World"] },
    "finished": False,
    "language": "en",
    "surveyId": "clwj7hi7r0000vfhpfze6vjdg",
    "updatedAt": "2024-09-05T08:44:16.051Z"
}
headers = {
    "x-api-key": "<x-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': '<x-api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    createdAt: '2024-09-05T08:44:16.051Z',
    data: {hg508afs7lgx8nlni5dtit5u: ['Hello World']},
    finished: false,
    language: 'en',
    surveyId: 'clwj7hi7r0000vfhpfze6vjdg',
    updatedAt: '2024-09-05T08:44:16.051Z'
  })
};

fetch('https://{baseurl}/api/v1/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://{baseurl}/api/v1/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([
    'createdAt' => '2024-09-05T08:44:16.051Z',
    'data' => [
        'hg508afs7lgx8nlni5dtit5u' => [
                'Hello World'
        ]
    ],
    'finished' => false,
    'language' => 'en',
    'surveyId' => 'clwj7hi7r0000vfhpfze6vjdg',
    'updatedAt' => '2024-09-05T08:44:16.051Z'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "x-api-key: <x-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://{baseurl}/api/v1/management/responses"

	payload := strings.NewReader("{\n  \"createdAt\": \"2024-09-05T08:44:16.051Z\",\n  \"data\": {\n    \"hg508afs7lgx8nlni5dtit5u\": [\n      \"Hello World\"\n    ]\n  },\n  \"finished\": false,\n  \"language\": \"en\",\n  \"surveyId\": \"clwj7hi7r0000vfhpfze6vjdg\",\n  \"updatedAt\": \"2024-09-05T08:44:16.051Z\"\n}")

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

	req.Header.Add("x-api-key", "<x-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://{baseurl}/api/v1/management/responses")
  .header("x-api-key", "<x-api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"createdAt\": \"2024-09-05T08:44:16.051Z\",\n  \"data\": {\n    \"hg508afs7lgx8nlni5dtit5u\": [\n      \"Hello World\"\n    ]\n  },\n  \"finished\": false,\n  \"language\": \"en\",\n  \"surveyId\": \"clwj7hi7r0000vfhpfze6vjdg\",\n  \"updatedAt\": \"2024-09-05T08:44:16.051Z\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{baseurl}/api/v1/management/responses")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"createdAt\": \"2024-09-05T08:44:16.051Z\",\n  \"data\": {\n    \"hg508afs7lgx8nlni5dtit5u\": [\n      \"Hello World\"\n    ]\n  },\n  \"finished\": false,\n  \"language\": \"en\",\n  \"surveyId\": \"clwj7hi7r0000vfhpfze6vjdg\",\n  \"updatedAt\": \"2024-09-05T08:44:16.051Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "createdAt": "2024-04-23T12:15:01.680Z",
    "data": {
      "hs8yd14l9h8u353tjmv6rzaw": "clicked",
      "hs8yd14l9h8u353tjmv6rzawqqq": "clicked",
      "tcgls0063n8ri7dtrbnepcmz": "Who? Who? Who?"
    },
    "finished": true,
    "id": "clvccml2p0009xz1zrlk1wbqb",
    "language": "en",
    "meta": {
      "action": "test action",
      "source": "Postman API",
      "url": "https://postman.com",
      "userAgent": {}
    },
    "person": {
      "attributes": {
        "Created From": "API",
        "created_from": "API"
      },
      "createdAt": "2024-04-23T07:39:22.696Z",
      "id": "clvc2s3ig000k494jltkqkm2u",
      "updatedAt": "2024-04-23T07:39:22.696Z",
      "userId": "THIS-IS-A-VVERY-LONG-USER-ID-FOR-TESTING",
      "workspaceId": "clurwouax000azffxt7n5unn3"
    },
    "personAttributes": {
      "Created From": "API",
      "created_from": "API"
    },
    "singleUseId": null,
    "surveyId": "clus3omb00009oo10s53e2pa5",
    "tags": [],
    "ttc": {
      "_total": 310,
      "hs8yd14l9h8u353tjmv6rzawqqq": 120,
      "tcgls0063n8ri7dtrbnepcmz": 190
    },
    "updatedAt": "2024-04-23T12:16:39.774Z"
  }
}
{
  "code": "unauthorized",
  "details": {},
  "message": "You are not authorized to access this resource"
}

Headers

x-api-key
string
required

Body

application/json
surveyId
string
required

The ID of the survey this response belongs to

createdAt
string<date-time>

Creation timestamp (optional; usually set by server)

data
object

Answers keyed by questionId; value shape depends on question type

finished
boolean

Whether the response is marked as finished

language
enum<string>

Language of the response (survey should have this language enabled)

Available options:
en,
de,
pt,
etc..
updatedAt
string<date-time>

Update timestamp (optional; usually set by server)

Response

OK

The response is of type object.