cURL
curl --request POST \
--url https://api.cradl.ai/{basePath}/predictions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"modelId": "<string>",
"documentId": "<string>",
"metadata": {},
"trainingId": "<string>",
"postprocessConfig": {
"strategy": "BEST_FIRST"
},
"description": "<string>",
"agentRunId": "<string>",
"async": true,
"preprocessConfig": {
"trimMargins": true,
"useGhostScript": true,
"startPage": 123,
"pages": [
123
],
"usePoppler": true,
"padToFit": true,
"useTextDetection": true,
"maxPages": 50,
"deskewImage": true,
"autoRotate": true
},
"maxPages": 50,
"name": "<string>",
"autoRotate": true
}
'import requests
url = "https://api.cradl.ai/{basePath}/predictions"
payload = {
"modelId": "<string>",
"documentId": "<string>",
"metadata": {},
"trainingId": "<string>",
"postprocessConfig": { "strategy": "BEST_FIRST" },
"description": "<string>",
"agentRunId": "<string>",
"async": True,
"preprocessConfig": {
"trimMargins": True,
"useGhostScript": True,
"startPage": 123,
"pages": [123],
"usePoppler": True,
"padToFit": True,
"useTextDetection": True,
"maxPages": 50,
"deskewImage": True,
"autoRotate": True
},
"maxPages": 50,
"name": "<string>",
"autoRotate": True
}
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({
modelId: '<string>',
documentId: '<string>',
metadata: {},
trainingId: '<string>',
postprocessConfig: {strategy: 'BEST_FIRST'},
description: '<string>',
agentRunId: '<string>',
async: true,
preprocessConfig: {
trimMargins: true,
useGhostScript: true,
startPage: 123,
pages: [123],
usePoppler: true,
padToFit: true,
useTextDetection: true,
maxPages: 50,
deskewImage: true,
autoRotate: true
},
maxPages: 50,
name: '<string>',
autoRotate: true
})
};
fetch('https://api.cradl.ai/{basePath}/predictions', 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}/predictions",
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([
'modelId' => '<string>',
'documentId' => '<string>',
'metadata' => [
],
'trainingId' => '<string>',
'postprocessConfig' => [
'strategy' => 'BEST_FIRST'
],
'description' => '<string>',
'agentRunId' => '<string>',
'async' => true,
'preprocessConfig' => [
'trimMargins' => true,
'useGhostScript' => true,
'startPage' => 123,
'pages' => [
123
],
'usePoppler' => true,
'padToFit' => true,
'useTextDetection' => true,
'maxPages' => 50,
'deskewImage' => true,
'autoRotate' => true
],
'maxPages' => 50,
'name' => '<string>',
'autoRotate' => true
]),
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}/predictions"
payload := strings.NewReader("{\n \"modelId\": \"<string>\",\n \"documentId\": \"<string>\",\n \"metadata\": {},\n \"trainingId\": \"<string>\",\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"description\": \"<string>\",\n \"agentRunId\": \"<string>\",\n \"async\": true,\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 \"maxPages\": 50,\n \"name\": \"<string>\",\n \"autoRotate\": true\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}/predictions")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"modelId\": \"<string>\",\n \"documentId\": \"<string>\",\n \"metadata\": {},\n \"trainingId\": \"<string>\",\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"description\": \"<string>\",\n \"agentRunId\": \"<string>\",\n \"async\": true,\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 \"maxPages\": 50,\n \"name\": \"<string>\",\n \"autoRotate\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cradl.ai/{basePath}/predictions")
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 \"modelId\": \"<string>\",\n \"documentId\": \"<string>\",\n \"metadata\": {},\n \"trainingId\": \"<string>\",\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"description\": \"<string>\",\n \"agentRunId\": \"<string>\",\n \"async\": true,\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 \"maxPages\": 50,\n \"name\": \"<string>\",\n \"autoRotate\": true\n}"
response = http.request(request)
puts response.read_body{
"updatedTime": "<string>",
"metadata": {},
"updatedBy": "<string>",
"modelId": "<string>",
"description": "<string>",
"predictions": [
{
"confidence": 0.5,
"label": "<string>",
"value": "<string>",
"validators": "<array>",
"warnings": [
"<string>"
],
"rotation": 123,
"formatters": "<array>",
"rawValue": "<string>",
"attentionMap": [
[
123
]
],
"location": [
0.5
],
"page": 123,
"errors": [
"<string>"
]
}
],
"createdBy": "<string>",
"name": "<string>",
"createdTime": "<string>",
"documentId": "<string>",
"predictionId": "<string>",
"trainingId": "<string>",
"nextPage": 123,
"postprocessConfig": {
"strategy": "BEST_FIRST"
},
"warnings": [
"<string>"
],
"inferenceTime": 1,
"error": "<string>",
"agentRunId": "<string>",
"preprocessConfig": {
"trimMargins": true,
"useGhostScript": true,
"startPage": 123,
"pages": [
123
],
"usePoppler": true,
"padToFit": true,
"useTextDetection": true,
"maxPages": 50,
"deskewImage": true,
"autoRotate": true
},
"fileUrl": "<string>",
"errors": [
"<string>"
]
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}API Reference
Create Prediction
Create Prediction
POST
/
predictions
cURL
curl --request POST \
--url https://api.cradl.ai/{basePath}/predictions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"modelId": "<string>",
"documentId": "<string>",
"metadata": {},
"trainingId": "<string>",
"postprocessConfig": {
"strategy": "BEST_FIRST"
},
"description": "<string>",
"agentRunId": "<string>",
"async": true,
"preprocessConfig": {
"trimMargins": true,
"useGhostScript": true,
"startPage": 123,
"pages": [
123
],
"usePoppler": true,
"padToFit": true,
"useTextDetection": true,
"maxPages": 50,
"deskewImage": true,
"autoRotate": true
},
"maxPages": 50,
"name": "<string>",
"autoRotate": true
}
'import requests
url = "https://api.cradl.ai/{basePath}/predictions"
payload = {
"modelId": "<string>",
"documentId": "<string>",
"metadata": {},
"trainingId": "<string>",
"postprocessConfig": { "strategy": "BEST_FIRST" },
"description": "<string>",
"agentRunId": "<string>",
"async": True,
"preprocessConfig": {
"trimMargins": True,
"useGhostScript": True,
"startPage": 123,
"pages": [123],
"usePoppler": True,
"padToFit": True,
"useTextDetection": True,
"maxPages": 50,
"deskewImage": True,
"autoRotate": True
},
"maxPages": 50,
"name": "<string>",
"autoRotate": True
}
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({
modelId: '<string>',
documentId: '<string>',
metadata: {},
trainingId: '<string>',
postprocessConfig: {strategy: 'BEST_FIRST'},
description: '<string>',
agentRunId: '<string>',
async: true,
preprocessConfig: {
trimMargins: true,
useGhostScript: true,
startPage: 123,
pages: [123],
usePoppler: true,
padToFit: true,
useTextDetection: true,
maxPages: 50,
deskewImage: true,
autoRotate: true
},
maxPages: 50,
name: '<string>',
autoRotate: true
})
};
fetch('https://api.cradl.ai/{basePath}/predictions', 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}/predictions",
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([
'modelId' => '<string>',
'documentId' => '<string>',
'metadata' => [
],
'trainingId' => '<string>',
'postprocessConfig' => [
'strategy' => 'BEST_FIRST'
],
'description' => '<string>',
'agentRunId' => '<string>',
'async' => true,
'preprocessConfig' => [
'trimMargins' => true,
'useGhostScript' => true,
'startPage' => 123,
'pages' => [
123
],
'usePoppler' => true,
'padToFit' => true,
'useTextDetection' => true,
'maxPages' => 50,
'deskewImage' => true,
'autoRotate' => true
],
'maxPages' => 50,
'name' => '<string>',
'autoRotate' => true
]),
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}/predictions"
payload := strings.NewReader("{\n \"modelId\": \"<string>\",\n \"documentId\": \"<string>\",\n \"metadata\": {},\n \"trainingId\": \"<string>\",\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"description\": \"<string>\",\n \"agentRunId\": \"<string>\",\n \"async\": true,\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 \"maxPages\": 50,\n \"name\": \"<string>\",\n \"autoRotate\": true\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}/predictions")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"modelId\": \"<string>\",\n \"documentId\": \"<string>\",\n \"metadata\": {},\n \"trainingId\": \"<string>\",\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"description\": \"<string>\",\n \"agentRunId\": \"<string>\",\n \"async\": true,\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 \"maxPages\": 50,\n \"name\": \"<string>\",\n \"autoRotate\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cradl.ai/{basePath}/predictions")
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 \"modelId\": \"<string>\",\n \"documentId\": \"<string>\",\n \"metadata\": {},\n \"trainingId\": \"<string>\",\n \"postprocessConfig\": {\n \"strategy\": \"BEST_FIRST\"\n },\n \"description\": \"<string>\",\n \"agentRunId\": \"<string>\",\n \"async\": true,\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 \"maxPages\": 50,\n \"name\": \"<string>\",\n \"autoRotate\": true\n}"
response = http.request(request)
puts response.read_body{
"updatedTime": "<string>",
"metadata": {},
"updatedBy": "<string>",
"modelId": "<string>",
"description": "<string>",
"predictions": [
{
"confidence": 0.5,
"label": "<string>",
"value": "<string>",
"validators": "<array>",
"warnings": [
"<string>"
],
"rotation": 123,
"formatters": "<array>",
"rawValue": "<string>",
"attentionMap": [
[
123
]
],
"location": [
0.5
],
"page": 123,
"errors": [
"<string>"
]
}
],
"createdBy": "<string>",
"name": "<string>",
"createdTime": "<string>",
"documentId": "<string>",
"predictionId": "<string>",
"trainingId": "<string>",
"nextPage": 123,
"postprocessConfig": {
"strategy": "BEST_FIRST"
},
"warnings": [
"<string>"
],
"inferenceTime": 1,
"error": "<string>",
"agentRunId": "<string>",
"preprocessConfig": {
"trimMargins": true,
"useGhostScript": true,
"startPage": 123,
"pages": [
123
],
"usePoppler": true,
"padToFit": true,
"useTextDetection": true,
"maxPages": 50,
"deskewImage": true,
"autoRotate": true
},
"fileUrl": "<string>",
"errors": [
"<string>"
]
}{
"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
Pattern:
^(|(cradl|las):organization:[a-z0-9-_]+/)(cradl|las):model:[a-z0-9-_]+$Pattern:
^(cradl|las):document:[a-f0-9]{32}$Pattern:
^las:model-training:[a-z0-9-_]+$- Option 1
- Option 2
Show child attributes
Show child attributes
Available options:
0, 90, 180, 270 Maximum string length:
4096Pattern:
^((cradl|las):organization:[a-z0-9-_]+/)?cradl:agent:[a-z0-9-_]+/cradl:run:[a-z0-9-_]+$Show child attributes
Show child attributes
Required range:
1 <= x <= 100Maximum string length:
4096Available options:
LOW, HIGH Response
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:
^(|(cradl|las):organization:[a-z0-9-_]+/)(cradl|las):model:[a-z0-9-_]+$Maximum string length:
4096- Option 1
- Option 2
Show child attributes
Show child attributes
Maximum string length:
4096Maximum string length:
4096Pattern:
^[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})$Pattern:
^(cradl|las):document:[a-f0-9]{32}$Pattern:
^(cradl|las):prediction:[a-f0-9]{32}$Pattern:
^las:model-training:[a-z0-9-_]+$- Option 1
- Option 2
Show child attributes
Show child attributes
Required range:
x >= 0Maximum string length:
4096Pattern:
^((cradl|las):organization:[a-z0-9-_]+/)?cradl:agent:[a-z0-9-_]+/cradl:run:[a-z0-9-_]+$Show child attributes
Show child attributes
Pattern:
^http://localhost.*|^https://.*Available options:
pending, succeeded, failed ⌘I