Code Examples
Integration examples in multiple programming languages.
Submit Content for Review
Here's how to submit AI-generated content for review in different languages:
-
name: 'https://checkyour.ai/api/v1/reviews'
uri:
url: 'https://checkyour.ai/api/v1/reviews'
method: POST
body:
input: 'Customer asked: How do I return my order?'
output: 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.'
context: 'VIP customer support inquiry'
model: gpt-4
external_id: TICKET-1234
category: customer_support
review_focus: accuracy
language: en-US
confidence: 0.92
webhook_url: 'https://myapp.com/webhooks/review-completed'
metadata:
ticket_id: '1234'
customer_id: CUST-789
body_format: json
headers:
Authorization: 'Bearer YOUR_API_TOKEN'
Content-Type: application/json
register: result
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
struct curl_slist *headers;
headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_API_TOKEN");
headers = curl_slist_append(headers, "Content-Type: application/json");
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
curl_easy_setopt(hnd, CURLOPT_URL, "https://checkyour.ai/api/v1/reviews");
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}");
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)455);
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/8.2.1");
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_2TLS);
curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
curl_slist_free_all(headers);
headers = NULL;
return (int)ret;
}
httpService = new http();
httpService.setUrl("https://checkyour.ai/api/v1/reviews");
httpService.setMethod("POST");
httpService.addParam(type="header", name="Authorization", value="Bearer YOUR_API_TOKEN");
httpService.addParam(type="header", name="Content-Type", value="application/json");
httpService.addParam(type="body", value='{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}');
result = httpService.send().getPrefix();
writeDump(result);
using System.Net.Http;
using System.Net.Http.Headers;
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://checkyour.ai/api/v1/reviews");
request.Headers.Add("Authorization", "Bearer YOUR_API_TOKEN");
request.Content = new StringContent("{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
import 'package:http/http.dart' as http;
void main() async {
final headers = {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json',
};
final data = '{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}';
final url = Uri.parse('https://checkyour.ai/api/v1/reviews');
final res = await http.post(url, headers: headers, body: data);
final status = res.statusCode;
if (status != 200) throw Exception('http.post error: statusCode= $status');
print(res.body);
}
response = HTTPoison.post!(
"https://checkyour.ai/api/v1/reviews",
"{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}",
[
{"Authorization", "Bearer YOUR_API_TOKEN"},
{"Content-Type", "application/json"}
]
)
package main
import (
"fmt"
"io"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}`)
req, err := http.NewRequest("POST", "https://checkyour.ai/api/v1/reviews", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bodyText, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)
}
{
"log": {
"version": "1.2",
"entries": [
{
"request": {
"method": "POST",
"url": "https://checkyour.ai/api/v1/reviews",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Authorization",
"value": "Bearer YOUR_API_TOKEN"
},
{
"name": "Content-Type",
"value": "application/json"
}
],
"queryString": [],
"headersSize": -1,
"bodySize": -1,
"postData": {
"mimeType": "application/json",
"text": "{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}"
}
}
}
]
}
}
POST /api/v1/reviews HTTP/1.1
Host: checkyour.ai
User-Agent: curl/8.2.1
Accept: */*
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
Content-Length: 455
{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://checkyour.ai/api/v1/reviews");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("POST");
httpConn.setRequestProperty("Authorization", "Bearer YOUR_API_TOKEN");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
class Main {
public static void main(String[] args) throws IOException {
Connection.Response response = Jsoup.connect("https://checkyour.ai/api/v1/reviews")
.header("Authorization", "Bearer YOUR_API_TOKEN")
.header("Content-Type", "application/json")
.requestBody("{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}")
.method(org.jsoup.Connection.Method.POST)
.ignoreContentType(true)
.execute();
System.out.println(response.parse());
}
}
import java.io.IOException;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
OkHttpClient client = new OkHttpClient();
String requestBody = "{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}";
Request request = new Request.Builder()
.url("https://checkyour.ai/api/v1/reviews")
.post(requestBody)
.header("Authorization", "Bearer YOUR_API_TOKEN")
.header("Content-Type", "application/json")
.build();
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
response.body().string();
}
fetch('https://checkyour.ai/api/v1/reviews', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789'
}
})
});
$.ajax({
url: 'https://checkyour.ai/api/v1/reviews',
crossDomain: true,
method: 'post',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN'
},
contentType: 'application/json',
data: JSON.stringify({
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789'
}
})
}).done(function(response) {
console.log(response);
});
const data = JSON.stringify({
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789'
}
});
let xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.open('POST', 'https://checkyour.ai/api/v1/reviews');
xhr.setRequestHeader('Authorization', 'Bearer YOUR_API_TOKEN');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function() {
console.log(xhr.response);
};
xhr.send(data);
{
"url": "https://checkyour.ai/api/v1/reviews",
"raw_url": "https://checkyour.ai/api/v1/reviews",
"method": "post",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
"data": {
"input": "Customer asked: How do I return my order?",
"output": "To return your order, visit our returns page at returns.example.com within 30 days of delivery.",
"context": "VIP customer support inquiry",
"model": "gpt-4",
"external_id": "TICKET-1234",
"category": "customer_support",
"review_focus": "accuracy",
"language": "en-US",
"confidence": 0.92,
"webhook_url": "https://myapp.com/webhooks/review-completed",
"metadata": {
"ticket_id": "1234",
"customer_id": "CUST-789"
}
}
}
using HTTP, JSON
headers = Dict(
"Authorization" => "Bearer YOUR_API_TOKEN",
"Content-Type" => "application/json"
)
body = Dict(
"input" => "Customer asked: How do I return my order?",
"output" => "To return your order, visit our returns page at returns.example.com within 30 days of delivery.",
"context" => "VIP customer support inquiry",
"model" => "gpt-4",
"external_id" => "TICKET-1234",
"category" => "customer_support",
"review_focus" => "accuracy",
"language" => "en-US",
"confidence" => 0.92,
"webhook_url" => "https://myapp.com/webhooks/review-completed",
"metadata" => Dict(
"ticket_id" => "1234",
"customer_id" => "CUST-789"
)
)
resp = HTTP.post("https://checkyour.ai/api/v1/reviews", headers, JSON.json(body))
import java.io.IOException
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
val client = OkHttpClient()
val MEDIA_TYPE = "application/json".toMediaType()
val requestBody = "{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}"
val request = Request.Builder()
.url("https://checkyour.ai/api/v1/reviews")
.post(requestBody.toRequestBody(MEDIA_TYPE))
.header("Authorization", "Bearer YOUR_API_TOKEN")
.header("Content-Type", "application/json")
.build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected code $response")
response.body!!.string()
}
local http = require("socket.http")
local json = require("json")
local ltn12 = require("ltn12")
local body, code, headers, status = http.request{
method = "POST",
url = "https://checkyour.ai/api/v1/reviews",
source = ltn12.source.string(json.encode({
input = "Customer asked: How do I return my order?",
output = "To return your order, visit our returns page at returns.example.com within 30 days of delivery.",
context = "VIP customer support inquiry",
model = "gpt-4",
external_id = "TICKET-1234",
category = "customer_support",
review_focus = "accuracy",
language = "en-US",
confidence = 0.92,
webhook_url = "https://myapp.com/webhooks/review-completed",
metadata = {
ticket_id = "1234",
customer_id = "CUST-789"
}
})),
headers = {
Authorization = "Bearer YOUR_API_TOKEN",
["Content-Type"] = "application/json"
}
}
%% Web Access using Data Import and Export API
uri = 'https://checkyour.ai/api/v1/reviews';
body = struct(...
'input', 'Customer asked: How do I return my order?',...
'output', 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',...
'context', 'VIP customer support inquiry',...
'model', 'gpt-4',...
'external_id', 'TICKET-1234',...
'category', 'customer_support',...
'review_focus', 'accuracy',...
'language', 'en-US',...
'confidence', 0.92,...
'webhook_url', 'https://myapp.com/webhooks/review-completed',...
'metadata', struct(...
'ticket_id', '1234',...
'customer_id', 'CUST-789'...
)...
);
options = weboptions(...
'MediaType', 'application/json',...
'HeaderFields', {'Authorization' 'Bearer YOUR_API_TOKEN'}...
);
response = webwrite(uri, body, options);
%% HTTP Interface
import matlab.net.*
import matlab.net.http.*
import matlab.net.http.io.*
header = [
HeaderField('Authorization', 'Bearer YOUR_API_TOKEN')
HeaderField('Content-Type', 'application/json')
]';
uri = URI('https://checkyour.ai/api/v1/reviews');
body = JSONProvider(struct(...
'input', 'Customer asked: How do I return my order?',...
'output', 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',...
'context', 'VIP customer support inquiry',...
'model', 'gpt-4',...
'external_id', 'TICKET-1234',...
'category', 'customer_support',...
'review_focus', 'accuracy',...
'language', 'en-US',...
'confidence', 0.92,...
'webhook_url', 'https://myapp.com/webhooks/review-completed',...
'metadata', struct(...
'ticket_id', '1234',...
'customer_id', 'CUST-789'...
)...
));
response = RequestMessage('post', header, body).send(uri.EncodedURI);
import axios from 'axios';
const response = await axios.post(
'https://checkyour.ai/api/v1/reviews',
{
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789'
}
},
{
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
}
);
import https from 'https';
const options = {
hostname: 'checkyour.ai',
path: '/api/v1/reviews',
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
};
const req = https.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789'
}
}));
req.end();
import got from 'got';
const response = await got.post('https://checkyour.ai/api/v1/reviews', {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN'
},
json: {
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789'
}
}
});
import ky from 'ky';
ky.post('https://checkyour.ai/api/v1/reviews', {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
json: {
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789'
}
}
});
var request = require('request');
var headers = {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
};
var dataString = '{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}';
var options = {
url: 'https://checkyour.ai/api/v1/reviews',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
import request from 'superagent';
request
.post('https://checkyour.ai/api/v1/reviews')
.set('Authorization', 'Bearer YOUR_API_TOKEN')
.send({
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789'
}
})
.then(res => {
console.log(res.body);
});
#import <Foundation/Foundation.h>
NSURL *url = [NSURL URLWithString:@"https://checkyour.ai/api/v1/reviews"];
NSDictionary *headers = @{
@"Authorization": @"Bearer YOUR_API_TOKEN",
@"Content-Type": @"application/json"
};
NSMutableData *data = [[NSMutableData alloc] initWithData:[@"{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}" dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:data];
NSURLSessionConfiguration *defaultSessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:defaultSessionConfiguration];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Lwt
open Cohttp
open Cohttp_lwt_unix
let uri = Uri.of_string "https://checkyour.ai/api/v1/reviews" in
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer YOUR_API_TOKEN"
|> fun h -> Header.add h "Content-Type" "application/json" in
let body = Cohttp_lwt.Body.of_string "{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}" in
Client.post ~headers ~body uri
>>= fun (resp, body) ->
(* Do stuff with the result *)
use LWP::UserAgent;
$ua = LWP::UserAgent->new();
$response = $ua->post(
'https://checkyour.ai/api/v1/reviews',
Authorization => 'Bearer YOUR_API_TOKEN',
'Content-Type' => 'application/json',
Content => '{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}'
);
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://checkyour.ai/api/v1/reviews');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_TOKEN',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}');
$response = curl_exec($ch);
curl_close($ch);
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post('https://checkyour.ai/api/v1/reviews', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Content-Type' => 'application/json'
],
'json' => [
'input' => 'Customer asked: How do I return my order?',
'output' => 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context' => 'VIP customer support inquiry',
'model' => 'gpt-4',
'external_id' => 'TICKET-1234',
'category' => 'customer_support',
'review_focus' => 'accuracy',
'language' => 'en-US',
'confidence' => 0.92,
'webhook_url' => 'https://myapp.com/webhooks/review-completed',
'metadata' => [
'ticket_id' => '1234',
'customer_id' => 'CUST-789'
]
]
]);
$headers = @{
"Authorization" = "Bearer YOUR_API_TOKEN"
}
$response = Invoke-RestMethod -Uri "https://checkyour.ai/api/v1/reviews" `
-Method Post `
-Headers $headers `
-ContentType "application/json" `
-Body "{`"input`":`"Customer asked: How do I return my order?`",`"output`":`"To return your order, visit our returns page at returns.example.com within 30 days of delivery.`",`"context`":`"VIP customer support inquiry`",`"model`":`"gpt-4`",`"external_id`":`"TICKET-1234`",`"category`":`"customer_support`",`"review_focus`":`"accuracy`",`"language`":`"en-US`",`"confidence`":0.92,`"webhook_url`":`"https://myapp.com/webhooks/review-completed`",`"metadata`":{`"ticket_id`":`"1234`",`"customer_id`":`"CUST-789`"}}"
import requests
headers = {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json',
}
json_data = {
'input': 'Customer asked: How do I return my order?',
'output': 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context': 'VIP customer support inquiry',
'model': 'gpt-4',
'external_id': 'TICKET-1234',
'category': 'customer_support',
'review_focus': 'accuracy',
'language': 'en-US',
'confidence': 0.92,
'webhook_url': 'https://myapp.com/webhooks/review-completed',
'metadata': {
'ticket_id': '1234',
'customer_id': 'CUST-789',
},
}
response = requests.post('https://checkyour.ai/api/v1/reviews', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}'
#response = requests.post('https://checkyour.ai/api/v1/reviews', headers=headers, data=data)
# Code example not found for r_httr
require 'net/http'
require 'json'
uri = URI('https://checkyour.ai/api/v1/reviews')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Bearer YOUR_API_TOKEN'
req.body = {
'input' => 'Customer asked: How do I return my order?',
'output' => 'To return your order, visit our returns page at returns.example.com within 30 days of delivery.',
'context' => 'VIP customer support inquiry',
'model' => 'gpt-4',
'external_id' => 'TICKET-1234',
'category' => 'customer_support',
'review_focus' => 'accuracy',
'language' => 'en-US',
'confidence' => 0.92,
'webhook_url' => 'https://myapp.com/webhooks/review-completed',
'metadata' => {
'ticket_id' => '1234',
'customer_id' => 'CUST-789'
}
}.to_json
req_options = {
use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(req)
end
extern crate reqwest;
use reqwest::header;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut headers = header::HeaderMap::new();
headers.insert("Authorization", "Bearer YOUR_API_TOKEN".parse().unwrap());
headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::blocking::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.build()
.unwrap();
let res = client.post("https://checkyour.ai/api/v1/reviews")
.headers(headers)
.body("{\"input\":\"Customer asked: How do I return my order?\",\"output\":\"To return your order, visit our returns page at returns.example.com within 30 days of delivery.\",\"context\":\"VIP customer support inquiry\",\"model\":\"gpt-4\",\"external_id\":\"TICKET-1234\",\"category\":\"customer_support\",\"review_focus\":\"accuracy\",\"language\":\"en-US\",\"confidence\":0.92,\"webhook_url\":\"https://myapp.com/webhooks/review-completed\",\"metadata\":{\"ticket_id\":\"1234\",\"customer_id\":\"CUST-789\"}}")
.send()?
.text()?;
println!("{}", res);
Ok(())
}
curl -X POST 'https://checkyour.ai/api/v1/reviews' -H 'Authorization: Bearer YOUR_API_TOKEN' -H 'Content-Type: application/json' -d '{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}'
https checkyour.ai/api/v1/reviews \
"Authorization:Bearer YOUR_API_TOKEN" \
Content-Type:application/json \
input="Customer asked: How do I return my order?" \
output="To return your order, visit our returns page at returns.example.com within 30 days of delivery." \
context="VIP customer support inquiry" \
model=gpt-4 \
external_id=TICKET-1234 \
category=customer_support \
review_focus=accuracy \
language=en-US \
confidence:=0.92 \
webhook_url=https://myapp.com/webhooks/review-completed \
"metadata[ticket_id]"=1234 \
"metadata[customer_id]"=CUST-789
wget --header="Authorization: Bearer YOUR_API_TOKEN" \
--header="Content-Type: application/json" \
--post-data='{"input":"Customer asked: How do I return my order?","output":"To return your order, visit our returns page at returns.example.com within 30 days of delivery.","context":"VIP customer support inquiry","model":"gpt-4","external_id":"TICKET-1234","category":"customer_support","review_focus":"accuracy","language":"en-US","confidence":0.92,"webhook_url":"https://myapp.com/webhooks/review-completed","metadata":{"ticket_id":"1234","customer_id":"CUST-789"}}' \
--output-document - \
https://checkyour.ai/api/v1/reviews
import Foundation
let jsonData = [
"input": "Customer asked: How do I return my order?",
"output": "To return your order, visit our returns page at returns.example.com within 30 days of delivery.",
"context": "VIP customer support inquiry",
"model": "gpt-4",
"external_id": "TICKET-1234",
"category": "customer_support",
"review_focus": "accuracy",
"language": "en-US",
"confidence": 0.92,
"webhook_url": "https://myapp.com/webhooks/review-completed",
"metadata": [
"ticket_id": "1234",
"customer_id": "CUST-789"
]
] as [String : Any]
let data = try! JSONSerialization.data(withJSONObject: jsonData, options: [])
let url = URL(string: "https://checkyour.ai/api/v1/reviews")!
let headers = [
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = data as Data
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
if let error = error {
print(error)
} else if let data = data {
let str = String(data: data, encoding: .utf8)
print(str ?? "")
}
}
task.resume()
Verify Webhook Signatures
Secure your webhook endpoints by verifying HMAC-SHA256 signatures. Here's the verification flow:
// 1. Extract signature and timestamp from webhook headers
signature = request.headers['X-CheckYourAI-Signature']
timestamp = request.headers['X-CheckYourAI-Timestamp']
// 2. Verify timestamp is recent (within 5 minutes)
current_time = current_unix_timestamp()
if (abs(current_time - timestamp) > 300) {
return error("Webhook timestamp too old")
}
// 3. Construct the signed payload
signed_payload = timestamp + "." + request.body
// 4. Compute HMAC-SHA256 signature
expected_signature = hmac_sha256(
key: YOUR_WEBHOOK_SECRET,
message: signed_payload
)
// 5. Compare signatures (use constant-time comparison!)
if (!constant_time_compare(signature, expected_signature)) {
return error("Invalid webhook signature")
}
// 6. Signature is valid - process webhook safely
process_webhook(request.body)
Implementation Notes:
- Timestamp validation: Prevents replay attacks by rejecting old webhooks
- Constant-time comparison: Prevents timing attacks when comparing signatures
- HMAC-SHA256: Use your language's crypto library (crypto in Node.js, hashlib in Python, etc.)
Always verify webhook signatures!
Without signature verification, attackers could send fake review results to your webhook endpoint.
Environment Variables
For API Requests
Store your API credentials securely using environment variables:
CHECKYOURAI_API_TOKEN="cya_your_token_here")
CHECKYOURAI_WEBHOOK_SECRET="cya_whs_your_secret_here"
Pro tip:
Use a .env file with a library like dotenv (Node.js/Python) or
dotenvy
(Elixir).
Error Handling Best Practices
Always Check Status Codes
Handle different HTTP status codes appropriately:
-
201- Success -
401- Check your API token -
422- Validation error, check request body -
429- Rate limited, use Retry-After header
Implement Retries for 429
When rate limited, respect the Retry-After header and implement exponential backoff for retries.
Log Errors for Debugging
Always log the full error response body for troubleshooting. It includes detailed validation errors.
Testing Your Integration
Use Test API Tokens
Create separate API tokens for development, staging, and production environments.
Test Webhooks Locally
Use tools like ngrok or localtunnel to expose your local webhook endpoint for testing.