DocxDetect API Documentation

Overview

DocxDetect API allows users to detect AI-generated content and similarity in documents via API. The API uses API Key for authentication, no JWT Token required.

Base URL: https://api.docxturnitin.com

Authentication

All API requests require an API Key in the HTTP Header:

X-API-Key: your_api_key_here

Getting Your API Key

Please contact [email protected]

API Endpoints

1. Upload Document

Upload the document to be detected.

Request:

POST /docxdetect/uploadDucument

Header

ParameterTypeRequiredDescription
X-API-KeystringYesUser's API Key

Body (multipart/form-data)

ParameterTypeRequiredDescription
uploadFilefileYesDocument file to detect

File Limitations

  • File size: 300 bytes ~ 30 MB
  • Supported formats: PDF, DOC, DOCX, etc.

Response

Success Response:

{
  "code": 0,
  "data": {
    "sessionId": "docx-12345-2024-01-08"
  },
  "msg": "success"
}
            

Error Response:

{
  "code": -1,
  "msg": "The file you submit cannot be larger than 30MB."
}
            

Error Codes

codeDescription
0Success
-1Request error (file too large/small/missing, upload failed, etc.)
-2Insufficient credits, subscription required

2. Start Detection

Start the detection process for the uploaded document. Starting detection deducts 5 detection credits (3 for AI detection + 2 for similarity detection).

Request:

POST /docxdetect/checkDucument

Header

ParameterTypeRequiredDescription
X-API-KeystringYesUser's API Key

Body (application/json)

{
  "sessionid": "docx-12345-2024-01-08"
}
            
ParameterTypeRequiredDescription
sessionidstringYessessionId returned when uploading document

Response

Success Response:

{
  "code": 0,
  "msg": "success"
}
            

Error Response:

{
  "code": -1,
  "msg": "This document is already being checked"
}
            

Error Codes

codeDescription
0Success
-1Document not found / already being checked / already checked / failed to start detection
-2Insufficient credits, subscription required

3. Get Detection Result

Get document detection results by sessionId. This endpoint supports long polling, waiting up to 1 hour until detection completes or fails.

Request:

GET /docxdetect/getResult?sessionid={sessionid}

Header

ParameterTypeRequiredDescription
X-API-KeystringYesUser's API Key

Query Parameters

ParameterTypeRequiredDescription
sessionidstringYessessionId returned when uploading document

Response

Success Response (Detection Complete):

{
  "code": 0,
  "data": {
    "cstatus": 2,
    "aifile": "https://docxturnitin.com/td-document/1776469920579239031_ai.pdf",
    "rifile": "https://docxturnitin.com/td-document/1776469920743481204_ri.pdf",
    "checkerr": "",
    "filename": "MCV4U_Unit_2_Assignment_Linear_Dependence_and_Coplanarity.pdf"
  },
  "msg": "success"
}
            

In Progress Response (Timeout):

{
  "code": 0,
  "data": {
    "cstatus": 1,
    "aifile": "",
    "rifile": "",
    "checkerr": "",
    "filename": "MCV4U_Unit_2_Assignment_Linear_Dependence_and_Coplanarity.pdf"
  },
  "msg": "success"
}
            

Detection Failed Response:

{
  "code": 0,
  "data": {
    "cstatus": 9,
    "aifile": "",
    "rifile": "",
    "checkerr": "check timeout",
    "filename": "MCV4U_Unit_2_Assignment_Linear_Dependence_and_Coplanarity.pdf"
  },
  "msg": "success"
}
            

cstatus Status Description

ValueDescription
1Detecting
2Detection Successful
9Detection Failed

Field Description

FieldTypeDescription
cstatusintDetection status: 1-detecting 2-success 9-failed
aifilestringFull URL of AI detection report, returned when detection is successful
rifilestringFull URL of similarity detection report, returned when detection is successful
checkerrstringError message, contains error description when detection fails
filenamestringOriginal filename

Error Codes

codeDescription
0Success
-1Document not found / sessionid missing

Complete Workflow

1. Upload Document
   POST /docxdetect/uploadDucument
   → Get sessionId

2. Start Detection
   POST /docxdetect/checkDucument
   Body: {"sessionid": "xxx"}

3. Get Result (Long polling, max 1 hour)
   GET /docxdetect/getResult?sessionid=xxx
   → Wait for cstatus to become 2 (success) or 9 (failed)
            

Code Examples

cURL

# 1. Upload Document
curl -X POST https://docxturnitin.com/docxdetect/uploadDucument \
  -H "X-API-Key: your_api_key_here" \
  -F "uploadFile=@/path/to/document.pdf"

# 2. Start Detection
curl -X POST https://docxturnitin.com/docxdetect/checkDucument \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"sessionid": "docx-12345-2024-01-08"}'

# 3. Get Result
curl -X GET "https://docxturnitin.com/docxdetect/getResult?sessionid=docx-12345-2024-01-08" \
  -H "X-API-Key: your_api_key_here"
            

Python

import requests
import time

API_KEY = "your_api_key_here"
BASE_URL = "https://docxturnitin.com"
HEADERS = {"X-API-Key": API_KEY}

# 1. Upload Document
with open("document.pdf", "rb") as f:
    resp = requests.post(
        f"{BASE_URL}/docxdetect/uploadDucument",
        headers=HEADERS,
        files={"uploadFile": f}
    )
data = resp.json()
if data["code"] != 0:
    print(f"Upload failed: {data['msg']}")
    exit(1)

session_id = data["data"]["sessionId"]
print(f"Upload success, sessionId: {session_id}")

# 2. Start Detection
resp = requests.post(
    f"{BASE_URL}/docxdetect/checkDucument",
    headers={**HEADERS, "Content-Type": "application/json"},
    json={"sessionid": session_id}
)
data = resp.json()
if data["code"] != 0:
    print(f"Check failed: {data['msg']}")
    exit(1)
print("Check started")

# 3. Get Result (Long polling)
resp = requests.get(
    f"{BASE_URL}/docxdetect/getResult",
    headers=HEADERS,
    params={"sessionid": session_id},
    timeout=3600
)
result = resp.json()
print(f"Status: {result['data']['cstatus']}")
print(f"AI Report: {result['data']['aifile']}")
print(f"Similarity Report: {result['data']['rifile']}")
            

Differences from Web TuiCheck API

FeatureWeb TuiCheckAPI DocxDetect
AuthenticationJWT Token (x-token header)API Key (X-API-Key header)
Subscription Credit CheckYesYes
24h Upload Limit10/30 timesNo
MD5 Duplicate CheckYesNo
Credit DeductionYesYes (5 credits per detection)
Get Result MethodPolling getDucumentInfoLong polling getResult (max 1 hour)
Return File URLRelative pathFull URL (https://docxturnitin.com/...)
Route Prefix/tuicheck/docxdetect