Skip to main content
POST
/
api
/
v1
/
session_labels
/
Typescript (SDK)
import { SyllableSDK } from "syllable-sdk";

const syllableSDK = new SyllableSDK({
  apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});

async function run() {
  const result = await syllableSDK.sessionLabels.create({
    sessionId: 1,
    type: "auto-rating",
    code: "GOOD",
    userEmail: "user@email.com",
    issueCategories: [
      "Silent treatment",
    ],
  });

  console.log(result);
}

run();
import os
from syllable_sdk import SyllableSDK


with SyllableSDK(
    api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:

    res = ss_client.session_labels.create(request={
        "session_id": 1,
        "type": "auto-rating",
        "code": "GOOD",
        "user_email": "user@email.com",
        "issue_categories": [
            "Silent treatment",
        ],
    })

    # Handle response
    print(res)
curl --request POST \
  --url https://api.syllable.cloud/api/v1/session_labels/ \
  --header 'Content-Type: application/json' \
  --header 'Syllable-API-Key: <api-key>' \
  --data '
{
  "session_id": 123,
  "type": "<string>",
  "code": "<string>",
  "user_email": "<string>",
  "comments": "<string>",
  "issue_categories": [
    "Silent treatment"
  ]
}
'
const options = {
  method: 'POST',
  headers: {'Syllable-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    session_id: 123,
    type: '<string>',
    code: '<string>',
    user_email: '<string>',
    comments: '<string>',
    issue_categories: ['Silent treatment']
  })
};

fetch('https://api.syllable.cloud/api/v1/session_labels/', 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://api.syllable.cloud/api/v1/session_labels/",
  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([
    'session_id' => 123,
    'type' => '<string>',
    'code' => '<string>',
    'user_email' => '<string>',
    'comments' => '<string>',
    'issue_categories' => [
        'Silent treatment'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "Syllable-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://api.syllable.cloud/api/v1/session_labels/"

	payload := strings.NewReader("{\n  \"session_id\": 123,\n  \"type\": \"<string>\",\n  \"code\": \"<string>\",\n  \"user_email\": \"<string>\",\n  \"comments\": \"<string>\",\n  \"issue_categories\": [\n    \"Silent treatment\"\n  ]\n}")

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

	req.Header.Add("Syllable-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://api.syllable.cloud/api/v1/session_labels/")
  .header("Syllable-API-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"session_id\": 123,\n  \"type\": \"<string>\",\n  \"code\": \"<string>\",\n  \"user_email\": \"<string>\",\n  \"comments\": \"<string>\",\n  \"issue_categories\": [\n    \"Silent treatment\"\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.syllable.cloud/api/v1/session_labels/")

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

request = Net::HTTP::Post.new(url)
request["Syllable-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"session_id\": 123,\n  \"type\": \"<string>\",\n  \"code\": \"<string>\",\n  \"user_email\": \"<string>\",\n  \"comments\": \"<string>\",\n  \"issue_categories\": [\n    \"Silent treatment\"\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "session_id": 123,
  "type": "<string>",
  "code": "<string>",
  "user_email": "<string>",
  "id": 123,
  "timestamp": "<string>",
  "comments": "<string>",
  "issue_categories": [
    "Silent treatment"
  ]
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

Syllable-API-Key
string
header
required

Body

application/json
session_id
integer
required

The internal ID of the session (see Session.session_id)

Example:

1

type
string
required

The type of the label (either "auto-rating" or "human-rating")

Examples:

"auto-rating"

"human-rating"

code
string
required

A code describing the quality of the labeled session (either "GOOD", "OK", "BAD", or "N/A")

Examples:

"GOOD"

"OK"

"BAD"

"N/A"

user_email
string
required

The email of the user who created the label

Example:

"user@email.com"

comments
string | null

Comment string describing additional details about the session

issue_categories
string[] | null

Descriptions of issues occurring in the labeled call

Example:
["Silent treatment"]

Response

Successful Response

Response model for session label operations. A session label is associated with a given session and contains an evaluation of quality and descriptions of issues the user encountered in that session or other details.

session_id
integer
required

The internal ID of the session (see Session.session_id)

Example:

1

type
string
required

The type of the label (either "auto-rating" or "human-rating")

Examples:

"auto-rating"

"human-rating"

code
string
required

A code describing the quality of the labeled session (either "GOOD", "OK", "BAD", or "N/A")

Examples:

"GOOD"

"OK"

"BAD"

"N/A"

user_email
string
required

The email of the user who created the label

Example:

"user@email.com"

id
integer
required

The internal ID of the label

Example:

1

timestamp
string
required

The timestamp at which the label was created

Example:

"2024-01-01T12:00:00Z"

comments
string | null

Comment string describing additional details about the session

issue_categories
string[] | null

Descriptions of issues occurring in the labeled call

Example:
["Silent treatment"]