Extract Formatted Text
curl --request POST \
--url https://api.img-processing.com/v1/images/{image_id}/extract-formatted-text \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"format": "markdown"
}
'import requests
url = "https://api.img-processing.com/v1/images/{image_id}/extract-formatted-text"
payload = { "format": "markdown" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({format: 'markdown'})
};
fetch('https://api.img-processing.com/v1/images/{image_id}/extract-formatted-text', 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.img-processing.com/v1/images/{image_id}/extract-formatted-text",
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([
'format' => 'markdown'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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.img-processing.com/v1/images/{image_id}/extract-formatted-text"
payload := strings.NewReader("{\n \"format\": \"markdown\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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.img-processing.com/v1/images/{image_id}/extract-formatted-text")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"format\": \"markdown\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.img-processing.com/v1/images/{image_id}/extract-formatted-text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"format\": \"markdown\"\n}"
response = http.request(request)
puts response.read_body{
"format": "markdown",
"content": "# Example Title\n\nThis is an example of **formatted text** extracted from an image. It can include *italic*, **bold**, and other markdown features."
}{
"type": "https://docs.img-processing.com/errors/unauthorized",
"error": "Unauthorized",
"status": 401,
"message": "API key is required."
}{
"type": "https://docs.img-processing.com/errors/forbidden",
"error": "Forbidden",
"status": 403,
"message": "You are not allowed to access this image."
}{
"type": "https://docs.img-processing.com/errors/validation-error",
"error": "Validation Error",
"status": 422,
"errors": [
"{field or param} {error message}"
]
}{
"type": "https://docs.img-processing.com/errors/too-many-requests",
"error": "Too Many Requests",
"status": 429,
"message": "Rate limit exceeded. Try again later."
}{
"type": "https://docs.img-processing.com/errors/internal-error",
"error": "Internal Error",
"status": 500,
"message": "An unexpected error occurred. Please try again later. If the problem persists, contact support."
}Analysis Endpoints
Extract Formatted Text
Extract the text from an image in desired format.
POST
/
v1
/
images
/
{image_id}
/
extract-formatted-text
Extract Formatted Text
curl --request POST \
--url https://api.img-processing.com/v1/images/{image_id}/extract-formatted-text \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"format": "markdown"
}
'import requests
url = "https://api.img-processing.com/v1/images/{image_id}/extract-formatted-text"
payload = { "format": "markdown" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({format: 'markdown'})
};
fetch('https://api.img-processing.com/v1/images/{image_id}/extract-formatted-text', 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.img-processing.com/v1/images/{image_id}/extract-formatted-text",
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([
'format' => 'markdown'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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.img-processing.com/v1/images/{image_id}/extract-formatted-text"
payload := strings.NewReader("{\n \"format\": \"markdown\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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.img-processing.com/v1/images/{image_id}/extract-formatted-text")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"format\": \"markdown\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.img-processing.com/v1/images/{image_id}/extract-formatted-text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"format\": \"markdown\"\n}"
response = http.request(request)
puts response.read_body{
"format": "markdown",
"content": "# Example Title\n\nThis is an example of **formatted text** extracted from an image. It can include *italic*, **bold**, and other markdown features."
}{
"type": "https://docs.img-processing.com/errors/unauthorized",
"error": "Unauthorized",
"status": 401,
"message": "API key is required."
}{
"type": "https://docs.img-processing.com/errors/forbidden",
"error": "Forbidden",
"status": 403,
"message": "You are not allowed to access this image."
}{
"type": "https://docs.img-processing.com/errors/validation-error",
"error": "Validation Error",
"status": 422,
"errors": [
"{field or param} {error message}"
]
}{
"type": "https://docs.img-processing.com/errors/too-many-requests",
"error": "Too Many Requests",
"status": 429,
"message": "Rate limit exceeded. Try again later."
}{
"type": "https://docs.img-processing.com/errors/internal-error",
"error": "Internal Error",
"status": 500,
"message": "An unexpected error occurred. Please try again later. If the problem persists, contact support."
}Description
This endpoint extracts the text from an image and returns its content in theformat specified in the request.
The format can be either plain or markdown. The API will return all the text from the image, trying to maintain the document structure as much as possible.
This is particularly useful for documents, receipts, and other text-heavy images where you want to retain the formatting.
This endpoint is not available in test mode, since test watermarks prevent accurate text extraction.
If you want to test the capabilities of this endpoint, please switch to live mode to use this feature,
or contact support to temporarily upgrade your account.
Authorizations
API Key for authentication
Path Parameters
The unique identifier of the image. This identifier is used to reference the image in subsequent requests.
Body
application/json
The format of the extracted text. It can be markdown or plain text. If not provided, plain text will be used as default.
Available options:
markdown, plain Response
The API will return the Image object in the response body.
Response object for extracting formatted text from an image. Contains the format and content of the extracted text.

