Python
import os, requests
# Set API key ENV variable or replace with your own API key
API_KEY = os.getenv("AIORNOT_API_KEY")
TEXT_ENDPOINT = "https://api.aiornot.com/v2/text/sync"
data = {
"text": "Your text content to analyze goes here..."
}
resp = requests.post(
TEXT_ENDPOINT,
headers={"Authorization": f"Bearer {API_KEY}"},
data=data,
params={
"include_annotations": True, # Optional: Include block-level annotations
"external_id": "my-tracking-id" # Optional: External tracking ID
}
)
resp.raise_for_status()
print(resp.json())curl --request POST \
--url 'https://api.aiornot.com/v2/text/sync?include_annotations=true&external_id=my-tracking-id' \
--header 'Authorization: Bearer $AIORNOT_API_KEY' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'text=Your text content to analyze goes here...'
const fetch = require('node-fetch');
const querystring = require('querystring');
const API_KEY = process.env.AIORNOT_API_KEY;
const TEXT_ENDPOINT = 'https://api.aiornot.com/v2/text/sync';
const data = querystring.stringify({
text: 'Your text content to analyze goes here...'
});
const params = new URLSearchParams({
include_annotations: 'true', // Optional: Include block-level annotations
external_id: 'my-tracking-id' // Optional: External tracking ID
});
fetch(`${TEXT_ENDPOINT}?${params}`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/x-www-form-urlencoded'
},
body: data
})
.then(response => {
if (!response.ok) {
throw new Error(`Failed to analyze text: ${response.status} ${response.statusText}`);
}
return response.json();
})
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$API_KEY = getenv('AIORNOT_API_KEY');
$TEXT_ENDPOINT = 'https://api.aiornot.com/v2/text/sync';
$curl = curl_init();
$data = [
'text' => 'Your text content to analyze goes here...'
];
$query_params = http_build_query([
'include_annotations' => 'true', // Optional: Include block-level annotations
'external_id' => 'my-tracking-id' // Optional: External tracking ID
]);
curl_setopt_array($curl, [
CURLOPT_URL => $TEXT_ENDPOINT . '?' . $query_params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $API_KEY",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} elseif ($httpCode !== 200) {
echo "Failed to analyze text: HTTP $httpCode - $response";
} else {
$data = json_decode($response, true);
print_r($data);
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
)
func main() {
APIKey := os.Getenv("AIORNOT_API_KEY")
textEndpoint := "https://api.aiornot.com/v2/text/sync"
data := url.Values{}
data.Set("text", "Your text content to analyze goes here...")
params := url.Values{}
params.Set("include_annotations", "true") // Optional: Include block-level annotations
params.Set("external_id", "my-tracking-id") // Optional: External tracking ID
fullURL := textEndpoint + "?" + params.Encode()
req, err := http.NewRequest("POST", fullURL, strings.NewReader(data.Encode()))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+APIKey)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
if resp.StatusCode != 200 {
fmt.Printf("Failed to analyze text: %d %s\n", resp.StatusCode, string(body))
return
}
fmt.Println(string(body))
}
import java.io.IOException;
import okhttp3.*;
public class TextAnalysis {
public static void main(String[] args) {
String apiKey = System.getenv("AIORNOT_API_KEY");
String textEndpoint = "https://api.aiornot.com/v2/text/sync";
OkHttpClient client = new OkHttpClient();
RequestBody formBody = new FormBody.Builder()
.add("text", "Your text content to analyze goes here...")
.build();
HttpUrl url = HttpUrl.parse(textEndpoint).newBuilder()
.addQueryParameter("include_annotations", "true") // Optional: Include block-level annotations
.addQueryParameter("external_id", "my-tracking-id") // Optional: External tracking ID
.build();
Request request = new Request.Builder()
.url(url)
.header("Authorization", "Bearer " + apiKey)
.post(formBody)
.build();
try {
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) {
System.err.println("Failed to analyze text: " + response.code() + " " + response.body().string());
} else {
System.out.println(response.body().string());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
require 'uri'
require 'net/http'
url = URI("https://api.aiornot.com/v2/text/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "text=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"report": {
"ai_text": {
"confidence": 0.95,
"is_detected": true,
"annotations": [
[
"This is the first block of text.",
0.9999
],
[
"This is the second block of text.",
0.0012
]
]
}
},
"metadata": {
"word_count": 150,
"character_count": 750,
"token_count": 200,
"md5": "ebe5836f4d7dddc3f9a957eff565be21"
},
"created_at": "2023-11-07T05:31:56Z",
"external_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Reports by Modality
Text
Analyze text to determine if it was generated by AI.
This endpoint analyzes text content and returns confidence scores for AI detection.
Text Processing Limits:
- Minimum Text Length: 250 characters
- Maximum Text Length: 500,000 characters (500KB)
- Minimum Words: Approximately 64 words
POST
/
v2
/
text
/
sync
Python
import os, requests
# Set API key ENV variable or replace with your own API key
API_KEY = os.getenv("AIORNOT_API_KEY")
TEXT_ENDPOINT = "https://api.aiornot.com/v2/text/sync"
data = {
"text": "Your text content to analyze goes here..."
}
resp = requests.post(
TEXT_ENDPOINT,
headers={"Authorization": f"Bearer {API_KEY}"},
data=data,
params={
"include_annotations": True, # Optional: Include block-level annotations
"external_id": "my-tracking-id" # Optional: External tracking ID
}
)
resp.raise_for_status()
print(resp.json())curl --request POST \
--url 'https://api.aiornot.com/v2/text/sync?include_annotations=true&external_id=my-tracking-id' \
--header 'Authorization: Bearer $AIORNOT_API_KEY' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'text=Your text content to analyze goes here...'
const fetch = require('node-fetch');
const querystring = require('querystring');
const API_KEY = process.env.AIORNOT_API_KEY;
const TEXT_ENDPOINT = 'https://api.aiornot.com/v2/text/sync';
const data = querystring.stringify({
text: 'Your text content to analyze goes here...'
});
const params = new URLSearchParams({
include_annotations: 'true', // Optional: Include block-level annotations
external_id: 'my-tracking-id' // Optional: External tracking ID
});
fetch(`${TEXT_ENDPOINT}?${params}`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/x-www-form-urlencoded'
},
body: data
})
.then(response => {
if (!response.ok) {
throw new Error(`Failed to analyze text: ${response.status} ${response.statusText}`);
}
return response.json();
})
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$API_KEY = getenv('AIORNOT_API_KEY');
$TEXT_ENDPOINT = 'https://api.aiornot.com/v2/text/sync';
$curl = curl_init();
$data = [
'text' => 'Your text content to analyze goes here...'
];
$query_params = http_build_query([
'include_annotations' => 'true', // Optional: Include block-level annotations
'external_id' => 'my-tracking-id' // Optional: External tracking ID
]);
curl_setopt_array($curl, [
CURLOPT_URL => $TEXT_ENDPOINT . '?' . $query_params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $API_KEY",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} elseif ($httpCode !== 200) {
echo "Failed to analyze text: HTTP $httpCode - $response";
} else {
$data = json_decode($response, true);
print_r($data);
}
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
)
func main() {
APIKey := os.Getenv("AIORNOT_API_KEY")
textEndpoint := "https://api.aiornot.com/v2/text/sync"
data := url.Values{}
data.Set("text", "Your text content to analyze goes here...")
params := url.Values{}
params.Set("include_annotations", "true") // Optional: Include block-level annotations
params.Set("external_id", "my-tracking-id") // Optional: External tracking ID
fullURL := textEndpoint + "?" + params.Encode()
req, err := http.NewRequest("POST", fullURL, strings.NewReader(data.Encode()))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+APIKey)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
if resp.StatusCode != 200 {
fmt.Printf("Failed to analyze text: %d %s\n", resp.StatusCode, string(body))
return
}
fmt.Println(string(body))
}
import java.io.IOException;
import okhttp3.*;
public class TextAnalysis {
public static void main(String[] args) {
String apiKey = System.getenv("AIORNOT_API_KEY");
String textEndpoint = "https://api.aiornot.com/v2/text/sync";
OkHttpClient client = new OkHttpClient();
RequestBody formBody = new FormBody.Builder()
.add("text", "Your text content to analyze goes here...")
.build();
HttpUrl url = HttpUrl.parse(textEndpoint).newBuilder()
.addQueryParameter("include_annotations", "true") // Optional: Include block-level annotations
.addQueryParameter("external_id", "my-tracking-id") // Optional: External tracking ID
.build();
Request request = new Request.Builder()
.url(url)
.header("Authorization", "Bearer " + apiKey)
.post(formBody)
.build();
try {
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) {
System.err.println("Failed to analyze text: " + response.code() + " " + response.body().string());
} else {
System.out.println(response.body().string());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
require 'uri'
require 'net/http'
url = URI("https://api.aiornot.com/v2/text/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "text=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"report": {
"ai_text": {
"confidence": 0.95,
"is_detected": true,
"annotations": [
[
"This is the first block of text.",
0.9999
],
[
"This is the second block of text.",
0.0012
]
]
}
},
"metadata": {
"word_count": 150,
"character_count": 750,
"token_count": 200,
"md5": "ebe5836f4d7dddc3f9a957eff565be21"
},
"created_at": "2023-11-07T05:31:56Z",
"external_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Query Parameters
An optional external identifier for tracking this text analysis
Include block-level AI detection annotations in the response
Body
application/x-www-form-urlencoded
The text content to analyze for AI generation (minimum 250 characters, maximum 500,000 characters)
Required string length:
250 - 500000Response
Successful Response
Unique identifier associated with the request
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Date and time of request processing
The external identifier provided in the request, if any
⌘I