Read barcodes (EAN, UPC, Code 128, Code 39, ITF…) from an image
Reads every barcode and QR code in an image and returns its type, value and position.
Request
Upload the image in the file field (max 25 MB). Instead of a file you can send JSON: {"url": "https://…"} for a public image URL, or {"base64": "…"}.
Parameters and body structure are inherited from this endpoint's definition. Changes here only apply to this test run.
1curl --request POST \
2 --url https://barcode-generator.p.apihiver.com/v1/decode \
3 --header 'Accept: application/json' \
4 --header 'X-API-Key: YOUR_API_KEY' \
5 --header 'content-type: multipart/form-data' \
6 --form file=@file.binRead barcodes (EAN, UPC, Code 128, Code 39, ITF…) from an image: Barcode Generator & Reader API reference
Reads every barcode and QR code in an image and returns its type, value and position. This endpoint is part of the Barcode Generator & Reader API: Generate EAN-13, UPC, Code 128, ISBN and other barcodes as PNG or SVG, read barcodes from images, and validate check digits.
Read barcodes (EAN, UPC, Code 128, Code 39, ITF…) from an image: example requests in every language
POST /v1/decode in Shell (cURL)
curl --request POST \
--url https://barcode-generator.p.apihiver.com/v1/decode \
--header 'Accept: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'content-type: multipart/form-data' \
--form [email protected]POST /v1/decode in Shell (HTTPie)
echo '-----011000010111000001101001
Content-Disposition: form-data; name="file"; filename="file.bin"
Content-Type: multipart/form-data
-----011000010111000001101001--
' | \
http POST https://barcode-generator.p.apihiver.com/v1/decode \
Accept:application/json \
X-API-Key:YOUR_API_KEY \
content-type:'multipart/form-data; boundary=---011000010111000001101001'POST /v1/decode in Shell (Wget)
wget --quiet \
--method POST \
--header 'Accept: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"; filename="file.bin"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- https://barcode-generator.p.apihiver.com/v1/decodePOST /v1/decode in Node.js (http)
const http = require('https');
const options = {
method: 'POST',
hostname: 'barcode-generator.p.apihiver.com',
port: null,
path: '/v1/decode',
headers: {
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write('-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"; filename="file.bin"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();POST /v1/decode in Node.js (Request)
const fs = require('fs');
const request = require('request');
const options = {
method: 'POST',
url: 'https://barcode-generator.p.apihiver.com/v1/decode',
headers: {
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
formData: {
file: {
value: fs.createReadStream('file.bin'),
options: {filename: 'file.bin', contentType: 'multipart/form-data'}
}
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});POST /v1/decode in Node.js (Unirest)
const fs = require('fs');
const unirest = require('unirest');
const req = unirest('POST', 'https://barcode-generator.p.apihiver.com/v1/decode');
req.headers({
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([
{
body: fs.createReadStream('file.bin'),
'content-type': 'multipart/form-data'
}
]);
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});POST /v1/decode in Node.js (Axios)
const axios = require('axios').default;
const options = {
method: 'POST',
url: 'https://barcode-generator.p.apihiver.com/v1/decode',
headers: {
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"; filename="file.bin"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}POST /v1/decode in Node.js (Fetch)
const fs = require('fs');
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('file', fs.createReadStream('file.bin'));
const url = 'https://barcode-generator.p.apihiver.com/v1/decode';
const options = {
method: 'POST',
headers: {Accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY'}
};
options.body = formData;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}POST /v1/decode in JavaScript (XMLHttpRequest)
const data = new FormData();
data.append('file', 'file.bin');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', 'https://barcode-generator.p.apihiver.com/v1/decode');
xhr.setRequestHeader('Accept', 'application/json');
xhr.setRequestHeader('X-API-Key', 'YOUR_API_KEY');
xhr.send(data);POST /v1/decode in JavaScript (Axios)
import axios from 'axios';
const form = new FormData();
form.append('file', 'file.bin');
const options = {
method: 'POST',
url: 'https://barcode-generator.p.apihiver.com/v1/decode',
headers: {
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}POST /v1/decode in JavaScript (Fetch)
const url = 'https://barcode-generator.p.apihiver.com/v1/decode';
const form = new FormData();
form.append('file', 'file.bin');
const options = {
method: 'POST',
headers: {Accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY'}
};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}POST /v1/decode in JavaScript (jQuery)
const form = new FormData();
form.append('file', 'file.bin');
const settings = {
async: true,
crossDomain: true,
url: 'https://barcode-generator.p.apihiver.com/v1/decode',
method: 'POST',
headers: {
Accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});POST /v1/decode in Python (http.client)
import http.client
conn = http.client.HTTPSConnection("barcode-generator.p.apihiver.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {
'Accept': "application/json",
'X-API-Key': "YOUR_API_KEY",
'content-type': "multipart/form-data; boundary=---011000010111000001101001"
}
conn.request("POST", "/v1/decode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))POST /v1/decode in Python (Requests)
import requests
url = "https://barcode-generator.p.apihiver.com/v1/decode"
files = { "file": "open('file.bin', 'rb')" }
headers = {
"Accept": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
response = requests.post(url, files=files, headers=headers)
print(response.json())POST /v1/decode in PHP (cURL)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://barcode-generator.p.apihiver.com/v1/decode",
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=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"X-API-Key: YOUR_API_KEY",
"content-type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}POST /v1/decode in PHP (Guzzle)
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://barcode-generator.p.apihiver.com/v1/decode', [
'multipart' => [
[
'name' => 'file',
'filename' => 'file.bin',
'contents' => null,
'headers' => [
'Content-Type' => 'multipart/form-data'
]
]
]
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => 'YOUR_API_KEY',
],
]);
echo $response->getBody();POST /v1/decode in PHP (PECL HTTP v1)
<?php
$request = new HttpRequest();
$request->setUrl('https://barcode-generator.p.apihiver.com/v1/decode');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'Accept' => 'application/json',
'X-API-Key' => 'YOUR_API_KEY',
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="file"; filename="file.bin"
Content-Type: multipart/form-data
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}POST /v1/decode in PHP (PECL HTTP v2)
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->addForm(null, [
[
'name' => 'file',
'type' => 'multipart/form-data',
'file' => 'file.bin',
'data' => null
]
]);
$request->setRequestUrl('https://barcode-generator.p.apihiver.com/v1/decode');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'Accept' => 'application/json',
'X-API-Key' => 'YOUR_API_KEY'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();POST /v1/decode in Java (AsyncHttp)
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://barcode-generator.p.apihiver.com/v1/decode")
.setHeader("Accept", "application/json")
.setHeader("X-API-Key", "YOUR_API_KEY")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();POST /v1/decode in Java (java.net.http)
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://barcode-generator.p.apihiver.com/v1/decode"))
.header("Accept", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());POST /v1/decode in Java (OkHttp)
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("https://barcode-generator.p.apihiver.com/v1/decode")
.post(body)
.addHeader("Accept", "application/json")
.addHeader("X-API-Key", "YOUR_API_KEY")
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();POST /v1/decode in Java (Unirest)
HttpResponse<String> response = Unirest.post("https://barcode-generator.p.apihiver.com/v1/decode")
.header("Accept", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();POST /v1/decode in C# (HttpClient)
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://barcode-generator.p.apihiver.com/v1/decode"),
Headers =
{
{ "Accept", "application/json" },
{ "X-API-Key", "YOUR_API_KEY" },
},
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("multipart/form-data"),
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "file",
FileName = "file.bin",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}POST /v1/decode in C# (RestSharp)
var client = new RestClient("https://barcode-generator.p.apihiver.com/v1/decode");
var request = new RestRequest("", Method.Post);
request.AddHeader("Accept", "application/json");
request.AddHeader("X-API-Key", "YOUR_API_KEY");
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);POST /v1/decode in Go (NewRequest)
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://barcode-generator.p.apihiver.com/v1/decode"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("X-API-Key", "YOUR_API_KEY")
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}POST /v1/decode in Ruby (net::http)
require 'uri'
require 'net/http'
url = URI("https://barcode-generator.p.apihiver.com/v1/decode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["X-API-Key"] = 'YOUR_API_KEY'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_bodyPOST /v1/decode in Swift (NSURLSession)
import Foundation
let headers = [
"Accept": "application/json",
"X-API-Key": "YOUR_API_KEY",
"content-type": "multipart/form-data; boundary=---011000010111000001101001"
]
let parameters = [
[
"name": "file",
"fileName": "file.bin",
"contentType": "multipart/form-data"
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "https://barcode-generator.p.apihiver.com/v1/decode")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()POST /v1/decode in Objective-C (NSURLSession)
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Accept": @"application/json",
@"X-API-Key": @"YOUR_API_KEY",
@"content-type": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"file", @"fileName": @"file.bin", @"contentType": @"multipart/form-data" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://barcode-generator.p.apihiver.com/v1/decode"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];POST /v1/decode in Kotlin (OkHttp)
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("https://barcode-generator.p.apihiver.com/v1/decode")
.post(body)
.addHeader("Accept", "application/json")
.addHeader("X-API-Key", "YOUR_API_KEY")
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()POST /v1/decode in C (libcurl)
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://barcode-generator.p.apihiver.com/v1/decode");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "X-API-Key: YOUR_API_KEY");
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);POST /v1/decode in Clojure (clj-http)
(require '[clj-http.client :as client])
(client/post "https://barcode-generator.p.apihiver.com/v1/decode" {:headers {:X-API-Key "YOUR_API_KEY"}
:multipart [{:name "file"
:content (clojure.java.io/file "file.bin")}]
:accept :json})POST /v1/decode in OCaml (CoHTTP)
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "https://barcode-generator.p.apihiver.com/v1/decode" in
let headers = Header.add_list (Header.init ()) [
("Accept", "application/json");
("X-API-Key", "YOUR_API_KEY");
("content-type", "multipart/form-data; boundary=---011000010111000001101001");
] in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)POST /v1/decode in R (httr)
library(httr)
url <- "https://barcode-generator.p.apihiver.com/v1/decode"
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"file.bin\"\r\nContent-Type: multipart/form-data\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, add_headers('X-API-Key' = 'YOUR_API_KEY'), content_type("multipart/form-data"), accept("application/json"), encode = encode)
content(response, "text")POST /v1/decode in PowerShell (Invoke-WebRequest)
$headers=@{}
$headers.Add("Accept", "application/json")
$headers.Add("X-API-Key", "YOUR_API_KEY")
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri 'https://barcode-generator.p.apihiver.com/v1/decode' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="file"; filename="file.bin"
Content-Type: multipart/form-data
-----011000010111000001101001--
'POST /v1/decode in PowerShell (Invoke-RestMethod)
$headers=@{}
$headers.Add("Accept", "application/json")
$headers.Add("X-API-Key", "YOUR_API_KEY")
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri 'https://barcode-generator.p.apihiver.com/v1/decode' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="file"; filename="file.bin"
Content-Type: multipart/form-data
-----011000010111000001101001--
'POST /v1/decode in HTTP (HTTP/1.1)
POST /v1/decode HTTP/1.1
Accept: application/json
X-Api-Key: YOUR_API_KEY
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: barcode-generator.p.apihiver.com
Content-Length: 169
-----011000010111000001101001
Content-Disposition: form-data; name="file"; filename="file.bin"
Content-Type: multipart/form-data
-----011000010111000001101001--
Example response (200, application/json)
Success.
1{
2 "codes": [
3 {
4 "data": "9780141036144",
5 "type": "EAN13",
6 "position": {
7 "x": 47,
8 "y": 11,
9 "width": 370,
10 "height": 177
11 }
12 }
13 ],
14 "count": 1
15}Errors
- 400 — A required parameter is missing or a value has the wrong format.
1{ 2 "error": { 3 "code": "INVALID_INPUT", 4 "message": "Provide a file upload, 'url', or 'base64'." 5 } 6}
Gateway errors (missing key, no subscription, rate limits) are listed in Error codes.
Other Barcode Generator & Reader API endpoints
- GETMake a barcode image (Code 128, EAN-13, UPC-A, ISBN, …)
- GETCheck the check digit of an EAN-13, EAN-8, UPC-A, ISBN-10/13 or ISSN
- GETConvert and format ISBNs (ISBN-10 ⇄ ISBN-13)
- GETSupported barcode types
Barcode Generator & Reader API pricing →·Barcode Generator & Reader API overview →