Upload & Extract Text
curl --request POST \
--url https://api.dreep.cloud/api/v1/ocr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form folder=receipts/2024 \
--form folderId=3c90c3cc-0d44-4b50-8888-8dd25736052a \
--form autoCreateFolders=true \
--form includeBlocks=falseimport requests
url = "https://api.dreep.cloud/api/v1/ocr"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"folder": "receipts/2024",
"folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"autoCreateFolders": "true",
"includeBlocks": "false"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('folder', 'receipts/2024');
form.append('folderId', '3c90c3cc-0d44-4b50-8888-8dd25736052a');
form.append('autoCreateFolders', 'true');
form.append('includeBlocks', 'false');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.dreep.cloud/api/v1/ocr', 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.dreep.cloud/api/v1/ocr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\nreceipts/2024\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folderId\"\r\n\r\n3c90c3cc-0d44-4b50-8888-8dd25736052a\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"autoCreateFolders\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"includeBlocks\"\r\n\r\nfalse\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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.dreep.cloud/api/v1/ocr"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\nreceipts/2024\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folderId\"\r\n\r\n3c90c3cc-0d44-4b50-8888-8dd25736052a\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"autoCreateFolders\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"includeBlocks\"\r\n\r\nfalse\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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.dreep.cloud/api/v1/ocr")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\nreceipts/2024\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folderId\"\r\n\r\n3c90c3cc-0d44-4b50-8888-8dd25736052a\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"autoCreateFolders\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"includeBlocks\"\r\n\r\nfalse\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dreep.cloud/api/v1/ocr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\nreceipts/2024\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folderId\"\r\n\r\n3c90c3cc-0d44-4b50-8888-8dd25736052a\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"autoCreateFolders\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"includeBlocks\"\r\n\r\nfalse\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"blocks": [
{}
],
"savedAsset": {
"id": "<string>",
"storageKey": "<string>"
}
}{
"error": true,
"message": "Invalid request parameters",
"code": "invalid_request"
}OCR
Upload & Extract Text
Upload an image or PDF document and instantly extract its text using Optical Character Recognition (OCR). Accepts JPEG, PNG, TIFF and PDF. PDFs can have up to 5 pages on Free, 20 on Starter and 50 on Pro, and each image or PDF page must be under 10MB. Every page processed counts as one OCR page against your plan. If a destination folder is given (via folder or folderId), the extracted text is also saved to your Dreep storage as a .txt file in that folder. With no folder, the text is returned in the response only.
POST
/
api
/
v1
/
ocr
Upload & Extract Text
curl --request POST \
--url https://api.dreep.cloud/api/v1/ocr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form folder=receipts/2024 \
--form folderId=3c90c3cc-0d44-4b50-8888-8dd25736052a \
--form autoCreateFolders=true \
--form includeBlocks=falseimport requests
url = "https://api.dreep.cloud/api/v1/ocr"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"folder": "receipts/2024",
"folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"autoCreateFolders": "true",
"includeBlocks": "false"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('folder', 'receipts/2024');
form.append('folderId', '3c90c3cc-0d44-4b50-8888-8dd25736052a');
form.append('autoCreateFolders', 'true');
form.append('includeBlocks', 'false');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.dreep.cloud/api/v1/ocr', 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.dreep.cloud/api/v1/ocr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\nreceipts/2024\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folderId\"\r\n\r\n3c90c3cc-0d44-4b50-8888-8dd25736052a\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"autoCreateFolders\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"includeBlocks\"\r\n\r\nfalse\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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.dreep.cloud/api/v1/ocr"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\nreceipts/2024\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folderId\"\r\n\r\n3c90c3cc-0d44-4b50-8888-8dd25736052a\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"autoCreateFolders\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"includeBlocks\"\r\n\r\nfalse\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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.dreep.cloud/api/v1/ocr")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\nreceipts/2024\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folderId\"\r\n\r\n3c90c3cc-0d44-4b50-8888-8dd25736052a\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"autoCreateFolders\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"includeBlocks\"\r\n\r\nfalse\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dreep.cloud/api/v1/ocr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folder\"\r\n\r\nreceipts/2024\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"folderId\"\r\n\r\n3c90c3cc-0d44-4b50-8888-8dd25736052a\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"autoCreateFolders\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"includeBlocks\"\r\n\r\nfalse\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"blocks": [
{}
],
"savedAsset": {
"id": "<string>",
"storageKey": "<string>"
}
}{
"error": true,
"message": "Invalid request parameters",
"code": "invalid_request"
}Saving the extracted text
Name a destination folder and Dreep also stores the extracted text as a.txt
asset in it. Use folder (a path, created on demand) or folderId (a UUID):
curl -X POST "https://api.dreep.cloud/api/v1/ocr" \
-H "Authorization: Bearer drp_live_xxxxx" \
-F "[email protected]" \
-F "folder=receipts/2024"
savedAsset is
null. See Folders & Paths.
Response size
By default the response contains the extractedtext only:
curl -X POST "https://api.dreep.cloud/api/v1/ocr" \
-H "Authorization: Bearer sk_live_xxxxx" \
-F "[email protected]"
{
"text": "ACME STORE\nTotal $42.00",
"savedAsset": null
}
includeBlocks=true when you need the per-line and per-word geometry — for example to
draw bounding boxes over the source image:
curl -X POST "https://api.dreep.cloud/api/v1/ocr" \
-H "Authorization: Bearer sk_live_xxxxx" \
-F "[email protected]" \
-F "includeBlocks=true"
{
"text": "ACME STORE\nTotal $42.00",
"blocks": [
{
"BlockType": "LINE",
"Text": "ACME STORE",
"Geometry": { "BoundingBox": { "Width": 0.31, "Height": 0.04, "Left": 0.12, "Top": 0.08 } }
}
],
"savedAsset": null
}
The OCR engine emits one block per page, line, and word, each with its own geometry, so
blocks is
typically far larger than the text itself. Leave it off unless you use the coordinates.Authorizations
Body
multipart/form-data
Response
Extraction successful