Record a turn of a Tally AI conversation
1 min
POST
https://api.b.preview.loyaltyservices.io/api/v3/ai/threads/{threadIdentifier}/turns
Path Parameters
- threadIdentifierstringrequiredExampleDescriptionMin Length1Max Length128Pattern^[A-Za-z0-9_-]+$
Body Parameters
- bodyAiTurnrequiredDescription
- userMessagestringrequiredExampleDescriptionMin Length1Max Length4000
- answerstringExampleDescriptionMax Length100000
- errorMessagestringExampleDescriptionMax Length1000
- ratingAiRatingDescription
- verdictstring<up | down>requiredExampleDescriptionAllowedupdown
- commentstringExampleDescriptionMax Length4000
Responses
200
- AiTurnDescription
- turnIdinteger<int64>ExampleDescriptionFormatint64Minimum1
- turnNumberinteger<int32>ExampleDescriptionFormatint32Minimum1
- userMessagestringrequiredExampleDescriptionMin Length1Max Length4000
- answerstringExampleDescriptionMax Length100000
- errorMessagestringExampleDescriptionMax Length1000
- createDatestring<date-time>ExampleDescriptionFormatdate-time
- ratingAiRatingDescription
- verdictstring<up | down>requiredExampleDescriptionAllowedupdown
- commentstringExampleDescriptionMax Length4000
400
- ErrorResponse
- errorsValidationError[]Description
- codestringDescription
- fieldNamestringDescription
- messagestringDescription
- messageParametersobject[]Description
401
403
500
curl
curl --request POST \
--url https://api.b.preview.loyaltyservices.io/api/v3/ai/threads/{threadIdentifier}/turns \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"userMessage": "What is the point balance for member 100234567?",
"rating": {
"verdict": "down"
}
}'ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.b.preview.loyaltyservices.io/api/v3/ai/threads/{threadIdentifier}/turns")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"userMessage": "What is the point balance for member 100234567?",
"rating": {
"verdict": "down"
}
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.b.preview.loyaltyservices.io/api/v3/ai/threads/{threadIdentifier}/turns"
payload = json.dumps({
"userMessage": "What is the point balance for member 100234567?",
"rating": {
"verdict": "down"
}
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"userMessage\": \"What is the point balance for member 100234567?\",\n \"rating\": {\n \"verdict\": \"down\"\n }\n}");
Request request = new Request.Builder()
.url("https://api.b.preview.loyaltyservices.io/api/v3/ai/threads/{threadIdentifier}/turns")
.method("POST", body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();200
// Success
{
"turnId": 1042,
"turnNumber": 5,
"userMessage": "What is the point balance for member 100234567?",
"answer": "Member 100234567 has 12,500 points.",
"errorMessage": "The member service did not respond.",
"createDate": "2026-10-29T15:04:05Z",
"rating": {
"verdict": "down",
"comment": "It read the balance from the wrong account."
}
}400
// Bad request.
{
"errors": [
{
"code": "",
"fieldName": "",
"message": "",
"messageParameters": [
{}
]
}
]
}401
// Unauthorized
403
// Forbidden
500
// Internal error