curl --request POST \
--url https://api.textin.ai/ai/service/v3/entity_extraction \
--header 'Content-Type: application/json' \
--header 'x-ti-app-id: <api-key>' \
--header 'x-ti-secret-code: <api-key>' \
--data '
{
"file": {
"file_base64": "/9j/4AAQSk...",
"file_url": "https://example.com/document.pdf",
"file_name": "document.pdf"
},
"schema": {
"type": "object",
"properties": {
"product": {
"type": "string",
"description": "Product name"
}
},
"required": [
"product"
]
},
"parse_options": {
"page_start": 1,
"page_count": 10,
"get_image": "objects",
"crop_dewarp": 0,
"remove_watermark": 0,
"parse_mode": "scan",
"formula_level": 0,
"table_flavor": "html",
"pdf_pwd": "<string>"
},
"extract_options": {
"generate_citations": true,
"stamp": true
}
}
'import requests
url = "https://api.textin.ai/ai/service/v3/entity_extraction"
payload = {
"file": {
"file_base64": "/9j/4AAQSk...",
"file_url": "https://example.com/document.pdf",
"file_name": "document.pdf"
},
"schema": {
"type": "object",
"properties": { "product": {
"type": "string",
"description": "Product name"
} },
"required": ["product"]
},
"parse_options": {
"page_start": 1,
"page_count": 10,
"get_image": "objects",
"crop_dewarp": 0,
"remove_watermark": 0,
"parse_mode": "scan",
"formula_level": 0,
"table_flavor": "html",
"pdf_pwd": "<string>"
},
"extract_options": {
"generate_citations": True,
"stamp": True
}
}
headers = {
"x-ti-app-id": "<api-key>",
"x-ti-secret-code": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-ti-app-id': '<api-key>',
'x-ti-secret-code': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
file: {
file_base64: '/9j/4AAQSk...',
file_url: 'https://example.com/document.pdf',
file_name: 'document.pdf'
},
schema: {
type: 'object',
properties: {product: {type: 'string', description: 'Product name'}},
required: ['product']
},
parse_options: {
page_start: 1,
page_count: 10,
get_image: 'objects',
crop_dewarp: 0,
remove_watermark: 0,
parse_mode: 'scan',
formula_level: 0,
table_flavor: 'html',
pdf_pwd: '<string>'
},
extract_options: {generate_citations: true, stamp: true}
})
};
fetch('https://api.textin.ai/ai/service/v3/entity_extraction', 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.textin.ai/ai/service/v3/entity_extraction",
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([
'file' => [
'file_base64' => '/9j/4AAQSk...',
'file_url' => 'https://example.com/document.pdf',
'file_name' => 'document.pdf'
],
'schema' => [
'type' => 'object',
'properties' => [
'product' => [
'type' => 'string',
'description' => 'Product name'
]
],
'required' => [
'product'
]
],
'parse_options' => [
'page_start' => 1,
'page_count' => 10,
'get_image' => 'objects',
'crop_dewarp' => 0,
'remove_watermark' => 0,
'parse_mode' => 'scan',
'formula_level' => 0,
'table_flavor' => 'html',
'pdf_pwd' => '<string>'
],
'extract_options' => [
'generate_citations' => true,
'stamp' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-ti-app-id: <api-key>",
"x-ti-secret-code: <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.textin.ai/ai/service/v3/entity_extraction"
payload := strings.NewReader("{\n \"file\": {\n \"file_base64\": \"/9j/4AAQSk...\",\n \"file_url\": \"https://example.com/document.pdf\",\n \"file_name\": \"document.pdf\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"product\": {\n \"type\": \"string\",\n \"description\": \"Product name\"\n }\n },\n \"required\": [\n \"product\"\n ]\n },\n \"parse_options\": {\n \"page_start\": 1,\n \"page_count\": 10,\n \"get_image\": \"objects\",\n \"crop_dewarp\": 0,\n \"remove_watermark\": 0,\n \"parse_mode\": \"scan\",\n \"formula_level\": 0,\n \"table_flavor\": \"html\",\n \"pdf_pwd\": \"<string>\"\n },\n \"extract_options\": {\n \"generate_citations\": true,\n \"stamp\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<api-key>")
req.Header.Add("x-ti-secret-code", "<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.textin.ai/ai/service/v3/entity_extraction")
.header("x-ti-app-id", "<api-key>")
.header("x-ti-secret-code", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file\": {\n \"file_base64\": \"/9j/4AAQSk...\",\n \"file_url\": \"https://example.com/document.pdf\",\n \"file_name\": \"document.pdf\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"product\": {\n \"type\": \"string\",\n \"description\": \"Product name\"\n }\n },\n \"required\": [\n \"product\"\n ]\n },\n \"parse_options\": {\n \"page_start\": 1,\n \"page_count\": 10,\n \"get_image\": \"objects\",\n \"crop_dewarp\": 0,\n \"remove_watermark\": 0,\n \"parse_mode\": \"scan\",\n \"formula_level\": 0,\n \"table_flavor\": \"html\",\n \"pdf_pwd\": \"<string>\"\n },\n \"extract_options\": {\n \"generate_citations\": true,\n \"stamp\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.textin.ai/ai/service/v3/entity_extraction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<api-key>'
request["x-ti-secret-code"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file\": {\n \"file_base64\": \"/9j/4AAQSk...\",\n \"file_url\": \"https://example.com/document.pdf\",\n \"file_name\": \"document.pdf\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"product\": {\n \"type\": \"string\",\n \"description\": \"Product name\"\n }\n },\n \"required\": [\n \"product\"\n ]\n },\n \"parse_options\": {\n \"page_start\": 1,\n \"page_count\": 10,\n \"get_image\": \"objects\",\n \"crop_dewarp\": 0,\n \"remove_watermark\": 0,\n \"parse_mode\": \"scan\",\n \"formula_level\": 0,\n \"table_flavor\": \"html\",\n \"pdf_pwd\": \"<string>\"\n },\n \"extract_options\": {\n \"generate_citations\": true,\n \"stamp\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "Success",
"version": "v3.0.29_20250819",
"duration": 8267,
"x_request_id": "7596b8c9d2ddbc9924b66651e9efc174",
"status": "finished",
"result": {
"success_count": 1,
"extracted_schema": {
"product": "Kids' Looney Tunes UT (short-sleeve T-shirt), Women's SUPIMA COTTON crew-neck T-shirt (short-sleeve)"
},
"citations": {
"product": {
"value": "Kids' Looney Tunes UT (short-sleeve T-shirt), Women's SUPIMA COTTON crew-neck T-shirt (short-sleeve)",
"bounding_regions": [
{
"page_number": 1,
"position": [
137,
599,
1129,
599,
1129,
625,
182,
625
],
"text": "Kids' Looney Tunes UT (short-sleeve T-shirt), Women's SUPIMA COTTON crew-neck T-shirt (short-sleeve)"
}
]
}
},
"pages": [
{
"page_number": 1,
"status": "Success",
"durations": 930.178466796875,
"image_id": "62bfe3c3a8e9c9cf.jpg",
"height": 1824,
"width": 600,
"angle": 0
}
],
"stamps": [
{
"color": "红色",
"position": [
1223,
995,
1642,
1007,
1630,
1689,
1621,
1677
],
"stamp_shape": "圆章",
"type": "公章",
"value": "电力公司专用章"
}
]
},
"part_durations": {
"parse_duration": 1080,
"retrieve_duration": 0,
"prompt_duration": 1,
"llm_duration": 7114,
"format_duration": 51
}
}Document Extraction
curl --request POST \
--url https://api.textin.ai/ai/service/v3/entity_extraction \
--header 'Content-Type: application/json' \
--header 'x-ti-app-id: <api-key>' \
--header 'x-ti-secret-code: <api-key>' \
--data '
{
"file": {
"file_base64": "/9j/4AAQSk...",
"file_url": "https://example.com/document.pdf",
"file_name": "document.pdf"
},
"schema": {
"type": "object",
"properties": {
"product": {
"type": "string",
"description": "Product name"
}
},
"required": [
"product"
]
},
"parse_options": {
"page_start": 1,
"page_count": 10,
"get_image": "objects",
"crop_dewarp": 0,
"remove_watermark": 0,
"parse_mode": "scan",
"formula_level": 0,
"table_flavor": "html",
"pdf_pwd": "<string>"
},
"extract_options": {
"generate_citations": true,
"stamp": true
}
}
'import requests
url = "https://api.textin.ai/ai/service/v3/entity_extraction"
payload = {
"file": {
"file_base64": "/9j/4AAQSk...",
"file_url": "https://example.com/document.pdf",
"file_name": "document.pdf"
},
"schema": {
"type": "object",
"properties": { "product": {
"type": "string",
"description": "Product name"
} },
"required": ["product"]
},
"parse_options": {
"page_start": 1,
"page_count": 10,
"get_image": "objects",
"crop_dewarp": 0,
"remove_watermark": 0,
"parse_mode": "scan",
"formula_level": 0,
"table_flavor": "html",
"pdf_pwd": "<string>"
},
"extract_options": {
"generate_citations": True,
"stamp": True
}
}
headers = {
"x-ti-app-id": "<api-key>",
"x-ti-secret-code": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-ti-app-id': '<api-key>',
'x-ti-secret-code': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
file: {
file_base64: '/9j/4AAQSk...',
file_url: 'https://example.com/document.pdf',
file_name: 'document.pdf'
},
schema: {
type: 'object',
properties: {product: {type: 'string', description: 'Product name'}},
required: ['product']
},
parse_options: {
page_start: 1,
page_count: 10,
get_image: 'objects',
crop_dewarp: 0,
remove_watermark: 0,
parse_mode: 'scan',
formula_level: 0,
table_flavor: 'html',
pdf_pwd: '<string>'
},
extract_options: {generate_citations: true, stamp: true}
})
};
fetch('https://api.textin.ai/ai/service/v3/entity_extraction', 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.textin.ai/ai/service/v3/entity_extraction",
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([
'file' => [
'file_base64' => '/9j/4AAQSk...',
'file_url' => 'https://example.com/document.pdf',
'file_name' => 'document.pdf'
],
'schema' => [
'type' => 'object',
'properties' => [
'product' => [
'type' => 'string',
'description' => 'Product name'
]
],
'required' => [
'product'
]
],
'parse_options' => [
'page_start' => 1,
'page_count' => 10,
'get_image' => 'objects',
'crop_dewarp' => 0,
'remove_watermark' => 0,
'parse_mode' => 'scan',
'formula_level' => 0,
'table_flavor' => 'html',
'pdf_pwd' => '<string>'
],
'extract_options' => [
'generate_citations' => true,
'stamp' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-ti-app-id: <api-key>",
"x-ti-secret-code: <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.textin.ai/ai/service/v3/entity_extraction"
payload := strings.NewReader("{\n \"file\": {\n \"file_base64\": \"/9j/4AAQSk...\",\n \"file_url\": \"https://example.com/document.pdf\",\n \"file_name\": \"document.pdf\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"product\": {\n \"type\": \"string\",\n \"description\": \"Product name\"\n }\n },\n \"required\": [\n \"product\"\n ]\n },\n \"parse_options\": {\n \"page_start\": 1,\n \"page_count\": 10,\n \"get_image\": \"objects\",\n \"crop_dewarp\": 0,\n \"remove_watermark\": 0,\n \"parse_mode\": \"scan\",\n \"formula_level\": 0,\n \"table_flavor\": \"html\",\n \"pdf_pwd\": \"<string>\"\n },\n \"extract_options\": {\n \"generate_citations\": true,\n \"stamp\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<api-key>")
req.Header.Add("x-ti-secret-code", "<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.textin.ai/ai/service/v3/entity_extraction")
.header("x-ti-app-id", "<api-key>")
.header("x-ti-secret-code", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"file\": {\n \"file_base64\": \"/9j/4AAQSk...\",\n \"file_url\": \"https://example.com/document.pdf\",\n \"file_name\": \"document.pdf\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"product\": {\n \"type\": \"string\",\n \"description\": \"Product name\"\n }\n },\n \"required\": [\n \"product\"\n ]\n },\n \"parse_options\": {\n \"page_start\": 1,\n \"page_count\": 10,\n \"get_image\": \"objects\",\n \"crop_dewarp\": 0,\n \"remove_watermark\": 0,\n \"parse_mode\": \"scan\",\n \"formula_level\": 0,\n \"table_flavor\": \"html\",\n \"pdf_pwd\": \"<string>\"\n },\n \"extract_options\": {\n \"generate_citations\": true,\n \"stamp\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.textin.ai/ai/service/v3/entity_extraction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<api-key>'
request["x-ti-secret-code"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file\": {\n \"file_base64\": \"/9j/4AAQSk...\",\n \"file_url\": \"https://example.com/document.pdf\",\n \"file_name\": \"document.pdf\"\n },\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"product\": {\n \"type\": \"string\",\n \"description\": \"Product name\"\n }\n },\n \"required\": [\n \"product\"\n ]\n },\n \"parse_options\": {\n \"page_start\": 1,\n \"page_count\": 10,\n \"get_image\": \"objects\",\n \"crop_dewarp\": 0,\n \"remove_watermark\": 0,\n \"parse_mode\": \"scan\",\n \"formula_level\": 0,\n \"table_flavor\": \"html\",\n \"pdf_pwd\": \"<string>\"\n },\n \"extract_options\": {\n \"generate_citations\": true,\n \"stamp\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "Success",
"version": "v3.0.29_20250819",
"duration": 8267,
"x_request_id": "7596b8c9d2ddbc9924b66651e9efc174",
"status": "finished",
"result": {
"success_count": 1,
"extracted_schema": {
"product": "Kids' Looney Tunes UT (short-sleeve T-shirt), Women's SUPIMA COTTON crew-neck T-shirt (short-sleeve)"
},
"citations": {
"product": {
"value": "Kids' Looney Tunes UT (short-sleeve T-shirt), Women's SUPIMA COTTON crew-neck T-shirt (short-sleeve)",
"bounding_regions": [
{
"page_number": 1,
"position": [
137,
599,
1129,
599,
1129,
625,
182,
625
],
"text": "Kids' Looney Tunes UT (short-sleeve T-shirt), Women's SUPIMA COTTON crew-neck T-shirt (short-sleeve)"
}
]
}
},
"pages": [
{
"page_number": 1,
"status": "Success",
"durations": 930.178466796875,
"image_id": "62bfe3c3a8e9c9cf.jpg",
"height": 1824,
"width": 600,
"angle": 0
}
],
"stamps": [
{
"color": "红色",
"position": [
1223,
995,
1642,
1007,
1630,
1689,
1621,
1677
],
"stamp_shape": "圆章",
"type": "公章",
"value": "电力公司专用章"
}
]
},
"part_durations": {
"parse_duration": 1080,
"retrieve_duration": 0,
"prompt_duration": 1,
"llm_duration": 7114,
"format_duration": 51
}
}Authorizations
Please Sign in to TextIn and navigate to "Console - API Keys" to view x-ti-app-id
Please Sign in to TextIn and navigate to "Console - API Keys" to view x-ti-secret-code
Body
Supported file formats: png, jpg, jpeg, pdf, bmp, tiff, webp, doc, docx, html, mhtml, xls, xlsx, csv, ppt, pptx, txt, ofd.
Supports schema-based structured information extraction, where you define the field structure for precise extraction.
File information
Show child attributes
Show child attributes
Extraction data structure. See the Schema Guide.
{
"type": "object",
"properties": {
"product": {
"type": "string",
"description": "Product name"
}
},
"required": ["product"]
}
Parsing stage parameters
Show child attributes
Show child attributes
Advanced extraction controls
Show child attributes
Show child attributes
Response
Response result
Status code
- 200: Success
- 40101: x-ti-app-id or x-ti-secret-code is empty
- 40102: x-ti-app-id or x-ti-secret-code is invalid, authentication failed
- 40103: Client IP is not in the allowlist
- 40003: Insufficient balance, please recharge before using
- 40004: Parameter error, please check the technical documentation and verify the parameters
- 40007: Robot does not exist or is not published
- 40008: Robot is not activated, please activate it from the market before retrying
- 40302: Uploaded file size does not meet requirements, file size must not exceed 50M
- 40303: File type not supported. The API will return the actual detected file type, e.g., "Current file type is .gif"
- 40304: Image dimensions do not meet requirements. Images with aspect ratio less than 2 must have width and height between 20-20000 pixels, other images must have width and height between 20-10000 pixels
- 40305: Recognition file not uploaded
- 40306: QPS exceeds limit
- 40400: Invalid request URL, please check if the URL is correct
- 40422: The file is corrupted
- 40423: Password required or incorrect password
- 40424: Page number out of range
- 40425: The input file format is not supported
- 40428: Process office file failed or timeout
- 500: Internal server error
- 50011: LLM Connection Failed (timeout connecting to the large model)
- 50012: LLM Engine Failed (large model engine error)
- 50207: Partial failed
200, 40101, 40102, 40103, 40003, 40004, 40007, 40008, 40302, 40303, 40304, 40305, 40306, 40400, 40422, 40423, 40424, 40425, 40428, 500, 50011, 50012, 50207 200
Status message
"Success"
Version number
"v3.0.29_20250819"
Total processing time (milliseconds)
8267
Request ID
"7596b8c9d2ddbc9924b66651e9efc174"
Processing status
"finished"
Show child attributes
Show child attributes
Processing time per stage
Show child attributes
Show child attributes

