get-datahub-invoice-import
dci get-datahub-invoice-import <id>
Returns the status and result of one PDF invoice import. While status is processing, call again after a few seconds. The other statuses are final:
imported: records were written;dataset,datasetCreated,recordCountandinvoiceare set. An import whose records were later replaced by a newer import of the same invoice is also reported asimported, withoutrecordCount.duplicate: the invoice was already imported andforcewas not set;existingImportIdnames the earlier import. Nothing was written.needsReview: extraction worked but an automatic check blocked the import (seeerrorCode);invoiceholds what was read. Nothing was written. A DataHub Admin can fix and import it from the Invoice imports list in the DoiT console; to retry through the API, upload a corrected PDF.failed: nothing was written;errorCodeanderrorMessagesay why.
errorCode values and what to do:
not_an_invoice: the PDF is not an invoice. Upload an invoice PDF.no_line_items: no line items could be read. Upload a PDF that lists line items.unreadable: the PDF could not be read. Upload a clearer or text-based PDF.encrypted: the PDF is password-protected. Remove the password and upload again.too_many_pages: the PDF has more than 20 pages. Split it or upload a shorter invoice.content_blocked: the document was refused by content safety. Upload a different document.lines_do_not_reconcile: the line amounts do not add up to the invoice total (needsReview). Open it in the console to correct the lines.no_exchange_rate: no USD exchange rate exists for the invoice currency and date (needsReview). Open it in the console, or retry later.low_confidence: the vendor, invoice date, currency or total was read with low confidence (needsReview). Open it in the console to confirm the values.amount_far_above_total: a line amount is more than ten times the invoice total, which usually means a quantity was read as money (needsReview). Open it in the console, check the line against the PDF and import it; credit-heavy invoices whose lines add up can be imported as they are.replace_not_yet_available:forcewas used within 90 minutes of the earlier import. Resend after the time inretryAfter.invalid_dataset_name: thedatasetdoes not exist, or the dataset name is not valid (needsReview). Upload again with an existingdatasetor a validnewDatasetName.import_in_progress: another import of the same invoice was running at that moment (needsReview). Upload again shortly.unfinished_import: an earlier import of the same invoice was interrupted after some of its records were written, and must be finished first so the invoice is not counted twice (needsReview).errorMessagenames that import; finish it from the Invoice imports list in the DoiT console, then upload again withforceset totrueif this file should replace it.too_many_records: the invoice would create too many records (needsReview). Upload withcostDatingset toinvoiceDate, or split the invoice.invalid_invoice: the extracted invoice is not importable, for example a missing date or total (needsReview;failedwhen the PDF has more than 500 line items or an amount that is not a number). Open it in the console to correct it.import_partially_written: a write was interrupted after some records were written. Do not upload the invoice again: open the import from the Invoice imports list in the DoiT console and confirm it to finish the invoice. Until then, other imports of this invoice are refused withunfinished_import.cancelled: the import was cancelled in the console. Upload again if needed.internal_error: a temporary failure. Upload again.duplicate_invoice: seeduplicateabove.
Error responses have code and error; not_found (404) means no import with this id exists for the customer.
id— The import id returned when the invoice was uploaded or in the list of invoice imports.
Output
OK - The import.
By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.
| Field | Type | Description |
|---|---|---|
id | string | |
status | string | processing is the only non-final status. See getDatahubInvoiceImport for what each final status means. One of: "processing", "needsReview", "imported", "duplicate", "failed". |
errorCode | string | Why the import did not complete, or why it needs review. Present for duplicate and failed, and for needsReview when the reason is known. See getDatahubInvoiceImport for the values and what to do. |
errorMessage | string | Human-readable detail for errorCode. |
dataset | string | The dataset the records were written to. Present when status is imported. |
datasetCreated | boolean | true when the import created dataset. Present when status is imported. |
recordCount | integer | Number of records written. Present when status is imported. |
existingImportId | string | The earlier import of the same invoice. Present when status is duplicate. |
retryAfter | string (date-time) | When a forced replace becomes allowed. Present with errorCode replace_not_yet_available. |
invoice | object | The invoice as extracted from the PDF, or as confirmed when the import completed. |
invoice.vendor | string | |
invoice.invoiceNumber | string | |
invoice.invoiceDate | string (date) | |
invoice.currency | string | ISO 4217 currency code of the invoice. |
invoice.total | number | |
invoice.lines | array of object | |
invoice.lines[].description | string | |
invoice.lines[].type | string | One of: "charge", "discount", "credit", "tax". |
invoice.lines[].amount | number | Amount in the invoice currency. Discounts and credits are negative. |
invoice.lines[].includedInOtherLines | boolean | true for a tax or levy already included in the other lines' prices. Such a line is shown but not imported. |
suggestedIntegration | string | Key of the DoiT integration whose provider issued this invoice, for example xai, when one exists. Connecting that integration imports this vendor's costs daily and in more detail than an invoice; if it is already connected, importing the invoice may count the same costs twice. Absent when no integration matches. The key is not filtered by the customer's entitlements, so the integration may not be available to this customer. It never affects the import. |
createdAt | string (date-time) | |
createdBy | string | Email of the user, or identifier of the service account, that uploaded the invoice. |
Example response (--output json)
{
"id": "8f2c1a7e4b9d",
"status": "imported",
"dataset": "Example Vendor",
"datasetCreated": true,
"recordCount": 31,
"invoice": {
"vendor": "Example Vendor",
"invoiceNumber": "INV-1042",
"invoiceDate": "2026-11-01",
"currency": "EUR",
"total": 120,
"lines": [
{
"description": "Platform plan",
"type": "charge",
"amount": 100,
"includedInOtherLines": false
},
{
"description": "VAT 20%",
"type": "tax",
"amount": 20,
"includedInOtherLines": false
}
]
},
"createdAt": "2026-11-22T10:00:00Z",
}
Raw JSON schema
{
"type": "object",
"required": [
"id",
"status",
"createdAt",
"createdBy"
],
"properties": {
"id": {
"type": "string",
"example": "8f2c1a7e4b9d"
},
"status": {
"type": "string",
"enum": [
"processing",
"needsReview",
"imported",
"duplicate",
"failed"
],
"description": "`processing` is the only non-final status. See `getDatahubInvoiceImport` for what each final status means."
},
"errorCode": {
"type": "string",
"description": "Why the import did not complete, or why it needs review. Present for `duplicate` and `failed`, and for `needsReview` when the reason is known. See `getDatahubInvoiceImport` for the values and what to do.",
"example": "lines_do_not_reconcile"
},
"errorMessage": {
"type": "string",
"description": "Human-readable detail for `errorCode`."
},
"dataset": {
"type": "string",
"description": "The dataset the records were written to. Present when `status` is `imported`.",
"example": "Example Vendor"
},
"datasetCreated": {
"type": "boolean",
"description": "`true` when the import created `dataset`. Present when `status` is `imported`."
},
"recordCount": {
"type": "integer",
"description": "Number of records written. Present when `status` is `imported`.",
"example": 31
},
"existingImportId": {
"type": "string",
"description": "The earlier import of the same invoice. Present when `status` is `duplicate`."
},
"retryAfter": {
"type": "string",
"format": "date-time",
"description": "When a forced replace becomes allowed. Present with `errorCode` `replace_not_yet_available`."
},
"invoice": {
"type": "object",
"description": "The invoice as extracted from the PDF, or as confirmed when the import completed.",
"properties": {
"vendor": {
"type": "string",
"example": "Example Vendor"
},
"invoiceNumber": {
"type": "string",
"example": "INV-1042"
},
"invoiceDate": {
"type": "string",
"format": "date",
"example": "2026-11-01"
},
"currency": {
"type": "string",
"description": "ISO 4217 currency code of the invoice.",
"example": "EUR"
},
"total": {
"type": "number",
"example": 120
},
"lines": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string",
"example": "Platform plan"
},
"type": {
"type": "string",
"enum": [
"charge",
"discount",
"credit",
"tax"
]
},
"amount": {
"type": "number",
"description": "Amount in the invoice currency. Discounts and credits are negative.",
"example": 100
},
"includedInOtherLines": {
"type": "boolean",
"description": "`true` for a tax or levy already included in the other lines' prices. Such a line is shown but not imported."
}
}
}
}
}
},
"suggestedIntegration": {
"type": "string",
"description": "Key of the DoiT integration whose provider issued this invoice, for example `xai`, when one exists. Connecting that integration imports this vendor's costs daily and in more detail than an invoice; if it is already connected, importing the invoice may count the same costs twice. Absent when no integration matches. The key is not filtered by the customer's entitlements, so the integration may not be available to this customer. It never affects the import.",
"example": "xai"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"createdBy": {
"type": "string",
"description": "Email of the user, or identifier of the service account, that uploaded the invoice.",
}
}
}
Errors
On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.
HTTP status to exit code mapping
| HTTP status | Exit code | Error code | Meaning |
|---|---|---|---|
| 401 | 10 | AUTHENTICATION_FAILED | Not signed in, or the API token is invalid. Run dci login or check DCI_API_KEY. |
| 403 | 11 | PERMISSION_DENIED | The DoiT user or the active customer context does not have access. |
| 404 | 20 | RESOURCE_NOT_FOUND | The requested resource does not exist. Check the identifier argument. |
| 500 | 40 | API_SERVER_ERROR | The API failed to process the request. Retryable; contact DoiT support if it persists. |
Related
- create-datahub-dataset — Create dataset
- create-datahub-invoice-import — Import a PDF invoice
- delete-datahub-dataset — Delete a dataset
- delete-datahub-datasets — Delete datasets
- delete-datahub-events-by-filter — Delete specific events
- export-datahub-dataset-records — Export dataset records
- get-datahub-dataset — Retrieve a dataset
- import-datahub-provider-records — Import provider-native records
- ingest-datahub-events — Ingest JSON
- ingest-datahub-events-csv — Ingest CSV file
- list-datahub-datasets — List datasets
- list-datahub-invoice-imports — List invoice imports
- update-datahub-dataset — Update dataset
- API reference: GET /datahub/v1/invoice-imports/{id}
Aliases: getdatahubinvoiceimport