Pular para o conteúdo

Listar tipos de documentos disponíveis ​

GET /documents/types

Retorna todos os tipos de documentos que você pode processar, com seus endpoints e status.

Autenticação ​

Sua chave de API DocsOCR, enviada como Authorization: Bearer <chave>. As chaves começam com dso_live_v1_ ou dso_test_v1_; as duas chamam os motores e usam créditos. Gerenciar chaves

Respostas ​

200 OK ​

Tipos de documentos disponíveis

Campos da resposta
  • types objeto[]

    Lista de tipos de documentos disponíveis

  • types[].id string

    Identificador único do tipo de documento

  • types[].name string

    Nome legível do tipo de documento

  • types[].description string

    Breve descrição do tipo de documento

  • types[].icon string

    Emoji ícone do tipo de documento

  • types[].enabled boolean

    Se este tipo de documento está habilitado para processamento

  • types[].endpoint string

    Endpoint da API para processar este tipo de documento

401 Unauthorized ​

Chave de API inválida ou ausente.

Campos da resposta
  • error string

    Categoria do erro (sempre Unauthorized)

  • message string

    O que há de errado com a chave. Gerenciar chaves de API

  • timestamp string

    Quando a requisição foi recusada, em UTC

json
{
  "error": "Unauthorized",
  "message": "Invalid or expired API key",
  "timestamp": "2026-10-02T12:00:00.000Z"
}
json
{
  "error": "Unauthorized",
  "message": "API key is required. Provide Authorization: Bearer <your-api-key>",
  "timestamp": "2026-10-02T12:00:00.000Z"
}
bash
#!/usr/bin/env bash
# The document types the API reads, and the endpoint of each.
# Needs DOCSOCR_API_KEY in the environment; create a key in the panel.
set -euo pipefail

curl -sS --max-time 30 https://api.docsocr.com/api/v1/documents/types \
  -H "Authorization: Bearer $DOCSOCR_API_KEY"
python
"""The document types the API reads, and the endpoint of each.

Needs the requests package and DOCSOCR_API_KEY in the environment.
"""
import os

import requests

response = requests.get(
    "https://api.docsocr.com/api/v1/documents/types",
    headers={"Authorization": f"Bearer {os.environ['DOCSOCR_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
for document_type in response.json()["types"]:
    print(f"{document_type['id']}: POST {document_type['endpoint']}")
js
// The document types the API reads, and the endpoint of each.
// Needs Node.js 18+ and DOCSOCR_API_KEY in the environment.
const response = await fetch('https://api.docsocr.com/api/v1/documents/types', {
  headers: { Authorization: `Bearer ${process.env.DOCSOCR_API_KEY}` },
  signal: AbortSignal.timeout(30_000),
})
if (!response.ok) {
  console.error(response.status, await response.text())
  process.exit(1)
}
for (const type of (await response.json()).types) {
  console.log(`${type.id}: POST ${type.endpoint}`)
}
php
<?php
// The document types the API reads, and the endpoint of each.
// Needs the curl extension and DOCSOCR_API_KEY in the environment.

$request = curl_init('https://api.docsocr.com/api/v1/documents/types');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('DOCSOCR_API_KEY')],
]);
$body = curl_exec($request);
$status = curl_getinfo($request, CURLINFO_RESPONSE_CODE);
if ($body === false || $status !== 200) {
    fwrite(STDERR, "$status " . ($body === false ? curl_error($request) : $body) . PHP_EOL);
    exit(1);
}
foreach (json_decode($body, true)['types'] as $type) {
    echo "{$type['id']}: POST {$type['endpoint']}", PHP_EOL;
}
java
// The document types the API reads, and the endpoint of each.
// Needs Java 17+ and DOCSOCR_API_KEY in the environment. Run: java DocumentTypes.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 DocumentTypes {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.docsocr.com/api/v1/documents/types"))
            .timeout(Duration.ofSeconds(30))
            .header("Authorization", "Bearer " + System.getenv("DOCSOCR_API_KEY"))
            .GET()
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());

        // The answer is JSON, e.g. {"types": [{"id": "birth-certificate", ...}]}; read it with your JSON library
        System.out.println(response.body());
        if (response.statusCode() != 200) {
            System.exit(1);
        }
    }
}
csharp
// The document types the API reads, and the endpoint of each.
// Needs .NET 8+ and DOCSOCR_API_KEY in the environment. Run: dotnet run DocumentTypes.cs (.NET 10)
using System.Net.Http.Headers;
using System.Text.Json;

using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("DOCSOCR_API_KEY"));

using var response = await http.GetAsync("https://api.docsocr.com/api/v1/documents/types");
var body = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
    Console.Error.WriteLine($"{(int)response.StatusCode} {body}");
    return 1;
}

using var answer = JsonDocument.Parse(body);
foreach (var type in answer.RootElement.GetProperty("types").EnumerateArray())
{
    Console.WriteLine($"{type.GetProperty("id").GetString()}: POST {type.GetProperty("endpoint").GetString()}");
}
return 0;

Testar

Envia esta requisição para a API em produção, com a sua chave.

A chave fica só nesta aba do navegador e vai apenas para a API. Gerar chave no painel

Esta chamada não custa créditos.

Cole a sua chave de API para enviar.