/v1/data-files/payments/importsMarks every new row’s invoice paid, in one step: its history gets api:paid once, with the row’s paidDate. Invalid rows are not imported; the answer names them again. Refused with 409 list_changed when an invoice was marked paid since the preview. Preview the file again. Any credential may call this, as for POST /v1/invoice-events.
Request body
application/json, required
- namestring
- datastring (byte)Required
The file as base64, at most 10 MB decoded.
- basedOnstringRequired
The fingerprint the preview answered.
Response
A 200 answer carries these fields.
- basedOnstringRequired
The paid invoices the preview was made against, as a fingerprint: it changes when an invoice is marked paid.
- countsobjectRequired
Show 4 child fields
- newintegerRequired
- changedintegerRequired
- sameintegerRequired
- invalidintegerRequired
- rowsarray of objectRequired
Show 7 child fields
- rowintegerRequired
The row's line in the file
- statusstringRequiredOne of
new,changed,same,invalid. - columnstring
An invalid row's column.
- messagestring
Why an invalid row cannot be imported.
- reasonobject
Why an invalid row cannot be imported, as a code, the way an error's
reasonsays it;fieldis the row's column.Show 2 child fields
- codestringRequired
- valuesobjectRequired
- invoiceNumberstringRequired
- paidDatestringRequired
The day as
YYYY-MM-DD; for asamerow, the day it was paid already; for an invalid row, as written.
- savedintegerRequired
How many invoices were marked paid.
Status codes
| Status | Meaning |
|---|---|
200 |
What was written. |
400 |
The body was refused, or the file is no payments file (invalid_data_file, invalid_json). Nothing was written. |
401 |
No usable credential was sent (invalid_credentials). |
409 |
The paid invoices changed since the preview (list_changed). Nothing was written. |
501 |
|
502 |
The engine could not run, so nothing was written (engine_unavailable). |
/v1/data-files/payments/importscurl -X POST https://api.certinvo.com/v1/data-files/payments/imports \
-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/data-files/payments/imports`, {
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/data-files/payments/imports",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}", "Content-Type": "application/json"},
data=open("body.json", "rb"),
)
print(response.status_code, response.text){
"basedOn": "string",
"counts": {
"new": 0,
"changed": 0,
"same": 0,
"invalid": 0
},
"rows": [
{
"row": 0,
"status": "new",
"column": "string",
"message": "string",
"reason": {
"code": "string",
"values": {}
},
"invoiceNumber": "string",
"paidDate": "string"
}
],
"saved": 0
}