Extract data from a marriage certificate
POST /documents/marriage-certificate
What it does: extracts every field of a Brazilian marriage certificate from a photo, a scan or a PDF.
One page: an inteiro teor, the registration's whole text, is read when it fits one page, since a request takes one image. Only the first page of a PDF is read.
Send the image at a public URL (imageType: "url" with imageUrl) or in the body (imageType: "base64" with imageBase64). Try it with the hosted sample, https://docsocr.com/samples/certidao-casamento-exemplo.jpg (fictitious data).
Our image standard: 1344 to 2048 px on the long side, where every engine reads best. An image outside it is refused with 422 at no charge, unless resizeImage: true asks us to resize it, at the resize's price; that adds time to the answer.
The fast engine: "engine": "fast" asks for it. It is tried first, and the standard engines follow if it cannot answer.
The answer: the certificate's fields in data, the engine that answered (engine) and what the request cost (creditsCharged). A value that cannot be right, such as a CPF whose check digits do not match, comes as it was read, with a warning in warnings. When the image is not a marriage certificate, when nothing can be read from it or when no engine can answer, the status is still 201, with success: false, an errorCode and nothing charged: DOCUMENT_NOT_RECOGNIZED (another document, or an image with nothing to read) and IMAGE_NOT_PROCESSABLE need another image; EXTRACTION_BUSY, EXTRACTION_TIMEOUT and EXTRACTION_UNAVAILABLE may pass when you send the same request again later.
Repeating a request: the same requestId, file and options within 15 minutes of the answer get the same answer at no charge, without running the engines, with the header Idempotent-Replayed: true. While the first request still runs, a repeat gets 409 REQUEST_IN_PROGRESS with Retry-After.
Price: an answer with data costs the price of the engine that answers it, as GET /documents/prices lists it for each document: without engine, never more than the dearer of the standard engines; with "engine": "fast", never more than fast's. Check balance
Authentication
Your DocsOCR API key, sent as Authorization: Bearer <key>. Keys start with dso_live_v1_ or dso_test_v1_; both call the engines and use credits. Manage keys
Parameters
accept-languageThe language of the messages in refusals, errors and warnings:
pt-BRfor Portuguese, English otherwise.
Request body
The certificate image, at a public URL or in base64: imageType says which.
Content-Type: application/json
imageType"url": the image is atimageUrl."base64": the image is inimageBase64.requestIdYour ID for this request, up to 128 characters: letters, digits,
_,-,.and:. Put no personal data in it. The samerequestIdwith the same file and options within 15 minutes of the answer returns the same answer at no charge, without running the engines; with another file or other options, it is a new request. The answer does not repeat it.imageUrlPublic URL of the certificate image: a direct link that opens without a login.
imageBase64The certificate file in base64, with or without the data URI prefix, e.g.
data:image/jpeg;base64,/9j/4AAQ.... PDF*, JPG, PNG, WebP or GIF, up to 10 MB; the type is read from the file itself. *Only the first page of a PDF is read.resizeImageResize an image outside our standard (1344 to 2048 px on the long side) to fit it, instead of refusing it: the resize's price is then added to the extraction's, and the answer says
imageResized: true. The request needs both prices available while it runs (GET /documents/priceslists them for each document). Without it, such an image is refused with 422 and costs nothing. An image inside the standard is never resized and costs the extraction's price either way.engineAsk for the fast engine: it is tried first, and when it cannot answer, the standard engines follow. Leave it out to use the standard engines. Only
"fast"is accepted; any other value is refused with 400 and costs nothing.
Examples
{
"imageType": "url",
"imageUrl": "https://docsocr.com/samples/certidao-casamento-exemplo.jpg",
"requestId": "5d2e8f1a-7c3b-4a9e-8f6d-2b1c0e9a7d4f"
}{
"imageType": "base64",
"imageBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcG...",
"requestId": "a3f7c9e1-2b4d-4c6e-9a8b-7d5f3e1c9b2a"
}{
"imageType": "url",
"imageUrl": "https://docsocr.com/samples/certidao-casamento-exemplo.jpg",
"requestId": "e8b4d2f6-1a3c-4e5b-9d7f-0c2a4b6d8e1f",
"engine": "fast"
}Responses
201 Created
The certificate's data. With success: false, no engine could answer: errorCode says why, and nothing was charged.
Idempotent-Replayedtruewhen the answer is the one kept for a repeat: the same answer as the first time, at no charge, without the engines. Absent otherwise.
Response fields
successtrueif extraction succeeded. Checkerrorfield iffalse.errorWhat went wrong. Only present when success is false.
errorCodeWhy the extraction failed, as a code you can handle in your code.
errorexplains it in plain words. Only present when success is false.processingTimeMsHow long the extraction took, in milliseconds.
warningsValues of
datato check on the document. A value that cannot be right, such as a CPF whose check digits do not match, comes as it was read, with a warning here; the request is charged as any other. Only present when there is one.warnings[].codeWhat is wrong with the value, as a code you can handle in your code.
warnings[].fieldThe field of
datait is about, as a dotted path.warnings[].messageWhat is wrong and what to do, in plain words.
imageResizedtruewhen the image was outside our standard (1344 to 2048 px on the long side) and was resized to fit it, asresizeImageasked: the resize's price was added to the extraction's. Only present when it happened.originalImageSizeSize of the image as you sent it, upright. Only present when imageResized is true.
originalImageSize.widthWidth, in pixels.
originalImageSize.heightHeight, in pixels.
finalImageSizeSize of the image once resized to our standard. Only present when imageResized is true.
finalImageSize.widthWidth, in pixels.
finalImageSize.heightHeight, in pixels.
engineThe engine that answered with data:
miniorlargefor the standard engines, orfastwhen the request asked for it and fast answered. Only present when an engine answered.creditsChargedCredits this request cost, to the hundredth: the price of the engine that answered (never more than the engine you asked for), plus the resize. 0 when nothing was charged: a refused image, no engine could answer, or a repeat answered from its kept answer (
Idempotent-Replayed: true).dataExtracted certificate data. Every field of a marriage certificate, empty where the certificate prints nothing. When
successis false, every field is empty but the document type.
{
"success": true,
"processingTimeMs": 7480,
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "CERTIDÃO DE CASAMENTO",
"forma": "breve relato"
},
"registro": {
"matrícula": "123456 01 55 2025 2 00034 045 0009876 12",
"livro": "34",
"folha": "45",
"termo": "9876"
},
"cônjuge_1": {
"nome_completo": "RAFAEL COSTA TESTE",
"nome_atual": "RAFAEL COSTA TESTE",
"cpf": "123.456.789-09",
"nome_habilitação": "RAFAEL COSTA TESTE",
"nome_após_casamento": "RAFAEL COSTA TESTE",
"data_nascimento": {
"dia": "12",
"mês": "05",
"ano": "1994"
},
"nacionalidade": "BRASILEIRA",
"estado_civil": "SOLTEIRO",
"estado_civil_código": "solteiro",
"município_naturalidade": "RECIFE",
"uf_naturalidade": "PE",
"genitores": "JOSÉ COSTA TESTE; MARIA COSTA TESTE",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "JULIANA MENDES COSTA TESTE",
"nome_atual": "JULIANA MENDES COSTA TESTE",
"cpf": "987.654.321-00",
"nome_habilitação": "JULIANA MENDES TESTE",
"nome_após_casamento": "JULIANA MENDES COSTA TESTE",
"data_nascimento": {
"dia": "03",
"mês": "09",
"ano": "1996"
},
"nacionalidade": "BRASILEIRA",
"estado_civil": "SOLTEIRA",
"estado_civil_código": "solteiro",
"município_naturalidade": "OLINDA",
"uf_naturalidade": "PE",
"genitores": "PAULO MENDES TESTE; ANA MENDES TESTE",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "civil",
"data_celebração": {
"texto_completo": "VINTE E DOIS DE MARÇO DE DOIS MIL E VINTE E CINCO",
"dia": "22",
"mês": "03",
"ano": "2025"
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "COMUNHÃO PARCIAL DE BENS",
"regime_bens_código": "comunhão parcial",
"data_registro": {
"texto_completo": "VINTE E DOIS DE MARÇO DE DOIS MIL E VINTE E CINCO",
"dia": "22",
"mês": "03",
"ano": "2025"
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "CARTÓRIO DO 1º OFÍCIO DE REGISTRO CIVIL DE RECIFE - PE",
"cns": "123456",
"município": "RECIFE",
"uf": "PE",
"endereço": "RUA DO EXEMPLO, 100, BOA VISTA, CEP 50000-000",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "PEDRO EXEMPLO",
"assinante": "MARIANA EXEMPLO",
"cargo_assinante": "ESCREVENTE",
"data_emissão": "25/03/2025",
"número_papel": ""
}
},
"engine": "large",
"creditsCharged": 1.5
}{
"success": true,
"processingTimeMs": 7480,
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "CERTIDÃO DE CASAMENTO",
"forma": "breve relato"
},
"registro": {
"matrícula": "123456 01 55 2025 2 00034 045 0009876 12",
"livro": "34",
"folha": "45",
"termo": "9876"
},
"cônjuge_1": {
"nome_completo": "RAFAEL COSTA TESTE",
"nome_atual": "RAFAEL COSTA TESTE",
"cpf": "123.456.789-00",
"nome_habilitação": "RAFAEL COSTA TESTE",
"nome_após_casamento": "RAFAEL COSTA TESTE",
"data_nascimento": {
"dia": "12",
"mês": "05",
"ano": "1994"
},
"nacionalidade": "BRASILEIRA",
"estado_civil": "SOLTEIRO",
"estado_civil_código": "solteiro",
"município_naturalidade": "RECIFE",
"uf_naturalidade": "PE",
"genitores": "JOSÉ COSTA TESTE; MARIA COSTA TESTE",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "JULIANA MENDES COSTA TESTE",
"nome_atual": "JULIANA MENDES COSTA TESTE",
"cpf": "987.654.321-00",
"nome_habilitação": "JULIANA MENDES TESTE",
"nome_após_casamento": "JULIANA MENDES COSTA TESTE",
"data_nascimento": {
"dia": "03",
"mês": "09",
"ano": "1996"
},
"nacionalidade": "BRASILEIRA",
"estado_civil": "SOLTEIRA",
"estado_civil_código": "solteiro",
"município_naturalidade": "OLINDA",
"uf_naturalidade": "PE",
"genitores": "PAULO MENDES TESTE; ANA MENDES TESTE",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "civil",
"data_celebração": {
"texto_completo": "VINTE E DOIS DE MARÇO DE DOIS MIL E VINTE E CINCO",
"dia": "22",
"mês": "03",
"ano": "2025"
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "COMUNHÃO PARCIAL DE BENS",
"regime_bens_código": "comunhão parcial",
"data_registro": {
"texto_completo": "VINTE E DOIS DE MARÇO DE DOIS MIL E VINTE E CINCO",
"dia": "22",
"mês": "03",
"ano": "2025"
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "CARTÓRIO DO 1º OFÍCIO DE REGISTRO CIVIL DE RECIFE - PE",
"cns": "123456",
"município": "RECIFE",
"uf": "PE",
"endereço": "RUA DO EXEMPLO, 100, BOA VISTA, CEP 50000-000",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "PEDRO EXEMPLO",
"assinante": "MARIANA EXEMPLO",
"cargo_assinante": "ESCREVENTE",
"data_emissão": "25/03/2025",
"número_papel": ""
}
},
"warnings": [
{
"code": "INVALID_CPF",
"field": "cônjuge_1.cpf",
"message": "The value read is not a valid CPF: it is returned as read. Check it on the document."
}
],
"engine": "large",
"creditsCharged": 1.5
}{
"success": false,
"processingTimeMs": 1203,
"error": "The extraction service is busy. Please retry in a few moments. No credit was charged.",
"errorCode": "EXTRACTION_BUSY",
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "",
"forma": ""
},
"registro": {
"matrícula": "",
"livro": "",
"folha": "",
"termo": ""
},
"cônjuge_1": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "",
"data_celebração": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "",
"regime_bens_código": "",
"data_registro": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "",
"cns": "",
"município": "",
"uf": "",
"endereço": "",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "",
"assinante": "",
"cargo_assinante": "",
"data_emissão": "",
"número_papel": ""
}
},
"creditsCharged": 0
}{
"success": false,
"processingTimeMs": 2410,
"error": "The document could not be processed. Check that the image shows a marriage certificate. No credit was charged.",
"errorCode": "DOCUMENT_NOT_RECOGNIZED",
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "",
"forma": ""
},
"registro": {
"matrícula": "",
"livro": "",
"folha": "",
"termo": ""
},
"cônjuge_1": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "",
"data_celebração": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "",
"regime_bens_código": "",
"data_registro": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "",
"cns": "",
"município": "",
"uf": "",
"endereço": "",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "",
"assinante": "",
"cargo_assinante": "",
"data_emissão": "",
"número_papel": ""
}
},
"creditsCharged": 0
}{
"success": false,
"processingTimeMs": 2410,
"error": "The image shows a birth certificate, which this endpoint does not read. Send it to POST /documents/birth-certificate. No credit was charged.",
"errorCode": "DOCUMENT_NOT_RECOGNIZED",
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "",
"forma": ""
},
"registro": {
"matrícula": "",
"livro": "",
"folha": "",
"termo": ""
},
"cônjuge_1": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "",
"data_celebração": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "",
"regime_bens_código": "",
"data_registro": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "",
"cns": "",
"município": "",
"uf": "",
"endereço": "",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "",
"assinante": "",
"cargo_assinante": "",
"data_emissão": "",
"número_papel": ""
}
},
"creditsCharged": 0
}400 Bad Request
The body is not valid: message lists what to fix. Nothing was charged.
Response fields
statusCodeHTTP status code (always 400)
messageWhat to fix, one line per problem
errorError category
{
"message": [
"imageUrl is required when imageType is \"url\"",
"requestId may only contain letters, digits, _, -, . and : (up to 128 characters)"
],
"error": "Bad Request",
"statusCode": 400
}401 Unauthorized
The API key is missing, malformed, unknown, revoked or expired.
Response fields
errorError category (always
Unauthorized)messageWhat went wrong with the key. Manage API keys
timestampWhen the request was refused, in UTC
{
"error": "Unauthorized",
"message": "Invalid or expired API key",
"timestamp": "2026-10-02T12:00:00.000Z"
}{
"error": "Unauthorized",
"message": "API key is required. Provide Authorization: Bearer <your-api-key>",
"timestamp": "2026-10-02T12:00:00.000Z"
}402 Payment Required
Not enough credits for this request (errorCode NOT_ENOUGH_CREDITS). A request holds its price while it runs: its engine's price (see GET /documents/prices), plus the resize's with resizeImage: true. message gives the price and the balance; send Accept-Language: pt-BR for it in Portuguese. A repeat of a request answered in the last 15 minutes needs no credits.
Response fields
statusCodeHTTP status code (always 402)
messageThe request's price and the balance, with what to do. Send
Accept-Language: pt-BRfor it in Portuguese.errorError category
errorCodeAlways
NOT_ENOUGH_CREDITSactionWhat to do: buy credits or change the plan
creditsAvailableCredits the organization can use now, to the hundredth
creditsRequiredThe request's price, which it holds while it runs
planCreditsRemainingCredits left in the plan's monthly allowance
purchasedCreditsRemainingCredits left from purchases
{
"statusCode": 402,
"message": "This request costs 1.5 credits, and the available balance is 0 credits. Buy credits or upgrade your plan to continue.",
"error": "Payment Required",
"errorCode": "NOT_ENOUGH_CREDITS",
"action": "purchase_credits",
"creditsAvailable": 0,
"creditsRequired": 1.5,
"planCreditsRemaining": 0,
"purchasedCreditsRemaining": 0
}409 Conflict
A request with the same requestId, file and options is still running (errorCode REQUEST_IN_PROGRESS). Nothing ran and nothing was charged. Wait the Retry-After seconds and send it again: you get its answer at no charge.
Retry-AfterSeconds to wait before sending it again, as
retryAfter
Response fields
statusCodeHTTP status code (always 409)
messageWhat to do — human-readable
errorError category
errorCodeAlways
REQUEST_IN_PROGRESSretryAfterSeconds to wait before sending the request again
{
"statusCode": 409,
"message": "A request with this requestId and the same content is still being processed. Try again in a few seconds to get its answer, at no charge.",
"error": "Conflict",
"errorCode": "REQUEST_IN_PROGRESS",
"retryAfter": 5
}413 Payload Too Large
The request body is over 15 MB: errorCode IMAGE_TOO_LARGE. Nothing was charged.
Response fields
successAlways
falseerrorCodeAlways
IMAGE_TOO_LARGEerrorWhat to send instead.
Accept-Language: pt-BRgets it in Portuguese.processingTimeMsAlways 0: no work was done
{
"success": false,
"errorCode": "IMAGE_TOO_LARGE",
"error": "The image is larger than 10 MB. Send a smaller image, for example a JPG with lower resolution or quality.",
"processingTimeMs": 0
}422 Unprocessable Entity
The image cannot be used, or imageUrl could not be downloaded. success is false, errorCode names the problem (for example IMAGE_TOO_LARGE, IMAGE_FORMAT_UNSUPPORTED, IMAGE_RESOLUTION_TOO_LOW, IMAGE_DOWNLOAD_FAILED) and error explains it in plain words, with what to fix. Send PDF*, JPG, PNG, WebP or GIF, up to 10 MB, inside our standard of 1344 to 2048 px on the long side. *Only the first page of a PDF is read. A refused request costs nothing. Send Accept-Language: pt-BR for the message in Portuguese.
Response fields
successtrueif extraction succeeded. Checkerrorfield iffalse.errorWhat went wrong. Only present when success is false.
errorCodeWhy the extraction failed, as a code you can handle in your code.
errorexplains it in plain words. Only present when success is false.processingTimeMsHow long the extraction took, in milliseconds.
warningsValues of
datato check on the document. A value that cannot be right, such as a CPF whose check digits do not match, comes as it was read, with a warning here; the request is charged as any other. Only present when there is one.warnings[].codeWhat is wrong with the value, as a code you can handle in your code.
warnings[].fieldThe field of
datait is about, as a dotted path.warnings[].messageWhat is wrong and what to do, in plain words.
imageResizedtruewhen the image was outside our standard (1344 to 2048 px on the long side) and was resized to fit it, asresizeImageasked: the resize's price was added to the extraction's. Only present when it happened.originalImageSizeSize of the image as you sent it, upright. Only present when imageResized is true.
originalImageSize.widthWidth, in pixels.
originalImageSize.heightHeight, in pixels.
finalImageSizeSize of the image once resized to our standard. Only present when imageResized is true.
finalImageSize.widthWidth, in pixels.
finalImageSize.heightHeight, in pixels.
engineThe engine that answered with data:
miniorlargefor the standard engines, orfastwhen the request asked for it and fast answered. Only present when an engine answered.creditsChargedCredits this request cost, to the hundredth: the price of the engine that answered (never more than the engine you asked for), plus the resize. 0 when nothing was charged: a refused image, no engine could answer, or a repeat answered from its kept answer (
Idempotent-Replayed: true).dataExtracted certificate data. Every field of a marriage certificate, empty where the certificate prints nothing. When
successis false, every field is empty but the document type.
{
"success": false,
"processingTimeMs": 35,
"error": "The image has 800 px on its long side; our standard is 1,344 to 2,048 px. Send a photo with more resolution, or set resizeImage: true to have it enlarged, at the resize's price.",
"errorCode": "IMAGE_RESOLUTION_TOO_LOW",
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "",
"forma": ""
},
"registro": {
"matrícula": "",
"livro": "",
"folha": "",
"termo": ""
},
"cônjuge_1": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "",
"data_celebração": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "",
"regime_bens_código": "",
"data_registro": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "",
"cns": "",
"município": "",
"uf": "",
"endereço": "",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "",
"assinante": "",
"cargo_assinante": "",
"data_emissão": "",
"número_papel": ""
}
},
"creditsCharged": 0
}{
"success": false,
"processingTimeMs": 410,
"error": "We could not download the image from imageUrl: the link answered HTTP 404 (file not found). Use a public, direct link to a PDF, JPG, PNG, WebP or GIF file that opens without a login, or send the image as imageBase64.",
"errorCode": "IMAGE_DOWNLOAD_FAILED",
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "",
"forma": ""
},
"registro": {
"matrícula": "",
"livro": "",
"folha": "",
"termo": ""
},
"cônjuge_1": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "",
"data_celebração": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "",
"regime_bens_código": "",
"data_registro": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "",
"cns": "",
"município": "",
"uf": "",
"endereço": "",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "",
"assinante": "",
"cargo_assinante": "",
"data_emissão": "",
"número_papel": ""
}
},
"creditsCharged": 0
}{
"success": false,
"processingTimeMs": 35,
"error": "The file is not in one of these formats: PDF, JPG, PNG, WebP or GIF. Convert it to one of them and send it again.",
"errorCode": "IMAGE_FORMAT_UNSUPPORTED",
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "",
"forma": ""
},
"registro": {
"matrícula": "",
"livro": "",
"folha": "",
"termo": ""
},
"cônjuge_1": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "",
"nome_atual": "",
"cpf": "",
"nome_habilitação": "",
"nome_após_casamento": "",
"data_nascimento": {
"dia": "",
"mês": "",
"ano": ""
},
"nacionalidade": "",
"estado_civil": "",
"estado_civil_código": "",
"município_naturalidade": "",
"uf_naturalidade": "",
"genitores": "",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "",
"data_celebração": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "",
"regime_bens_código": "",
"data_registro": {
"texto_completo": "",
"dia": "",
"mês": "",
"ano": ""
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "",
"cns": "",
"município": "",
"uf": "",
"endereço": "",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "",
"assinante": "",
"cargo_assinante": "",
"data_emissão": "",
"número_papel": ""
}
},
"creditsCharged": 0
}429 Too Many Requests
Over one of your plan's limits. retryAfter says how many seconds to wait; there is no Retry-After header. A limit per day resets at midnight UTC.
Response fields
statusCodeHTTP status code (always 429)
messageWhich limit you hit, and its size. View usage
errorError category
retryAfterSeconds to wait before sending the request again. A limit per day lasts until midnight UTC, so its wait can be hours.
{
"statusCode": 429,
"message": "Organization rate limit exceeded (10 requests per minute). Retry after 6 seconds.",
"error": "Too Many Requests",
"retryAfter": 6
}{
"statusCode": 429,
"message": "Daily quota exceeded (1000 requests per day). Current usage: 1000",
"error": "Too Many Requests",
"retryAfter": 43200
}503 Service Unavailable
The service is restarting: the proxy answers with an HTML page, and may answer 502 or 504 the same way. Send the same request again after a few seconds, with the same requestId, so it is never charged twice.
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>errorCode values
The errorCode of an answer without data says why, as a code your system can handle. This operation's values:
IMAGE_MISSINGIMAGE_BASE64_INVALIDIMAGE_TOO_LARGEIMAGE_TOO_MANY_PIXELSIMAGE_FORMAT_UNSUPPORTEDIMAGE_UNREADABLEIMAGE_URL_NOT_ALLOWEDIMAGE_RESOLUTION_TOO_LOWIMAGE_RESOLUTION_TOO_HIGHIMAGE_INVALIDPDF_PASSWORD_PROTECTEDPDF_UNREADABLEPDF_TOO_MANY_PAGESIMAGE_DOWNLOAD_FAILEDIMAGE_NOT_PROCESSABLEDOCUMENT_NOT_RECOGNIZEDEXTRACTION_TIMEOUTEXTRACTION_BUSYEXTRACTION_UNAVAILABLENOT_ENOUGH_CREDITSREQUEST_IN_PROGRESS
#!/usr/bin/env bash
# Extract the hosted sample marriage certificate (fictitious data).
# Needs DOCSOCR_API_KEY in the environment; create a key in the panel.
set -euo pipefail
REQUEST_ID="marriage-$(date +%s)-$RANDOM" # one id per document
# The API answers within 90 s
curl -sS --max-time 120 https://api.docsocr.com/api/v1/documents/marriage-certificate \
-H "Authorization: Bearer $DOCSOCR_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<EOF
{
"imageType": "url",
"imageUrl": "https://docsocr.com/samples/certidao-casamento-exemplo.jpg",
"requestId": "$REQUEST_ID"
}
EOF"""Extract the hosted sample marriage certificate (fictitious data).
Needs the requests package and DOCSOCR_API_KEY in the environment.
"""
import os
import uuid
import requests
response = requests.post(
"https://api.docsocr.com/api/v1/documents/marriage-certificate",
headers={"Authorization": f"Bearer {os.environ['DOCSOCR_API_KEY']}"},
json={
"imageType": "url",
"imageUrl": "https://docsocr.com/samples/certidao-casamento-exemplo.jpg",
"requestId": str(uuid.uuid4()), # one id per document
},
timeout=120, # above the API's 90 s extraction budget
)
answer = response.json()
if response.status_code != 201 or not answer["success"]:
raise SystemExit(f"{response.status_code} {answer.get('errorCode', '')} {answer.get('message') or answer.get('error')}")
# The spouses in the order the certificate prints them
print(answer["data"]["cônjuge_1"]["nome_completo"])
print(answer["data"]["cônjuge_2"]["nome_completo"])// Extract the hosted sample marriage certificate (fictitious data).
// Needs Node.js 18+ and DOCSOCR_API_KEY in the environment.
import { randomUUID } from 'node:crypto'
const response = await fetch('https://api.docsocr.com/api/v1/documents/marriage-certificate', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DOCSOCR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
imageType: 'url',
imageUrl: 'https://docsocr.com/samples/certidao-casamento-exemplo.jpg',
requestId: randomUUID(), // one id per document
}),
signal: AbortSignal.timeout(120_000), // above the API's 90 s extraction budget
})
const answer = await response.json()
if (response.status !== 201 || !answer.success) {
console.error(response.status, answer.errorCode ?? '', answer.message ?? answer.error)
process.exit(1)
}
// The spouses in the order the certificate prints them
console.log(answer.data['cônjuge_1'].nome_completo)
console.log(answer.data['cônjuge_2'].nome_completo)<?php
// Extract the hosted sample marriage certificate (fictitious data).
// Needs the curl extension and DOCSOCR_API_KEY in the environment.
$request = curl_init('https://api.docsocr.com/api/v1/documents/marriage-certificate');
curl_setopt_array($request, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120, // above the API's 90 s extraction budget
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DOCSOCR_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'imageType' => 'url',
'imageUrl' => 'https://docsocr.com/samples/certidao-casamento-exemplo.jpg',
'requestId' => bin2hex(random_bytes(16)), // one id per document
]),
]);
$body = curl_exec($request);
if ($body === false) {
fwrite(STDERR, curl_error($request) . PHP_EOL);
exit(1);
}
$status = curl_getinfo($request, CURLINFO_RESPONSE_CODE);
$answer = json_decode($body, true);
if ($status !== 201 || empty($answer['success'])) {
fwrite(STDERR, "$status " . ($answer['errorCode'] ?? '') . ' ' . implode('; ', (array) ($answer['message'] ?? $answer['error'] ?? '')) . PHP_EOL);
exit(1);
}
// The spouses in the order the certificate prints them
echo $answer['data']['cônjuge_1']['nome_completo'], PHP_EOL;
echo $answer['data']['cônjuge_2']['nome_completo'], PHP_EOL;// Extract the hosted sample marriage certificate (fictitious data).
// Needs Java 17+ and DOCSOCR_API_KEY in the environment. Run: java MarriageCertificate.java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.UUID;
public class MarriageCertificate {
public static void main(String[] args) throws Exception {
String body = """
{
"imageType": "url",
"imageUrl": "https://docsocr.com/samples/certidao-casamento-exemplo.jpg",
"requestId": "%s"
}""".formatted(UUID.randomUUID()); // one id per document
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.docsocr.com/api/v1/documents/marriage-certificate"))
.timeout(Duration.ofSeconds(120)) // above the API's 90 s extraction budget
.header("Authorization", "Bearer " + System.getenv("DOCSOCR_API_KEY"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
// The answer is JSON: read data.cônjuge_1 and data.cônjuge_2 with your JSON library
System.out.println(response.body());
if (response.statusCode() != 201 || !response.body().contains("\"success\":true")) {
System.exit(1);
}
}
}// Extract the hosted sample marriage certificate (fictitious data).
// Needs .NET 8+ and DOCSOCR_API_KEY in the environment. Run: dotnet run MarriageCertificate.cs (.NET 10)
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(120) }; // above the API's 90 s extraction budget
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("DOCSOCR_API_KEY"));
var body = new JsonObject
{
["imageType"] = "url",
["imageUrl"] = "https://docsocr.com/samples/certidao-casamento-exemplo.jpg",
["requestId"] = Guid.NewGuid().ToString(), // one id per document
};
using var content = new StringContent(body.ToJsonString(), Encoding.UTF8, "application/json");
using var response = await http.PostAsync("https://api.docsocr.com/api/v1/documents/marriage-certificate", content);
using var answer = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
var root = answer.RootElement;
if ((int)response.StatusCode != 201 || !root.GetProperty("success").GetBoolean())
{
Console.Error.WriteLine($"{(int)response.StatusCode} {root}");
return 1;
}
// The spouses in the order the certificate prints them
var data = root.GetProperty("data");
Console.WriteLine(data.GetProperty("cônjuge_1").GetProperty("nome_completo").GetString());
Console.WriteLine(data.GetProperty("cônjuge_2").GetProperty("nome_completo").GetString());
return 0;Try it
Sends this request to the production API, with your key.
The key stays in this browser tab only, and goes only to the API. Create a key in the panel
Reading the prices…
Paste your API key to send.
{
"success": true,
"processingTimeMs": 7480,
"data": {
"documento": {
"tipo": "Certidão de Casamento",
"título": "CERTIDÃO DE CASAMENTO",
"forma": "breve relato"
},
"registro": {
"matrícula": "123456 01 55 2025 2 00034 045 0009876 12",
"livro": "34",
"folha": "45",
"termo": "9876"
},
"cônjuge_1": {
"nome_completo": "RAFAEL COSTA TESTE",
"nome_atual": "RAFAEL COSTA TESTE",
"cpf": "123.456.789-09",
"nome_habilitação": "RAFAEL COSTA TESTE",
"nome_após_casamento": "RAFAEL COSTA TESTE",
"data_nascimento": {
"dia": "12",
"mês": "05",
"ano": "1994"
},
"nacionalidade": "BRASILEIRA",
"estado_civil": "SOLTEIRO",
"estado_civil_código": "solteiro",
"município_naturalidade": "RECIFE",
"uf_naturalidade": "PE",
"genitores": "JOSÉ COSTA TESTE; MARIA COSTA TESTE",
"profissão": "",
"domicílio": ""
},
"cônjuge_2": {
"nome_completo": "JULIANA MENDES COSTA TESTE",
"nome_atual": "JULIANA MENDES COSTA TESTE",
"cpf": "987.654.321-00",
"nome_habilitação": "JULIANA MENDES TESTE",
"nome_após_casamento": "JULIANA MENDES COSTA TESTE",
"data_nascimento": {
"dia": "03",
"mês": "09",
"ano": "1996"
},
"nacionalidade": "BRASILEIRA",
"estado_civil": "SOLTEIRA",
"estado_civil_código": "solteiro",
"município_naturalidade": "OLINDA",
"uf_naturalidade": "PE",
"genitores": "PAULO MENDES TESTE; ANA MENDES TESTE",
"profissão": "",
"domicílio": ""
},
"casamento": {
"tipo": "civil",
"data_celebração": {
"texto_completo": "VINTE E DOIS DE MARÇO DE DOIS MIL E VINTE E CINCO",
"dia": "22",
"mês": "03",
"ano": "2025"
},
"local_celebração": "",
"celebrante": "",
"documentos_apresentados": "",
"regime_bens": "COMUNHÃO PARCIAL DE BENS",
"regime_bens_código": "comunhão parcial",
"data_registro": {
"texto_completo": "VINTE E DOIS DE MARÇO DE DOIS MIL E VINTE E CINCO",
"dia": "22",
"mês": "03",
"ano": "2025"
}
},
"observações": {
"averbações_anotações": "",
"anotações_cadastro": "",
"outras_informações": ""
},
"inteiro_teor": {
"texto": ""
},
"cartório": {
"nome": "CARTÓRIO DO 1º OFÍCIO DE REGISTRO CIVIL DE RECIFE - PE",
"cns": "123456",
"município": "RECIFE",
"uf": "PE",
"endereço": "RUA DO EXEMPLO, 100, BOA VISTA, CEP 50000-000",
"telefone": "",
"email": ""
},
"autenticação": {
"selo_digital": "",
"consulta_autenticidade": "",
"oficial_registro": "PEDRO EXEMPLO",
"assinante": "MARIANA EXEMPLO",
"cargo_assinante": "ESCREVENTE",
"data_emissão": "25/03/2025",
"número_papel": ""
}
},
"engine": "large",
"creditsCharged": 1.5
}