Skip to content

API reference

Test a mapping on every sample

Mappings API

POST/v1/mappings/tests

Runs a draft mapping config over every sample file you send and says, per sample, whether it passed. Use it before you freeze a config. A sample passes when the config reads the whole file and maps every invoice in it, exactly as a frozen config reads a file at run time. A sample with no invoice in it fails. Send the draft config itself, not a stored version. It is checked the same way as when you freeze it. Nothing is stored and nothing is validated. A mapped invoice is well-formed, not compliant.

Request body

application/json, required

  • configobjectRequired

    The draft mapping config, exactly as the reviewer sees it. It must say how to read a file (input).

  • samplesarray of objectRequired

    The sample files, each read with the config's input block. The answer keeps their order.

    Show 2 child fields
    • namestringRequired

      The file's name, echoed in the answer.

    • datastring (byte)Required

      The file, base64-encoded. All samples together may be 10 MB of files, whatever the base64 adds.

Status codes

Status Meaning
200 {tested, passed, failed, samples}. Each entry of samples is {name, passed} and: - invoices: how many invoices the file held, when it could be read. - unreadable: the reader’s sentence, when the file could not be read the way the config says. - unmapped: per invoice that could not be mapped, its number from 1, the fields that stopped it and the values waiting for a person. A failed sample is a normal answer, not an error.
400 The body is not JSON (invalid_json), the config does not load (invalid_mapping_config), the config reads no file (config_reads_no_file), or no sample has a name and its bytes (no_samples).
401 No usable credential was sent (invalid_credentials).
413 The samples are larger than 10 MB together (document_too_large), or one holds more than one request may carry once read (file_too_large_to_read). Nothing was tested.
POST/v1/mappings/tests
Example
curl -X POST https://api.certinvo.com/v1/mappings/tests \
  -H "Authorization: Bearer $CERTINVO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @body.json
import { readFile } from 'node:fs/promises'

const response = await fetch(`https://api.certinvo.com/v1/mappings/tests`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CERTINVO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: await readFile('body.json'),
})
console.log(response.status, await response.json())
import os

import requests

response = requests.post(
    "https://api.certinvo.com/v1/mappings/tests",
    headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}", "Content-Type": "application/json"},
    data=open("body.json", "rb"),
)
print(response.status_code, response.text)
200
No response body.
Success response
POST
/v1/mappings/tests
Test a mapping on every sample
All
›AuthenticationRequiredBearerAuth

Provide your API key in the Authorization: Bearer <key> header. Keys are stored locally in your browser.

›Headers2
›Bodyapplication/json
›Code Snippet
curl -X POST "https://api.certinvo.com/v1/mappings/tests" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "config": {},
  "samples": [
    {
      "name": "string",
      "data": "string"
    }
  ]
}...'
Response

No request sent yet

Configure parameters and click Send to view the response.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close