Skip to content

HubfiscalUpdateDocument

Updates one or more fields of an existing document in the Hub Fiscal database. The document can be identified by its internal Hub ID, the external entity ID (Shopify order ID) or the order number. Only fields with a value are updated — empty fields are ignored to prevent overwriting existing data.

Typical use cases:

  • Update status after a fiscal provider responds
  • Attach the ticket HTML/PDF after it becomes available
  • Record error messages when fiscalization fails
  • Update fiscal document number after provider assigns it
FieldTypeRequiredDescription
credentials_idcredentialsYesHub Fiscal SQL Server (MSSQL) credential
document_idtextNoInternal Hub Fiscal document ID
entity_idtextNoExternal entity ID (Shopify order ID)
order_numbertextNoVisible order number (e.g. PT14684)
statusselectNoNew status: pending, processing, completed, failed, voided
fiscal_providertextNoFiscal provider name
fiscal_doc_idtextNoDocument ID in fiscal provider
fiscal_doc_numbertextNoInvoice number from fiscal provider
ticket_htmltextareaNoTicket HTML content. Also reads from data.ticket_html, data.html or data.document.html
ticket_pdftextareaNoTicket PDF in base64
contact_nametextNoContact name
contact_niftextNoContact tax number (NIF)
contact_emailtextNoContact email
total_nettextNoNet total
total_taxtextNoTax total
total_grosstextNoGross total
error_messagetextareaNoError message (for failed documents)
timeouttextNoTimeout in milliseconds (default: 30000)

At least one identifier is required: document_id, entity_id or order_number.

Uses the same credential type as HubfiscalCreateDocument (hubfiscalCreateDocument provider).

{
"success": true,
"rows_affected": 1,
"document": {
"id": 42,
"entity_id": "6702987051221",
"order_number": "PT14684",
"status": "completed",
"fiscal_doc_number": "FT 2026/1",
"total_gross": 19.90
},
"fields_updated": ["status", "fiscal_doc_number", "ticket_html"],
"message": "Documento actualizado (3 campos)"
}

Update status and attach ticket after Bill.pt responds:

{
"credentials_id": "10",
"entity_id": "{{id}}",
"status": "completed",
"fiscal_doc_number": "{{document_number}}",
"ticket_html": "{{document.html}}"
}

Mark a document as failed:

{
"credentials_id": "10",
"order_number": "PT14684",
"status": "failed",
"error_message": "Bill.pt API timeout after 30s"
}
  • Only fields with non-empty values are updated; empty fields are ignored
  • The update is logged in the Hub Fiscal logs table automatically
  • If document_id is provided, it takes priority over entity_id and order_number
  • The ticket_pdf field accepts base64 input and converts it to binary for storage
  • Returns rows_affected: 0 if the document was not found (no error thrown)