cURL
curl --request POST \
--url https://api.cradl.ai/{basePath}/models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"fieldConfig": {},
"metadata": {},
"preprocessConfig": {
"trimMargins": true,
"useGhostScript": true,
"startPage": 123,
"pages": [
123
],
"usePoppler": true,
"padToFit": true,
"useTextDetection": true,
"maxPages": 50,
"deskewImage": true,
"autoRotate": true
},
"postprocessConfig": {
"strategy": "BEST_FIRST"
},
"name": "<string>",
"description": "<string>"
}
'import requests
url = "https://api.cradl.ai/{basePath}/models"
payload = {
"fieldConfig": {},
"metadata": {},
"preprocessConfig": {
"trimMargins": True,
"useGhostScript": True,
"startPage": 123,
"pages": [123],
"usePoppler": True,
"padToFit": True,
"useTextDetection": True,
"maxPages": 50,
"deskewImage": True,
"autoRotate": True
},
"postprocessConfig": { "strategy": "BEST_FIRST" },
"name": "<string>",
"description": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({
fieldConfig: {},
metadata: {},
preprocessConfig: {
trimMargins: true,
useGhostScript: true,
startPage: 123,
pages: [123],
usePoppler: true,
padToFit: true,
useTextDetection: true,
maxPages: 50,
deskewImage: true,
autoRotate: true
},
postprocessConfig: {strategy: 'BEST_FIRST'},
name: '<string>',
description: '<string>'
})
};
fetch('https://api.cradl.ai/{basePath}/models', 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.cradl.ai/{basePath}/models",
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([
'fieldConfig' => [
],
'metadata' => [
],
'preprocessConfig' => [
'trimMargins' => true,
'useGhostScript' => true,
'startPage' => 123,
'pages' => [
123
],
'usePoppler' => true,
'padToFit' => true,
'useTextDetection' => true,
'maxPages' => 50,
'deskewImage' => true,
'autoRotate' => true
],
'postprocessConfig' => [
'strategy' => 'BEST_FIRST'
],
'name' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);
$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.cradl.ai/{basePath}/models"
payload := strings.NewReader("{\n \"fieldConfig\": {},\n \"metadata\": {},\n \"preprocessConfig\": {\n \"trimMargins\": true,\n \"useGhostScript\": true,\n \"startPage\": 123,\n \"pages\": [\n 123\n ],\n \"usePoppler\": true,\n \"padToFit\": true,\n \"useTextDetection\": true,\n \"maxPages\": 50,\n \"deskewImage\": true,\n \"autoRotate\": true\n },\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Bearer <token>")
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.cradl.ai/{basePath}/models")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"fieldConfig\": {},\n \"metadata\": {},\n \"preprocessConfig\": {\n \"trimMargins\": true,\n \"useGhostScript\": true,\n \"startPage\": 123,\n \"pages\": [\n 123\n ],\n \"usePoppler\": true,\n \"padToFit\": true,\n \"useTextDetection\": true,\n \"maxPages\": 50,\n \"deskewImage\": true,\n \"autoRotate\": true\n },\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cradl.ai/{basePath}/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"fieldConfig\": {},\n \"metadata\": {},\n \"preprocessConfig\": {\n \"trimMargins\": true,\n \"useGhostScript\": true,\n \"startPage\": 123,\n \"pages\": [\n 123\n ],\n \"usePoppler\": true,\n \"padToFit\": true,\n \"useTextDetection\": true,\n \"maxPages\": 50,\n \"deskewImage\": true,\n \"autoRotate\": true\n },\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"updatedTime": "<string>",
"metadata": {},
"updatedBy": "<string>",
"trainingId": "<string>",
"modelId": "<string>",
"description": "<string>",
"fieldConfig": {},
"organizationId": "<string>",
"preprocessConfig": {
"trimMargins": true,
"useGhostScript": true,
"startPage": 123,
"pages": [
123
],
"usePoppler": true,
"padToFit": true,
"useTextDetection": true,
"maxPages": 50,
"deskewImage": true,
"autoRotate": true
},
"createdBy": "<string>",
"numberOfRunningTrainings": 1,
"name": "<string>",
"numberOfDataBundles": 1,
"createdTime": "<string>",
"postprocessConfig": {
"strategy": "BEST_FIRST"
},
"version": 1,
"updatedFieldConfigTime": "<string>",
"statistics": {}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}API Reference
Create Model
Create Model
POST
/
models
cURL
curl --request POST \
--url https://api.cradl.ai/{basePath}/models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"fieldConfig": {},
"metadata": {},
"preprocessConfig": {
"trimMargins": true,
"useGhostScript": true,
"startPage": 123,
"pages": [
123
],
"usePoppler": true,
"padToFit": true,
"useTextDetection": true,
"maxPages": 50,
"deskewImage": true,
"autoRotate": true
},
"postprocessConfig": {
"strategy": "BEST_FIRST"
},
"name": "<string>",
"description": "<string>"
}
'import requests
url = "https://api.cradl.ai/{basePath}/models"
payload = {
"fieldConfig": {},
"metadata": {},
"preprocessConfig": {
"trimMargins": True,
"useGhostScript": True,
"startPage": 123,
"pages": [123],
"usePoppler": True,
"padToFit": True,
"useTextDetection": True,
"maxPages": 50,
"deskewImage": True,
"autoRotate": True
},
"postprocessConfig": { "strategy": "BEST_FIRST" },
"name": "<string>",
"description": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({
fieldConfig: {},
metadata: {},
preprocessConfig: {
trimMargins: true,
useGhostScript: true,
startPage: 123,
pages: [123],
usePoppler: true,
padToFit: true,
useTextDetection: true,
maxPages: 50,
deskewImage: true,
autoRotate: true
},
postprocessConfig: {strategy: 'BEST_FIRST'},
name: '<string>',
description: '<string>'
})
};
fetch('https://api.cradl.ai/{basePath}/models', 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.cradl.ai/{basePath}/models",
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([
'fieldConfig' => [
],
'metadata' => [
],
'preprocessConfig' => [
'trimMargins' => true,
'useGhostScript' => true,
'startPage' => 123,
'pages' => [
123
],
'usePoppler' => true,
'padToFit' => true,
'useTextDetection' => true,
'maxPages' => 50,
'deskewImage' => true,
'autoRotate' => true
],
'postprocessConfig' => [
'strategy' => 'BEST_FIRST'
],
'name' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);
$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.cradl.ai/{basePath}/models"
payload := strings.NewReader("{\n \"fieldConfig\": {},\n \"metadata\": {},\n \"preprocessConfig\": {\n \"trimMargins\": true,\n \"useGhostScript\": true,\n \"startPage\": 123,\n \"pages\": [\n 123\n ],\n \"usePoppler\": true,\n \"padToFit\": true,\n \"useTextDetection\": true,\n \"maxPages\": 50,\n \"deskewImage\": true,\n \"autoRotate\": true\n },\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Bearer <token>")
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.cradl.ai/{basePath}/models")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"fieldConfig\": {},\n \"metadata\": {},\n \"preprocessConfig\": {\n \"trimMargins\": true,\n \"useGhostScript\": true,\n \"startPage\": 123,\n \"pages\": [\n 123\n ],\n \"usePoppler\": true,\n \"padToFit\": true,\n \"useTextDetection\": true,\n \"maxPages\": 50,\n \"deskewImage\": true,\n \"autoRotate\": true\n },\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cradl.ai/{basePath}/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"fieldConfig\": {},\n \"metadata\": {},\n \"preprocessConfig\": {\n \"trimMargins\": true,\n \"useGhostScript\": true,\n \"startPage\": 123,\n \"pages\": [\n 123\n ],\n \"usePoppler\": true,\n \"padToFit\": true,\n \"useTextDetection\": true,\n \"maxPages\": 50,\n \"deskewImage\": true,\n \"autoRotate\": true\n },\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"name\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"updatedTime": "<string>",
"metadata": {},
"updatedBy": "<string>",
"trainingId": "<string>",
"modelId": "<string>",
"description": "<string>",
"fieldConfig": {},
"organizationId": "<string>",
"preprocessConfig": {
"trimMargins": true,
"useGhostScript": true,
"startPage": 123,
"pages": [
123
],
"usePoppler": true,
"padToFit": true,
"useTextDetection": true,
"maxPages": 50,
"deskewImage": true,
"autoRotate": true
},
"createdBy": "<string>",
"numberOfRunningTrainings": 1,
"name": "<string>",
"numberOfDataBundles": 1,
"createdTime": "<string>",
"postprocessConfig": {
"strategy": "BEST_FIRST"
},
"version": 1,
"updatedFieldConfigTime": "<string>",
"statistics": {}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Headers
Body
application/json
Available options:
v1, v2 Available options:
sonnet-4.0, sonnet-4.5, qwen3-vl Show child attributes
Show child attributes
- Option 1
- Option 2
Show child attributes
Show child attributes
Maximum string length:
4096Maximum string length:
4096Response
200 response
Pattern:
^[0-9]{4}-?[0-9]{2}-?[0-9]{2}( |T)?[0-9]{2}:?[0-9]{2}:?[0-9]{2}(.[0-9]{1,6})?(Z|[+][0-9]{2}(:|)[0-9]{2})$Maximum string length:
4096Pattern:
^las:model-training:[a-z0-9-_]+$Pattern:
^(cradl|las):model:[a-z0-9-_]+$Maximum string length:
4096Pattern:
^(cradl|las):organization:[a-z0-9-_]+$Show child attributes
Show child attributes
Maximum string length:
4096Required range:
x >= 0Maximum string length:
4096Required range:
x >= 0Pattern:
^[0-9]{4}-?[0-9]{2}-?[0-9]{2}( |T)?[0-9]{2}:?[0-9]{2}:?[0-9]{2}(.[0-9]{1,6})?(Z|[+][0-9]{2}(:|)[0-9]{2})$Available options:
active, inactive Available options:
sonnet-4.0, sonnet-4.5, qwen3-vl - Option 1
- Option 2
Show child attributes
Show child attributes
Required range:
x >= 0Available options:
v1, v2 Pattern:
^[0-9]{4}-?[0-9]{2}-?[0-9]{2}( |T)?[0-9]{2}:?[0-9]{2}:?[0-9]{2}(.[0-9]{1,6})?(Z|[+][0-9]{2}(:|)[0-9]{2})$⌘I