/v1/mappings/testsRuns 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
inputblock. 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. |
/v1/mappings/testscurl -X POST https://api.certinvo.com/v1/mappings/tests \
-H "Authorization: Bearer $CERTINVO_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @body.jsonimport { 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)