The billing API manages clinic invoices, payment tracking, and integration with Costa Rica’s Ministerio de Hacienda electronic billing system. Invoices can be created in draft state and updated as payments are received or as the Hacienda validation process progresses. All endpoints require a validDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/FerchoSG/healthcare-web/llms.txt
Use this file to discover all available pages before exploring further.
Authorization bearer token and x-clinic-id header.
GET /billing/invoices
Retrieve all invoices for the active clinic. Response —Invoice[]
UUID of the invoice.
UUID of the owning clinic.
UUID of the billed patient.
UUID of the linked appointment, or
null.Hacienda-assigned consecutive document number, populated after submission.
Hacienda 50-digit numeric key (
clave numérica), populated after acceptance.Total invoice amount in cents (CRC colones).
Free-text description of the service billed.
Hacienda e-billing status. One of
DRAFT, ACCEPTED, or REJECTED.Payment collection status. One of
PAID, UNPAID, or PARTIAL.Payment method used. One of
SINPE_MOVIL, TARJETA, EFECTIVO, or TRANSFERENCIA. null when payment has not been received.Transaction reference number (e.g., SINPE confirmation code).
Amount actually paid, in cents. Used for partial payments.
ISO 8601 timestamp of when payment was received.
Internal notes about the invoice.
URL to the PDF version of the invoice.
URL to the Hacienda-compliant XML document.
ISO 8601 creation timestamp.
ISO 8601 last-updated timestamp.
Linked appointment summary, or
null.POST /billing/invoices
Create a new invoice. Newly created invoices start withhacienda_status: DRAFT until they are submitted to Hacienda.
Request body
UUID of the patient being billed.
Total amount to bill, in cents (CRC colones). For example,
1500000 represents ₡15,000.00.UUID of the appointment to associate with this invoice.
Human-readable description of the service rendered.
Initial payment status. One of
PAID, UNPAID, or PARTIAL.Payment method. One of
SINPE_MOVIL, TARJETA, EFECTIVO, or TRANSFERENCIA.Transaction reference number (e.g., SINPE confirmation code).
Amount already paid, in cents. Used for partial payments.
ISO 8601 timestamp of when the payment was received.
Internal notes for clinic staff.
Invoice
The newly created invoice object. See field definitions in GET /billing/invoices above.
PATCH /billing/invoices/:id
Update an existing invoice. Use this endpoint to record payments, correct amounts, or update Hacienda-related fields after processing. Path parametersUUID of the invoice to update.
Link or re-link to a different appointment.
Updated total amount in cents.
Updated service description.
Updated payment status:
PAID, UNPAID, or PARTIAL.Updated payment method:
SINPE_MOVIL, TARJETA, EFECTIVO, or TRANSFERENCIA.Updated transaction reference.
Updated paid amount in cents.
ISO 8601 payment timestamp, or
null to clear.Updated internal notes.
Invoice
The updated invoice object.
Hacienda integration
CitaBox integrates with Costa Rica’s Ministerio de Hacienda electronic billing (comprobantes electrónicos). Invoices start as
DRAFT and are submitted to Hacienda asynchronously. The hacienda_status field reflects the result of that submission.- DRAFT — invoice has not yet been submitted to Hacienda.
- ACCEPTED — Hacienda accepted the document. The
hacienda_consecutiveandnumeric_keyfields are populated. - REJECTED — Hacienda rejected the document. Check
notesfor the rejection reason.
pdf_url and xml_url fields are populated by the Hacienda submission process and should not be set manually.