Preços de uma extração, em créditos
GET /documents/prices
Quanto uma extração custa agora: nos motores padrão, no motor fast quando a requisição o pede, e o adicional de resizeImage. Não precisa de chave de API. O preço do fast pode mudar: consulte-o aqui.
Autenticação
Pública: não precisa de chave de API.
Respostas
200 OK
Os preços em vigor
Campos da resposta
standardCréditos de uma extração respondida pelos motores padrão: uma requisição sem
engine.fastCréditos de uma extração respondida pelo motor fast, quando a requisição o pede com
engine: "fast". Quando o fast não consegue responder e um motor padrão responde, a extração custastandard. Este preço pode mudar: consulte-o aqui.resizeImageCréditos a mais quando o servidor redimensiona a imagem para o nosso padrão, como
resizeImage: truepede.
#!/usr/bin/env bash
# The price of an extraction, in credits, per engine and for resizeImage.
# A public endpoint: no key needed.
set -euo pipefail
curl -sS --max-time 30 https://api.docsocr.com/api/v1/documents/prices"""The price of an extraction, in credits, per engine and for resizeImage.
A public endpoint: no key needed. Needs the requests package.
"""
import requests
response = requests.get("https://api.docsocr.com/api/v1/documents/prices", timeout=30)
response.raise_for_status()
for name, credits in response.json().items():
print(f"{name}: {credits} credit(s)")// The price of an extraction, in credits, per engine and for resizeImage.
// A public endpoint: no key needed. Needs Node.js 18+.
const response = await fetch('https://api.docsocr.com/api/v1/documents/prices', {
signal: AbortSignal.timeout(30_000),
})
if (!response.ok) {
console.error(response.status)
process.exit(1)
}
for (const [name, credits] of Object.entries(await response.json())) {
console.log(`${name}: ${credits} credit(s)`)
}<?php
// The price of an extraction, in credits, per engine and for resizeImage.
// A public endpoint: no key needed. Needs the curl extension.
$request = curl_init('https://api.docsocr.com/api/v1/documents/prices');
curl_setopt_array($request, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30]);
$body = curl_exec($request);
if ($body === false || curl_getinfo($request, CURLINFO_RESPONSE_CODE) !== 200) {
fwrite(STDERR, 'The price list did not answer' . PHP_EOL);
exit(1);
}
foreach (json_decode($body, true) as $name => $credits) {
echo "$name: $credits credit(s)", PHP_EOL;
}// The price of an extraction, in credits, per engine and for resizeImage.
// A public endpoint: no key needed. Needs Java 17+. Run: java Prices.java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class Prices {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.docsocr.com/api/v1/documents/prices"))
.timeout(Duration.ofSeconds(30))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
// The answer is JSON, e.g. {"standard": 1, ...}; read it with your JSON library
System.out.println(response.body());
if (response.statusCode() != 200) {
System.exit(1);
}
}
}// The price of an extraction, in credits, per engine and for resizeImage.
// A public endpoint: no key needed. Needs .NET 8+. Run: dotnet run Prices.cs (.NET 10)
using System.Text.Json;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
using var prices = JsonDocument.Parse(await http.GetStringAsync("https://api.docsocr.com/api/v1/documents/prices"));
foreach (var price in prices.RootElement.EnumerateObject())
{
Console.WriteLine($"{price.Name}: {price.Value} credit(s)");
}Testar
Envia esta requisição para a API em produção.
Esta chamada não custa créditos.