Skip to content

API reference

Add samples to a kept draft

Mappings API

POST/v1/mappings/drafts/{id}/samples

{samples: [{name, data}]} join the draft’s corpus. The draft is made again from every sample, and every decision is applied again; one that no longer applies is named in notApplied. A sample whose bytes the draft holds already, or that is sent twice, is not added and is named in sameFile, {name, sameAs}.

Path parameters

  • idstring (uuid)Required

    The draft's id, as POST /v1/mappings/drafts answered it.

Request body

application/json, required

  • samplesarray of objectRequired
    Show 2 child fields
    • namestringRequired
    • datastring (byte)Required

      The file, base64-encoded. All the draft's samples together may be 10 MB of files.

Status codes

Status Meaning
200 The draft, as GET /v1/mappings/drafts/{id} answers it.
400 No sample has a name and its bytes (no_samples), or the body is not JSON (invalid_json).
401 No usable credential was sent (invalid_credentials).
404 This company has no such draft (unknown_mapping_draft).
409 mapping_draft_finalized: the draft is finalized and never changes.
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 kept.
422 The samples are more than one layout (several_sources, with detail.groups), the samples are not one source (not_one_source), a sample is already an e-invoice (already_an_invoice), cannot be read (unreadable_file), or cannot be profiled (unprofilable_sample). Nothing was kept.
503 The profiler did not answer (profiler_unavailable). Nothing is wrong with the samples.
POST/v1/mappings/drafts/{id}/samples
Example
curl -X POST https://api.certinvo.com/v1/mappings/drafts/$DRAFT_ID/samples \
  -H "Authorization: Bearer $CERTINVO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @body.json
import { readFile } from 'node:fs/promises'

const draftId = '3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a'

const response = await fetch(`https://api.certinvo.com/v1/mappings/drafts/${draftId}/samples`, {
  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

draft_id = "3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a"

response = requests.post(
    f"https://api.certinvo.com/v1/mappings/drafts/{draft_id}/samples",
    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/drafts/{id}/samples
Add samples to a kept draft
All
›AuthenticationRequiredBearerAuth

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

›Variables1
›Headers2
›Bodyapplication/json
›Code Snippet
curl -X POST "https://api.certinvo.com/v1/mappings/drafts/{id}/samples" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "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