REST reference
Recognize cigar text
Read visible cigar-band text and rank catalog candidates.
POST
/
v1
/
ai
/
cigars
/
text
/
recognize
Recognize cigar text
curl --request POST \
--url https://api.example.com/v1/ai/cigars/text/recognize \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'x-boxpressd-key: <x-boxpressd-key>' \
--data '
{
"imageUrl": "<string>",
"imageUrls": [
"<string>"
]
}
'import requests
url = "https://api.example.com/v1/ai/cigars/text/recognize"
payload = {
"imageUrl": "<string>",
"imageUrls": ["<string>"]
}
headers = {
"x-boxpressd-key": "<x-boxpressd-key>",
"Idempotency-Key": "<idempotency-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-boxpressd-key': '<x-boxpressd-key>',
'Idempotency-Key': '<idempotency-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({imageUrl: '<string>', imageUrls: ['<string>']})
};
fetch('https://api.example.com/v1/ai/cigars/text/recognize', 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.example.com/v1/ai/cigars/text/recognize",
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([
'imageUrl' => '<string>',
'imageUrls' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"x-boxpressd-key: <x-boxpressd-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.example.com/v1/ai/cigars/text/recognize"
payload := strings.NewReader("{\n \"imageUrl\": \"<string>\",\n \"imageUrls\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-boxpressd-key", "<x-boxpressd-key>")
req.Header.Add("Idempotency-Key", "<idempotency-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.example.com/v1/ai/cigars/text/recognize")
.header("x-boxpressd-key", "<x-boxpressd-key>")
.header("Idempotency-Key", "<idempotency-key>")
.header("Content-Type", "application/json")
.body("{\n \"imageUrl\": \"<string>\",\n \"imageUrls\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ai/cigars/text/recognize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-boxpressd-key"] = '<x-boxpressd-key>'
request["Idempotency-Key"] = '<idempotency-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"imageUrl\": \"<string>\",\n \"imageUrls\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyUse text recognition when a band has readable brand, series, vitola, or barcode text.
The response includes recognized text, catalog queries, and ranked candidates. An exact barcode can produce a unique match. Ambiguous product barcodes remain candidates because a sampler can contain several cigars.
string
required
Your developer application key with the
api.ai entitlement.string
required
A unique key for this paid operation.
string
One retrievable cigar-band image URL.
string[]
Up to eight retrievable images. Supply this instead of
imageUrl.curl "https://api.boxpressd.com/v1/ai/cigars/text/recognize" \
--request POST \
--header "x-boxpressd-key: $BOXPRESSD_DEVELOPER_API_KEY" \
--header "Idempotency-Key: text-scan-7f52b86d" \
--header "Content-Type: application/json" \
--data "{\"imageUrl\":\"$CIGAR_BAND_IMAGE_URL\"}"
⌘I
Recognize cigar text
curl --request POST \
--url https://api.example.com/v1/ai/cigars/text/recognize \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'x-boxpressd-key: <x-boxpressd-key>' \
--data '
{
"imageUrl": "<string>",
"imageUrls": [
"<string>"
]
}
'import requests
url = "https://api.example.com/v1/ai/cigars/text/recognize"
payload = {
"imageUrl": "<string>",
"imageUrls": ["<string>"]
}
headers = {
"x-boxpressd-key": "<x-boxpressd-key>",
"Idempotency-Key": "<idempotency-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-boxpressd-key': '<x-boxpressd-key>',
'Idempotency-Key': '<idempotency-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({imageUrl: '<string>', imageUrls: ['<string>']})
};
fetch('https://api.example.com/v1/ai/cigars/text/recognize', 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.example.com/v1/ai/cigars/text/recognize",
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([
'imageUrl' => '<string>',
'imageUrls' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"x-boxpressd-key: <x-boxpressd-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.example.com/v1/ai/cigars/text/recognize"
payload := strings.NewReader("{\n \"imageUrl\": \"<string>\",\n \"imageUrls\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-boxpressd-key", "<x-boxpressd-key>")
req.Header.Add("Idempotency-Key", "<idempotency-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.example.com/v1/ai/cigars/text/recognize")
.header("x-boxpressd-key", "<x-boxpressd-key>")
.header("Idempotency-Key", "<idempotency-key>")
.header("Content-Type", "application/json")
.body("{\n \"imageUrl\": \"<string>\",\n \"imageUrls\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ai/cigars/text/recognize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-boxpressd-key"] = '<x-boxpressd-key>'
request["Idempotency-Key"] = '<idempotency-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"imageUrl\": \"<string>\",\n \"imageUrls\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body