const response = await api.coding.createBrandJob({
surveyIdentifier: 'CSAT-2024-Q1',
surveyName: 'Customer Satisfaction',
surveyDescription: 'Tracking customer satisfaction and loyalty',
surveyResponses: [
{
questionIdentifier: 'Q1',
question: 'What did you like about our service?',
brandContext: {
industryDescription: 'E-commerce retail',
brands: [
{ name: 'Acme Store', variations: ['Acme', 'AcmeOnline'] }
]
},
responseEntries: [
{
responseIdentifier: '12345',
answer: 'The customer service representatives were very helpful.',
followupResponses: [
{ question: 'Which rep assisted you?', answer: 'Alice from support' }
]
}
]
}
]
});response = api.coding.create_brand_job(
survey_identifier='CSAT-2024-Q1',
survey_name='Customer Satisfaction',
survey_description='Tracking customer satisfaction and loyalty',
survey_responses=[{
'question_identifier': 'Q1',
'question': 'What did you like about our service?',
'brand_context': {
'industry_description': 'E-commerce retail',
'brands': [
{'name': 'Acme Store', 'variations': ['Acme', 'AcmeOnline']}
]
},
'response_entries': [
{
'response_identifier': '12345',
'answer': 'The customer service representatives were very helpful.',
'followup_responses': [
{'question': 'Which rep assisted you?', 'answer': 'Alice from support'}
]
}
]
}]
)curl --request POST \
--url https://surveys.getaftercare.com/api/v1/brand-coding \
--header 'Content-Type: application/json' \
--header 'X-Aftercare-Key: <api-key>' \
--data '
{
"surveyIdentifier": "CSAT-2024-Q1",
"surveyName": "Customer Satisfaction",
"surveyDescription": "Tracking customer satisfaction and loyalty for the XYZ Company",
"surveyResponses": [
{
"questionIdentifier": "Q1",
"question": "What did you like about our service?",
"brandContext": {
"industryDescription": "E-commerce retail",
"brands": [
{
"name": "Acme Store",
"variations": [
"Acme",
"AcmeOnline"
]
}
]
},
"responseEntries": [
{
"responseIdentifier": "12345",
"answer": "The customer service representatives were very helpful and resolved my issue quickly.",
"followupResponses": [
{
"question": "Which feature was most important?",
"answer": "Fast shipping"
}
]
},
{
"responseIdentifier": "12346",
"answer": "I liked the easy-to-use website and fast delivery."
}
]
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://surveys.getaftercare.com/api/v1/brand-coding",
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([
'surveyIdentifier' => 'CSAT-2024-Q1',
'surveyName' => 'Customer Satisfaction',
'surveyDescription' => 'Tracking customer satisfaction and loyalty for the XYZ Company',
'surveyResponses' => [
[
'questionIdentifier' => 'Q1',
'question' => 'What did you like about our service?',
'brandContext' => [
'industryDescription' => 'E-commerce retail',
'brands' => [
[
'name' => 'Acme Store',
'variations' => [
'Acme',
'AcmeOnline'
]
]
]
],
'responseEntries' => [
[
'responseIdentifier' => '12345',
'answer' => 'The customer service representatives were very helpful and resolved my issue quickly.',
'followupResponses' => [
[
'question' => 'Which feature was most important?',
'answer' => 'Fast shipping'
]
]
],
[
'responseIdentifier' => '12346',
'answer' => 'I liked the easy-to-use website and fast delivery.'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Aftercare-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://surveys.getaftercare.com/api/v1/brand-coding"
payload := strings.NewReader("{\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"surveyResponses\": [\n {\n \"questionIdentifier\": \"Q1\",\n \"question\": \"What did you like about our service?\",\n \"brandContext\": {\n \"industryDescription\": \"E-commerce retail\",\n \"brands\": [\n {\n \"name\": \"Acme Store\",\n \"variations\": [\n \"Acme\",\n \"AcmeOnline\"\n ]\n }\n ]\n },\n \"responseEntries\": [\n {\n \"responseIdentifier\": \"12345\",\n \"answer\": \"The customer service representatives were very helpful and resolved my issue quickly.\",\n \"followupResponses\": [\n {\n \"question\": \"Which feature was most important?\",\n \"answer\": \"Fast shipping\"\n }\n ]\n },\n {\n \"responseIdentifier\": \"12346\",\n \"answer\": \"I liked the easy-to-use website and fast delivery.\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Aftercare-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://surveys.getaftercare.com/api/v1/brand-coding")
.header("X-Aftercare-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"surveyResponses\": [\n {\n \"questionIdentifier\": \"Q1\",\n \"question\": \"What did you like about our service?\",\n \"brandContext\": {\n \"industryDescription\": \"E-commerce retail\",\n \"brands\": [\n {\n \"name\": \"Acme Store\",\n \"variations\": [\n \"Acme\",\n \"AcmeOnline\"\n ]\n }\n ]\n },\n \"responseEntries\": [\n {\n \"responseIdentifier\": \"12345\",\n \"answer\": \"The customer service representatives were very helpful and resolved my issue quickly.\",\n \"followupResponses\": [\n {\n \"question\": \"Which feature was most important?\",\n \"answer\": \"Fast shipping\"\n }\n ]\n },\n {\n \"responseIdentifier\": \"12346\",\n \"answer\": \"I liked the easy-to-use website and fast delivery.\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://surveys.getaftercare.com/api/v1/brand-coding")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Aftercare-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"surveyResponses\": [\n {\n \"questionIdentifier\": \"Q1\",\n \"question\": \"What did you like about our service?\",\n \"brandContext\": {\n \"industryDescription\": \"E-commerce retail\",\n \"brands\": [\n {\n \"name\": \"Acme Store\",\n \"variations\": [\n \"Acme\",\n \"AcmeOnline\"\n ]\n }\n ]\n },\n \"responseEntries\": [\n {\n \"responseIdentifier\": \"12345\",\n \"answer\": \"The customer service representatives were very helpful and resolved my issue quickly.\",\n \"followupResponses\": [\n {\n \"question\": \"Which feature was most important?\",\n \"answer\": \"Fast shipping\"\n }\n ]\n },\n {\n \"responseIdentifier\": \"12346\",\n \"answer\": \"I liked the easy-to-use website and fast delivery.\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"batchJobId": "123e4567-e89b-12d3-a456-426614174001",
"surveyIdentifier": "CSAT-2024-Q1",
"status": "queued",
"results": null
}{
"code": "INVALID_REQUEST",
"message": "Invalid request parameters",
"details": {
"brandContext": "industryDescription is required"
}
}{
"code": "INVALID_API_KEY",
"message": "Invalid or missing API key"
}{
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}{
"code": "GATEWAY_TIMEOUT",
"message": "The server took too long to respond"
}Create AI Brand Coding Job
Analyze survey responses in the context of specified brands and code them into hierarchical categories
const response = await api.coding.createBrandJob({
surveyIdentifier: 'CSAT-2024-Q1',
surveyName: 'Customer Satisfaction',
surveyDescription: 'Tracking customer satisfaction and loyalty',
surveyResponses: [
{
questionIdentifier: 'Q1',
question: 'What did you like about our service?',
brandContext: {
industryDescription: 'E-commerce retail',
brands: [
{ name: 'Acme Store', variations: ['Acme', 'AcmeOnline'] }
]
},
responseEntries: [
{
responseIdentifier: '12345',
answer: 'The customer service representatives were very helpful.',
followupResponses: [
{ question: 'Which rep assisted you?', answer: 'Alice from support' }
]
}
]
}
]
});response = api.coding.create_brand_job(
survey_identifier='CSAT-2024-Q1',
survey_name='Customer Satisfaction',
survey_description='Tracking customer satisfaction and loyalty',
survey_responses=[{
'question_identifier': 'Q1',
'question': 'What did you like about our service?',
'brand_context': {
'industry_description': 'E-commerce retail',
'brands': [
{'name': 'Acme Store', 'variations': ['Acme', 'AcmeOnline']}
]
},
'response_entries': [
{
'response_identifier': '12345',
'answer': 'The customer service representatives were very helpful.',
'followup_responses': [
{'question': 'Which rep assisted you?', 'answer': 'Alice from support'}
]
}
]
}]
)curl --request POST \
--url https://surveys.getaftercare.com/api/v1/brand-coding \
--header 'Content-Type: application/json' \
--header 'X-Aftercare-Key: <api-key>' \
--data '
{
"surveyIdentifier": "CSAT-2024-Q1",
"surveyName": "Customer Satisfaction",
"surveyDescription": "Tracking customer satisfaction and loyalty for the XYZ Company",
"surveyResponses": [
{
"questionIdentifier": "Q1",
"question": "What did you like about our service?",
"brandContext": {
"industryDescription": "E-commerce retail",
"brands": [
{
"name": "Acme Store",
"variations": [
"Acme",
"AcmeOnline"
]
}
]
},
"responseEntries": [
{
"responseIdentifier": "12345",
"answer": "The customer service representatives were very helpful and resolved my issue quickly.",
"followupResponses": [
{
"question": "Which feature was most important?",
"answer": "Fast shipping"
}
]
},
{
"responseIdentifier": "12346",
"answer": "I liked the easy-to-use website and fast delivery."
}
]
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://surveys.getaftercare.com/api/v1/brand-coding",
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([
'surveyIdentifier' => 'CSAT-2024-Q1',
'surveyName' => 'Customer Satisfaction',
'surveyDescription' => 'Tracking customer satisfaction and loyalty for the XYZ Company',
'surveyResponses' => [
[
'questionIdentifier' => 'Q1',
'question' => 'What did you like about our service?',
'brandContext' => [
'industryDescription' => 'E-commerce retail',
'brands' => [
[
'name' => 'Acme Store',
'variations' => [
'Acme',
'AcmeOnline'
]
]
]
],
'responseEntries' => [
[
'responseIdentifier' => '12345',
'answer' => 'The customer service representatives were very helpful and resolved my issue quickly.',
'followupResponses' => [
[
'question' => 'Which feature was most important?',
'answer' => 'Fast shipping'
]
]
],
[
'responseIdentifier' => '12346',
'answer' => 'I liked the easy-to-use website and fast delivery.'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Aftercare-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://surveys.getaftercare.com/api/v1/brand-coding"
payload := strings.NewReader("{\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"surveyResponses\": [\n {\n \"questionIdentifier\": \"Q1\",\n \"question\": \"What did you like about our service?\",\n \"brandContext\": {\n \"industryDescription\": \"E-commerce retail\",\n \"brands\": [\n {\n \"name\": \"Acme Store\",\n \"variations\": [\n \"Acme\",\n \"AcmeOnline\"\n ]\n }\n ]\n },\n \"responseEntries\": [\n {\n \"responseIdentifier\": \"12345\",\n \"answer\": \"The customer service representatives were very helpful and resolved my issue quickly.\",\n \"followupResponses\": [\n {\n \"question\": \"Which feature was most important?\",\n \"answer\": \"Fast shipping\"\n }\n ]\n },\n {\n \"responseIdentifier\": \"12346\",\n \"answer\": \"I liked the easy-to-use website and fast delivery.\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Aftercare-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://surveys.getaftercare.com/api/v1/brand-coding")
.header("X-Aftercare-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"surveyResponses\": [\n {\n \"questionIdentifier\": \"Q1\",\n \"question\": \"What did you like about our service?\",\n \"brandContext\": {\n \"industryDescription\": \"E-commerce retail\",\n \"brands\": [\n {\n \"name\": \"Acme Store\",\n \"variations\": [\n \"Acme\",\n \"AcmeOnline\"\n ]\n }\n ]\n },\n \"responseEntries\": [\n {\n \"responseIdentifier\": \"12345\",\n \"answer\": \"The customer service representatives were very helpful and resolved my issue quickly.\",\n \"followupResponses\": [\n {\n \"question\": \"Which feature was most important?\",\n \"answer\": \"Fast shipping\"\n }\n ]\n },\n {\n \"responseIdentifier\": \"12346\",\n \"answer\": \"I liked the easy-to-use website and fast delivery.\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://surveys.getaftercare.com/api/v1/brand-coding")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Aftercare-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"surveyResponses\": [\n {\n \"questionIdentifier\": \"Q1\",\n \"question\": \"What did you like about our service?\",\n \"brandContext\": {\n \"industryDescription\": \"E-commerce retail\",\n \"brands\": [\n {\n \"name\": \"Acme Store\",\n \"variations\": [\n \"Acme\",\n \"AcmeOnline\"\n ]\n }\n ]\n },\n \"responseEntries\": [\n {\n \"responseIdentifier\": \"12345\",\n \"answer\": \"The customer service representatives were very helpful and resolved my issue quickly.\",\n \"followupResponses\": [\n {\n \"question\": \"Which feature was most important?\",\n \"answer\": \"Fast shipping\"\n }\n ]\n },\n {\n \"responseIdentifier\": \"12346\",\n \"answer\": \"I liked the easy-to-use website and fast delivery.\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"batchJobId": "123e4567-e89b-12d3-a456-426614174001",
"surveyIdentifier": "CSAT-2024-Q1",
"status": "queued",
"results": null
}{
"code": "INVALID_REQUEST",
"message": "Invalid request parameters",
"details": {
"brandContext": "industryDescription is required"
}
}{
"code": "INVALID_API_KEY",
"message": "Invalid or missing API key"
}{
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}{
"code": "GATEWAY_TIMEOUT",
"message": "The server took too long to respond"
}Authorizations
API key for authentication
Body
Unique string to identify the survey.
"CSAT-2024-Q1"
Full collection of survey responses by question.
Show child attributes
Show child attributes
Optional name for the survey. This is used to identify the survey in the Aftercare platform.
"Customer Satisfaction"
An optional description of the survey's purpose, used to help the AI understand the context behind thesurvey better.
"Quarterly survey tracking customer satisfaction and loyalty for the XYZ Company which sells xyz products"
Response
Brand coding job accepted
Unique identifier for the coding job
"123e4567-e89b-12d3-a456-426614174000"
Unique identifier for the survey
"CSAT-2024-Q1"
Status of the batch job that determines the structure of results
queued, processing, completed, partial_failure, total_failure The results structure depends on the status value. If the job is successful, the results will be a list of question codes with a hierarchical tree of codes and subcodes. If the job fails, the results will be the error details.
- Success Response
- Error Response
Show child attributes
Show child attributes

