{"openapi":"3.1.0","info":{"title":"API de Comprobantes Fiscales Electrónicos (e-CF)","description":"API de Comprobantes Fiscales Electrónicos (e-CF) para la DGII — República Dominicana.\n\n## Autenticación\nCada llamada requiere el header `x-api-key` con la API key de su empresa\n(validada en el API Gateway).\n\n## Ambientes\nSeleccione el ambiente de la DGII con el header `env`:\n\n| `env` | Uso | URL base |\n|-------|-----|----------|\n| `TesteCF` | Pruebas (sandbox) | `https://test.fixcal.do` |\n| `CerteCF` | Certificación | `https://test.fixcal.do` |\n| `eCF` | Producción | `https://api.fixcal.do` |\n","version":"3.0"},"paths":{"/obtain_token":{"get":{"tags":["Authentication"],"summary":"Obtener token de autenticación de la DGII","description":"Authenticate with DGII and retrieve a JWT token for API requests.\n\n    This endpoint handles the complete DGII authentication flow:\n    1. Request seed from DGII\n    2. Sign seed with certificate\n    3. Validate signed seed and receive token\n    4. Cache token in Redis (expires < 1 hour)\n\n    **Performance**: Token is cached in Redis to minimize DGII authentication calls.\n    Cached tokens are returned immediately without re-authenticating.\n\n    **Required For**: All DGII API operations (invoice submission, status queries, etc.)","operationId":"obtain_token_obtain_token_get","parameters":[{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successfully obtained authentication token","content":{"application/json":{"schema":{},"example":{"token":"<jwt-token-from-dgii>","expires_in":3600,"token_type":"Bearer"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"502":{"description":"Invalid response from DGII authentication service"},"503":{"description":"Authentication service temporarily unavailable"}}}},"/invoices/":{"get":{"tags":["Invoice Query"],"summary":"Get Invoices","description":"Retrieve invoices by RNC and date range.\n\nArgs:\n    rnc_issuing: Taxpayer Identification Number of the issuer (header).\n    start_date: Start date in DD-MM-YYYY format (header).\n    end_date: End date in DD-MM-YYYY format (header).\n    env: Target DGII environment (TesteCF, CerteCF, ECF) provided via header.\n    limit: Maximum number of rows to return (query param).\n    offset: Number of rows to skip for pagination (query param).\n    db: Database session dependency.\n\nReturns:\n    InvoicesList: Structured response with invoices list and metadata.","operationId":"get_invoices_invoices__get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Max rows to return","default":200,"title":"Limit"},"description":"Max rows to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Rows to skip","default":0,"title":"Offset"},"description":"Rows to skip"},{"name":"rnc-issuing","in":"header","required":true,"schema":{"type":"string","title":"Rnc-Issuing"}},{"name":"start-date","in":"header","required":true,"schema":{"type":"string","title":"Start-Date"}},{"name":"end-date","in":"header","required":true,"schema":{"type":"string","title":"End-Date"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoicesList"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/count/":{"get":{"tags":["Invoice Query"],"summary":"Count Invoices","description":"Endpoint to count the total number of invoices issued by a specific RNC\nwithin a given date range.\n\nThe range filters on created_at (when the invoice hit our API), not the\nfiscal date_issued declared in the XML — used for billing our own clients\nby throughput, so an invoice dated 31-Dec but submitted 1-Jan counts for January.\n\nArgs:\n    rnc_issuing: The RNC of the issuer (header).\n    start_date: Start date in DD-MM-YYYY format (header).\n    end_date: End date in DD-MM-YYYY format (header).\n    env: Target DGII environment (TesteCF, CerteCF, ECF) provided via header.\n    db: Database session dependency.\n\nReturns:\n    InvoiceCountResponse: Response with issuer RNC, total invoices, and date range.","operationId":"count_invoices_invoices_count__get","parameters":[{"name":"rnc-issuing","in":"header","required":true,"schema":{"type":"string","title":"Rnc-Issuing"}},{"name":"start-date","in":"header","required":true,"schema":{"type":"string","title":"Start-Date"}},{"name":"end-date","in":"header","required":true,"schema":{"type":"string","title":"End-Date"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceCountResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/aggregate/":{"get":{"tags":["Invoice Query"],"summary":"Aggregate Invoices","description":"Pre-aggregated invoice totals + month/type/status/top-client breakdowns for a\ndate range — computed via SQL GROUP BY, never row-level data. Powers the\nportal's Dashboard and Reportes charts without fetching (and capping) raw rows.\n\nArgs:\n    rnc_issuing: RNC of the issuer (header).\n    start_date: Start date in DD-MM-YYYY format (header).\n    end_date: End date in DD-MM-YYYY format (header).\n    env: Target DGII environment (TesteCF, CerteCF, ECF) provided via header.\n    top_clients_limit: Max rows in top_clients (query param).\n    db: Database session dependency.\n\nReturns:\n    InvoiceAggregateResponse: totals plus by_month/by_type/by_status/top_clients.","operationId":"aggregate_invoices_invoices_aggregate__get","parameters":[{"name":"top_clients_limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"description":"Max top clients to return","default":10,"title":"Top Clients Limit"},"description":"Max top clients to return"},{"name":"rnc-issuing","in":"header","required":true,"schema":{"type":"string","title":"Rnc-Issuing"}},{"name":"start-date","in":"header","required":true,"schema":{"type":"string","title":"Start-Date"}},{"name":"end-date","in":"header","required":true,"schema":{"type":"string","title":"End-Date"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceAggregateResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoice-status/{track_id}":{"get":{"tags":["Invoice Query"],"summary":"Get Invoice Status by Track ID","description":"Query DGII for invoice status using the Track ID received during submission.\n\n    After submitting a regular invoice (e-CF) via `/submit_ecf` or `/fe_Submit`,\n    DGII returns a trackId. Use this endpoint to check if the invoice was:\n    - **Aceptado**: Successfully processed by DGII\n    - **Rechazado**: Rejected (check messages for reason)\n    - **EnProceso**: Still processing\n    - **No encontrado**: Not found in DGII system\n\n    **Flow**: Submit → Receive trackId → Wait 5-10s → Query status\n\n    **Data Source**: Queries DGII API first, then caches result in database.","operationId":"get_invoice_status_invoice_status__track_id__get","parameters":[{"name":"track_id","in":"path","required":true,"schema":{"type":"string","title":"Track Id"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Invoice status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceStatusResponse"},"example":{"track_id":"ad2a4199-a18d-462e-aaff-8780aff30c62","status":"Aceptado","code":"200","rnc":"131793916","date_received":"2025-01-15T10:30:00Z","messages":[{"codigo":"200","valor":"Documento aceptado"}]}}}},"401":{"description":"Authentication with DGII failed"},"404":{"description":"Track ID not found in DGII system"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/query-consumption-invoice/":{"get":{"tags":["Invoice Query"],"summary":"Query Consumption Invoice","description":"Endpoint to query the status of a consumption invoice (RFCE) in the system or with the DGII.\n\nArgs:\n    query: Query parameters containing rnc_issuing, encf, security_code, and optionally rnc_buyer.\n    env: Target DGII environment (TesteCF, CerteCF, ECF) provided via header.\n    db: Database session dependency.\n    redis_client: Redis client dependency for authentication token caching.\n\nReturns:\n    ConsumptionInvoiceStatusResponse: Response with RNC, ENCF, and current status.","operationId":"query_consumption_invoice_query_consumption_invoice__get","parameters":[{"name":"rnc_issuing","in":"query","required":true,"schema":{"type":"string","title":"Rnc Issuing"}},{"name":"encf","in":"query","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"security_code","in":"query","required":true,"schema":{"type":"string","title":"Security Code"}},{"name":"rnc_buyer","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rnc Buyer"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsumptionInvoiceStatusResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{encf}":{"get":{"tags":["Invoice Query"],"summary":"Get Invoice","description":"Look up a single invoice by its exact eNCF.\n\nExists so a caller that needs one specific invoice (e.g. to resolve its\nxml_gcs_path for a download) doesn't have to page through GET /invoices/\nwith an artificially wide date range just to find one row.\n\nArgs:\n    encf: Electronic fiscal receipt number (path parameter).\n    rnc_issuing: RNC of the issuer (header).\n    env: Target DGII environment (TesteCF, CerteCF, eCF) provided via header.\n    db: Database session dependency.\n\nReturns:\n    Invoice: The matching invoice.","operationId":"get_invoice_invoices__encf__get","parameters":[{"name":"encf","in":"path","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"rnc-issuing","in":"header","required":true,"schema":{"type":"string","title":"Rnc-Issuing"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/trackids/{encf}":{"get":{"tags":["Invoice Query"],"summary":"Get Trackids For Encf","description":"Retrieve all TrackIds for a given eNCF.\n\nWhen an invoice is resubmitted (due to timeout, rejection with reusable sequence,\nor correction), multiple TrackIds may exist. This endpoint returns all submission\nattempts for tracking and debugging purposes.\n\nArgs:\n    encf: Electronic fiscal receipt number (path parameter).\n    rnc_issuing: RNC of the issuer (header).\n    env: Target DGII environment (TesteCF, CerteCF, eCF) provided via header.\n    db: Database session dependency.\n\nReturns:\n    TrackIdsResponse: All TrackIds for the eNCF with submission details.","operationId":"get_trackids_for_encf_trackids__encf__get","parameters":[{"name":"encf","in":"path","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"rnc-issuing","in":"header","required":true,"schema":{"type":"string","title":"Rnc-Issuing"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackIdsResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/fe_Submit":{"post":{"tags":["Emission - Invoice Submission"],"summary":"Complete Invoice Submission Flow","description":"Complete e-CF emission flow: JSON → XML → Signing → DGII submission.\n\n## Routing logic\n- **Regular invoices** (TipoeCF 31-47, except 32 < RD$250,000): `/FacturasElectronicas`\n- **Consumo invoices** (TipoeCF 32, amount < RD$250,000): `/recepcion_fc/ecf`\n\n## When to use this endpoint\nWhen you have the invoice data in JSON and want full processing (conversion, signing, submission, and persistence) in a single request.\n\n## Alternatives\n- `/submit_ecf`: if you already have the signed XML for a regular invoice.\n- `/submit_fc`: if you already have the signed XML for a Consumo invoice.\n\n## Response fields\n- `status`: `\"Aceptado\"` | `\"Rechazado\"` | `\"EnProceso\"`\n- `xml`: signed XML of the document.\n- `qr_url`: DGII confirmation URL.\n- `trackId`: tracking ID (e-CF only; use it in `/invoice-status/{track_id}`).\n- `messages`: DGII messages with acceptance/rejection codes.\n\n## Note\n`password` and `certificate` are optional if the server manages the certificate.\n\nComplete end-to-end invoice submission: JSON → XML → Sign → Submit to DGII.\n\n    This is the primary endpoint for submitting electronic invoices. It handles:\n    1. JSON invoice conversion to DGII-compliant XML\n    2. Digital signature via signing service\n    3. Authentication with DGII\n    4. Automatic routing to correct DGII endpoint (e-CF or RFCE)\n    5. Database persistence and GCS storage\n    6. QR code confirmation URL generation\n\n    **Routing Logic:**\n    - Regular invoices (TipoeCF 31-47): Submitted to `/FacturasElectronicas`\n    - Consumer invoices (TipoeCF 32, < RD$250,000): Submitted to `/recepcionfc/ecf`\n\n    **Use This Endpoint When**: You have JSON invoice data and want complete processing.\n\n    **Alternative Endpoints**: Use `/submit_ecf` or `/submit_fc` if you already have signed XML.\n\n---\n\n## e-CF field reference\n\nThe complete document structure — Header, Goods/Services Detail, Subtotals, Discounts/Surcharges, Pagination, and Reference Information — with each field, its XML tag, type, length, and requirement per type, is documented in the **[e-CF Format Reference](/developers/formato-ecf)**.\n","operationId":"fe_submit_fe_Submit_post","parameters":[{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_fe_submit_fe_Submit_post"},"example":{"data":{"ECF":{"Encabezado":{"Version":"1.0","IdDoc":{"TipoeCF":"31","eNCF":"E310000000801","FechaVencimientoSecuencia":"31-12-2026","IndicadorMontoGravado":"0","TipoIngresos":"01","TipoPago":"1","TablaFormasPago":{"FormaDePago":{"FormaPago":"1","MontoPago":"7080.00"}}},"Emisor":{"RNCEmisor":"131793916","RazonSocialEmisor":"ISSUING COMPANY SRL","NombreComercial":"ISSUING COMPANY SRL","DireccionEmisor":"AVE. TIRADENTES, NACO, DISTRITO NACIONAL","Municipio":"010101","Provincia":"010000","TablaTelefonoEmisor":{"TelefonoEmisor":"809-472-7676"},"CorreoEmisor":"facturacion@empresa.com","FechaEmision":"15-01-2025"},"Comprador":{"RNCComprador":"131880681","RazonSocialComprador":"BUYING COMPANY SRL","ContactoComprador":"JUAN PEREZ","CorreoComprador":"compras@compradora.com"},"Totales":{"MontoGravadoTotal":"6000.00","MontoGravadoI1":"6000.00","ITBIS1":"18","TotalITBIS":"1080.00","TotalITBIS1":"1080.00","MontoTotal":"7080.00"}},"DetallesItems":{"Item":{"NumeroLinea":"1","IndicadorFacturacion":"1","NombreItem":"Consulting service","IndicadorBienoServicio":"2","CantidadItem":"15.00","UnidadMedida":"31","PrecioUnitarioItem":"400.00","MontoItem":"6000.00"}},"FechaHoraFirma":"15-01-2025 10:30:00"}}}}}},"responses":{"200":{"description":"Invoice successfully submitted to DGII","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResponse"},"example":{"status":"Aceptado","xml":"<ECF>...</ECF>","qr_url":"https://ecf.dgii.gov.do/TesteCF/ConsultaTimbre?...","trackId":"ad2a4199-a18d-462e-aaff-8780aff30c62","messages":[{"codigo":"200","valor":"Documento procesado"}]}}}},"400":{"description":"Invalid JSON or XML structure"},"401":{"description":"Authentication with DGII failed"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"503":{"description":"Signing or authentication service unavailable"}}}},"/submit_fc":{"post":{"tags":["Emission - Invoice Submission"],"summary":"Submit Consumer Invoice (RFCE)","description":"Submit a signed consumer invoice (RFCE) directly to DGII.\n\n    **Consumer Invoice (RFCE)** is for invoices under RD$250,000 and requires:\n    - TipoeCF: 32 (Factura de Consumo Electrónica)\n    - Signed XML in DGII format\n    - Valid authentication token\n\n    **Use This When**: You already have signed XML for a consumer invoice.\n    For complete workflow from JSON, use `/fe_Submit` instead.\n\n    **DGII Endpoint**: `/recepcionfc/ecf`\n\n    **Note**: RFCE submissions don't return a trackId (immediate acceptance/rejection).","operationId":"submit_fc_submit_fc_post","parameters":[{"name":"x-token","in":"header","required":true,"schema":{"type":"string","title":"X-Token"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/XmlItem"}}}},"responses":{"200":{"description":"Consumer invoice submitted to DGII","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RFCEResponse"},"example":{"status":"Aceptado","messages":[{"codigo":"200","valor":"Documento aceptado"}]}}}},"400":{"description":"Invalid XML structure or amount exceeds RD$250,000"},"401":{"description":"Invalid or expired authentication token"},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/submit_ecf":{"post":{"tags":["Emission - Invoice Submission"],"summary":"Submit Regular Invoice (e-CF)","description":"Sends an already-signed regular invoice (e-CF) directly to the DGII.\n\n## When to use this endpoint\nWhen you already have the signed XML in DGII format for a regular invoice (TipoeCF 31-47).\nFor the full flow from JSON, use `/fe_Submit`.\n\n## Target DGII endpoint\n`/FacturasElectronicas`\n\n## Status flow\n1. Send the invoice → receive `trackId`.\n2. Wait 5-10 seconds.\n3. Query the status with `/invoice-status/{track_id}`.\n4. The final status will be: `Aceptado`, `Rechazado`, or `EnProceso`.\n\nSubmit a signed regular invoice (e-CF) directly to DGII.\n\n    **Regular Invoice (e-CF)** is for standard business invoices (TipoeCF 31-47) and returns:\n    - TrackId: UUID for querying submission status\n    - DGII messages with acceptance/rejection codes\n\n    **Use This When**: You already have signed XML for a regular invoice.\n    For complete workflow from JSON, use `/fe_Submit` instead.\n\n    **DGII Endpoint**: `/FacturasElectronicas`\n\n    **Important**: After submission, use the trackId with `/invoice-status/{track_id}`\n    to query the final acceptance/rejection status (DGII processes asynchronously).","operationId":"submit_ecf_submit_ecf_post","parameters":[{"name":"x-token","in":"header","required":true,"schema":{"type":"string","title":"X-Token"}},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/XmlItem"},"example":{"xml":"<?xml version='1.0' encoding='utf-8'?><ECF><Encabezado><Version>1.0</Version><IdDoc><TipoeCF>31</TipoeCF><eNCF>E310000000801</eNCF><FechaVencimientoSecuencia>31-12-2026</FechaVencimientoSecuencia></IdDoc><Emisor><RNCEmisor>131793916</RNCEmisor><RazonSocialEmisor>ISSUING COMPANY SRL</RazonSocialEmisor><FechaEmision>15-01-2025</FechaEmision></Emisor><Comprador><RNCComprador>131880681</RNCComprador><RazonSocialComprador>BUYING COMPANY SRL</RazonSocialComprador></Comprador><Totales><MontoGravadoTotal>6000.00</MontoGravadoTotal><TotalITBIS>1080.00</TotalITBIS><MontoTotal>7080.00</MontoTotal></Totales></Encabezado><FechaHoraFirma>15-01-2025 10:30:00</FechaHoraFirma><Signature xmlns='http://www.w3.org/2000/09/xmldsig#'>...</Signature></ECF>"}}}},"responses":{"200":{"description":"Invoice submitted, trackId returned for status checking","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ECFResponse"},"example":{"trackId":"ad2a4199-a18d-462e-aaff-8780aff30c62","messages":[{"codigo":"200","valor":"Documento recibido"}]}}}},"400":{"description":"Invalid XML structure or missing required fields"},"401":{"description":"Invalid or expired authentication token"},"404":{"description":"Not found"},"408":{"description":"DGII timeout - invoice marked for retry"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/{encf}/xml":{"get":{"tags":["Emission - Invoice Submission"],"summary":"Download ECF Invoice XML","description":"Download the signed e-CF XML document from GCS.\n\n    This endpoint allows taxpayers to retrieve their previously submitted invoices.\n    Returns the digitally signed XML document in DGII format.\n\n    **Multi-tenant Support**:\n    - Use `issuer_rnc` query parameter to identify the client\n    - Required when multiple clients have the same eNCF\n\n    **Use Cases**:\n    - Re-download invoice for auditing\n    - Backup and archival\n    - Compliance verification\n\n    **Format**: Returns signed XML document (DGII standard e-CF schema)","operationId":"get_ecf_xml__encf__xml_get","parameters":[{"name":"encf","in":"path","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"issuer_rnc","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Issuer RNC to identify the client","title":"Issuer Rnc"},"description":"Issuer RNC to identify the client"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"e-CF XML document","content":{"application/xml":{"example":"<ECF>...</ECF>"}}},"400":{"description":"Ambiguous request - multiple clients have same eNCF"},"404":{"description":"Invoice not found for given eNCF"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/anecf/":{"post":{"tags":["ANECF - Invoice Cancellation"],"summary":"Create Anecf Submission","description":"Creates and optionally sends an ANECF (e-CF Cancellation) to the DGII.\n\n## ANECF — e-CF Cancellation\nOfficial document required by the DGII to cancel one or more electronic documents.\n\n## Use cases\n- Billing errors\n- Duplicate invoices\n- Customer returns\n- Voided transactions\n\n## Key fields\n- `detail_lines`: Array of 1 to 10 detail lines. Each line may contain multiple sequence ranges and mix different e-CF types.\n- `ecf_type`: e-CF type (31, 32, 33, 34, 41, 43, 44, 45, 46, 47).\n- `sequence_ranges`: eNCF ranges to cancel (may be a single number if `encf_desde == encf_hasta`).\n\n## Query parameter\n- `submit_to_dgii=true` (default): signs and sends to the DGII immediately.\n- `submit_to_dgii=false`: creates the ANECF locally without sending it.\n","operationId":"create_anecf_submission_anecf__post","parameters":[{"name":"submit_to_dgii","in":"query","required":false,"schema":{"type":"boolean","description":"Submit to DGII immediately","default":true,"title":"Submit To Dgii"},"description":"Submit to DGII immediately"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ANECFSubmissionCreate"},"example":{"version":"1.0","issuer_rnc":"131793916","total_encf_canceled":1,"generation_datetime":"2025-01-15T10:30:00Z","dgii_environment":"TesteCF","cancellation_reason":"Billing error","detail_lines":[{"line_number":1,"ecf_type":"31","total_encf_canceled":1,"sequence_ranges":[{"encf_desde":"E310000000801","encf_hasta":"E310000000801","quantity_canceled":1}]}]}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ANECFSubmissionResponse"},"example":{"id":17,"version":"1.0","issuer_rnc":"131793916","total_encf_canceled":1,"generation_datetime":"2025-01-15T10:30:00Z","detail_lines":[{"id":38,"line_number":1,"ecf_type":"31","total_encf_canceled":1,"sequence_ranges":[{"id":51,"encf_desde":"E310000000801","encf_hasta":"E310000000801","quantity_canceled":1}]}],"sent_to_dgii":true,"sent_at":"2025-01-15T10:30:05Z","dgii_status":"Aceptado","dgii_response":"Document processed successfully","xml_gcs_path":"gs://ecf-xmls/TesteCF/anecf/131793916/20250115-1.xml","xml_checksum":"a3f8b2c1d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1","xml_schema_version":"1.0","dgii_environment":"TesteCF","created_at":"2025-01-15T10:30:01Z","created_by":null,"cancellation_reason":"Billing error"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["ANECF - Invoice Cancellation"],"summary":"List Anecf Submissions","description":"List ANECF submissions for an issuer.\n\nArgs:\n    issuer_rnc: Issuer RNC to filter by\n    limit: Maximum number of results (default: 10, max: 100)\n    offset: Number of results to skip for pagination (default: 0)\n    db: Database session (injected)\n\nReturns:\n    List of ANECF submissions","operationId":"list_anecf_submissions_anecf__get","parameters":[{"name":"issuer_rnc","in":"query","required":true,"schema":{"type":"string","description":"Filter by issuer RNC","title":"Issuer Rnc"},"description":"Filter by issuer RNC"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum results to return","default":10,"title":"Limit"},"description":"Maximum results to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of results to skip","default":0,"title":"Offset"},"description":"Number of results to skip"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ANECFSubmissionResponse"},"title":"Response List Anecf Submissions Anecf  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/anecf/{submission_id}":{"get":{"tags":["ANECF - Invoice Cancellation"],"summary":"Get Anecf Submission","description":"Get ANECF submission by ID.\n\nArgs:\n    submission_id: ANECF submission ID\n    db: Database session (injected)\n\nReturns:\n    ANECF submission with all related data\n\nRaises:\n    APIError: If submission not found","operationId":"get_anecf_submission_anecf__submission_id__get","parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"integer","title":"Submission Id"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ANECFSubmissionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/anecf/{submission_id}/xml":{"get":{"tags":["ANECF - Invoice Cancellation"],"summary":"Get Anecf Xml","description":"Retrieve signed ANECF XML document from GCS.\n\nArgs:\n    submission_id: ANECF submission ID\n    db: Database session (injected)\n    gcs_storage: GCS storage service (injected)\n\nReturns:\n    XML document as application/xml response\n\nRaises:\n    APIError: If submission or XML not found","operationId":"get_anecf_xml_anecf__submission_id__xml_get","parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"integer","title":"Submission Id"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/fe/recepcion/api/ecf":{"post":{"tags":["Provider Reception"],"summary":"Receive Provider Invoice","description":"Receive provider invoice and return ARECF XML response.\n\n**DGII Endpoint**: `/fe/recepcion/api/ecf` (POST)\n\nThis endpoint implements the receiver side of the DGII emisor-receptor\ncommunication standard. When a provider sends us an invoice, we:\n1. Parse and validate the XML\n2. Store it in our system (DB + GCS)\n3. Generate and return an ARECF (Acuse de Recibo)\n\n**Flow:**\n```\nProvider POST → Parse → Validate → Store → Generate ARECF → Return XML\n```\n\n**Authentication:** Optional (Phase 7)\n- If `PROVIDER_AUTH_REQUIRED=true`, validates JWT token\n- Otherwise accepts all requests (for Phase 2)\n\n**Response:**\n- Content-Type: `application/xml`\n- Body: ARECF XML (signed in Phase 3)\n- Status: 200 OK (even for rejections - rejection is in ARECF Estado=1)\n\n**ARECF States:**\n- Estado=0: Invoice accepted (e-CF Recibido)\n- Estado=1: Invoice rejected (e-CF No Recibido + CodigoMotivo 1-4)\n\nArgs:\n    data: Uploaded XML file from provider\n    authorization: Optional JWT token (Bearer xxx)\n    db: Database session (dependency injection)\n    gcs_storage: GCS XML storage service (dependency injection)\n\nReturns:\n    Response with ARECF XML content\n\nRaises:\n    APIError: For unexpected errors (500)\n    Note: Invoice rejections return 200 with ARECF Estado=1\n\nExample:\n     # Provider sends invoice\n     POST /fe/recepcion/api/ecf\n     Content-Type: multipart/form-data\n     Authorization: Bearer token123 (optional)\n\n     [XML file]\n\n     # We respond with ARECF\n     HTTP/1.1 200 OK\n     Content-Type: application/xml\n\n     <?xml version=\"1.0\"?>\n     <ARECF>\n       <DetalleAcusedeRecibo>\n         <Estado>0</Estado>\n         ...\n       </DetalleAcusedeRecibo>\n     </ARECF>","operationId":"receive_provider_invoice_fe_recepcion_api_ecf_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_receive_provider_invoice_fe_recepcion_api_ecf_post"}}}},"responses":{"200":{"description":"Successful Response"},"404":{"description":"Not found"},"422":{"description":"Validation error - Invoice rejected"}}}},"/fe/recepcion/api/invoices":{"get":{"tags":["Provider Reception"],"summary":"List Received Invoices from Provider","description":"Retrieve invoices received from a specific provider.\n\n    Lists all e-CF invoices we have received from the specified provider,\n    including their commercial approval status (ACECF).\n\n    **Use Case:** View all invoices a specific provider has sent us\n    and check their approval status (pending, approved, rejected).\n\n    **Returns:**\n    - Invoice details (encf, amount, dates)\n    - Provider information\n    - Path to original XML document\n    - Commercial approval status","operationId":"get_received_invoices_fe_recepcion_api_invoices_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Max rows to return","default":200,"title":"Limit"},"description":"Max rows to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Rows to skip","default":0,"title":"Offset"},"description":"Rows to skip"},{"name":"provider-rnc","in":"header","required":true,"schema":{"type":"string","description":"RNC of the provider (issuer)","title":"Provider-Rnc"},"description":"RNC of the provider (issuer)"},{"name":"buyer-rnc","in":"header","required":true,"schema":{"type":"string","description":"RNC of the receiving company - required (tenancy scope)","title":"Buyer-Rnc"},"description":"RNC of the receiving company - required (tenancy scope)"},{"name":"start-date","in":"header","required":true,"schema":{"type":"string","description":"Start date in DD-MM-YYYY format","title":"Start-Date"},"description":"Start date in DD-MM-YYYY format"},{"name":"end-date","in":"header","required":true,"schema":{"type":"string","description":"End date in DD-MM-YYYY format","title":"End-Date"},"description":"End date in DD-MM-YYYY format"},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"List of received invoices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceivedInvoicesList"},"example":{"count":1,"provider_rnc":"101010101","start_date":"01-01-2024","end_date":"31-12-2024","env":"TesteCF","invoices":[{"encf":"E310000000123","ecf_type":"31","date_received":"2024-06-15T10:30:00Z","date_issued":"2024-06-15T08:00:00Z","total_amount":15000,"provider_rnc":"101010101","provider_name":"Suplidores ABC SRL","xml_gcs_path":"gs://bucket/received/...","approval_status":"approved","approval_datetime":"2024-06-16T14:00:00Z"}]}}}},"400":{"description":"Invalid request parameters"},"404":{"description":"No invoices found for the given criteria"},"422":{"description":"Validation error - Invoice rejected"}}}},"/fe/recepcion/api/invoices/all":{"get":{"tags":["Provider Reception"],"summary":"List All Received Invoices","description":"Retrieve all invoices received from any provider within a date range.\n\n    Returns every e-CF invoice received by your company in the specified period,\n    regardless of which provider sent it. Useful for a full overview of incoming\n    invoices and their commercial approval status.\n\n    **The date range is the RECEPTION window, not the invoice's fiscal date.**\n    `start-date`/`end-date` match on when the e-CF reached this API, so an invoice\n    whose FechaEmision is in August but that arrived in September is returned by a\n    September query — never by an August one. Each row still reports its own\n    `date_issued` (fiscal) and `date_received` alongside the amount.\n\n    **Headers required:**\n    - `start-date`: Start date in DD-MM-YYYY format\n    - `end-date`: End date in DD-MM-YYYY format\n    - `buyer-rnc`: RNC of the receiving company (tenancy scope)\n    - `env`: DGII environment (optional, defaults to TesteCF)","operationId":"get_all_received_invoices_endpoint_fe_recepcion_api_invoices_all_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Max rows to return","default":200,"title":"Limit"},"description":"Max rows to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Rows to skip","default":0,"title":"Offset"},"description":"Rows to skip"},{"name":"start-date","in":"header","required":true,"schema":{"type":"string","description":"Start date in DD-MM-YYYY format","title":"Start-Date"},"description":"Start date in DD-MM-YYYY format"},{"name":"end-date","in":"header","required":true,"schema":{"type":"string","description":"End date in DD-MM-YYYY format","title":"End-Date"},"description":"End date in DD-MM-YYYY format"},{"name":"buyer-rnc","in":"header","required":true,"schema":{"type":"string","description":"RNC of the receiving company - required (tenancy scope)","title":"Buyer-Rnc"},"description":"RNC of the receiving company - required (tenancy scope)"},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"List of all received invoices in the period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllReceivedInvoicesList"}}}},"400":{"description":"Invalid request parameters"},"404":{"description":"No invoices found for the given period"},"422":{"description":"Validation error - Invoice rejected"}}}},"/fe/recepcion/api/invoices/count":{"get":{"tags":["Provider Reception"],"summary":"Count Received Invoices","description":"Count all invoices received in a given period and return the total amount.\n\n    **Headers required:**\n    - `start-date`: Start date in DD-MM-YYYY format\n    - `end-date`: End date in DD-MM-YYYY format\n    - `buyer-rnc`: RNC of the receiving company (tenancy scope)\n\n    **Optional headers:**\n    - `env`: DGII environment (defaults to TesteCF)","operationId":"count_received_invoices_fe_recepcion_api_invoices_count_get","parameters":[{"name":"start-date","in":"header","required":true,"schema":{"type":"string","description":"Start date in DD-MM-YYYY format","title":"Start-Date"},"description":"Start date in DD-MM-YYYY format"},{"name":"end-date","in":"header","required":true,"schema":{"type":"string","description":"End date in DD-MM-YYYY format","title":"End-Date"},"description":"End date in DD-MM-YYYY format"},{"name":"buyer-rnc","in":"header","required":true,"schema":{"type":"string","description":"RNC of the receiving company - required (tenancy scope)","title":"Buyer-Rnc"},"description":"RNC of the receiving company - required (tenancy scope)"},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceivedInvoicesCountResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation error - Invoice rejected"}}}},"/fe/recepcion/api/invoices/{encf}":{"get":{"tags":["Provider Reception"],"summary":"Get Received Invoice","description":"Look up a single received invoice by its exact eNCF, scoped to the buyer's RNC.\n\nArgs:\n    encf: Electronic fiscal receipt number (path parameter).\n    buyer_rnc: RNC of the receiving company - required (tenancy scope) (header).\n    env: Target DGII environment (header).\n    db: Database session dependency.\n\nReturns:\n    ReceivedInvoice: The matching received invoice.","operationId":"get_received_invoice_fe_recepcion_api_invoices__encf__get","parameters":[{"name":"encf","in":"path","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"buyer-rnc","in":"header","required":true,"schema":{"type":"string","description":"RNC of the receiving company - required (tenancy scope)","title":"Buyer-Rnc"},"description":"RNC of the receiving company - required (tenancy scope)"},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceivedInvoice"}}}},"404":{"description":"Not found"},"422":{"description":"Validation error - Invoice rejected"}}}},"/fe/aprobacioncomercial/api/ecf":{"post":{"tags":["Commercial Approval Reception"],"summary":"Receive Commercial Approval","description":"Receive a buyer's commercial approval/rejection decision on an invoice we issued.\n\n**DGII Endpoint**: `/fe/aprobacioncomercial/api/ecf` (POST)\n\nUnlike /fe/recepcion/api/ecf, this endpoint does NOT return a signed XML\ndocument — DGII only requires `HTTP 200` (accepted) / `HTTP 400` (rejected).","operationId":"receive_commercial_approval_fe_aprobacioncomercial_api_ecf_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_receive_commercial_approval_fe_aprobacioncomercial_api_ecf_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Receive Commercial Approval Fe Aprobacioncomercial Api Ecf Post"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/fe/aprobacioncomercial/api/invoices/{encf}":{"get":{"tags":["Commercial Approval Reception"],"summary":"Get Commercial Approval Status","description":"Query a previously received commercial approval for one of our issued invoices.","operationId":"get_commercial_approval_status_fe_aprobacioncomercial_api_invoices__encf__get","parameters":[{"name":"encf","in":"path","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"issuer_rnc","in":"query","required":true,"schema":{"type":"string","description":"Our RNC as the invoice's issuer","title":"Issuer Rnc"},"description":"Our RNC as the invoice's issuer"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceivedCommercialApprovalResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/arecf/{encf}":{"get":{"tags":["ARECF Query"],"summary":"Get ARECF Receipt by eNCF","description":"Download the ARECF (Acuse de Recibo) acknowledgment receipt for a received invoice.\n\n    When a provider submits an invoice to our reception endpoint (`/fe/recepcion/api/ecf`),\n    we generate and return an ARECF. This endpoint allows providers to download that\n    ARECF again if needed.\n\n    **Security**: Requires issuer RNC query parameter that must match the original\n    invoice issuer. This prevents unauthorized access to receipts.\n\n    **Use Cases**:\n    - Provider needs to re-download ARECF\n    - Auditing and compliance purposes\n    - Backup and archival\n\n    **Format**: Returns signed XML document (DGII standard ARECF schema)","operationId":"get_aref_issuer_arecf__encf__get","parameters":[{"name":"encf","in":"path","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"issuer_rnc","in":"query","required":true,"schema":{"type":"string","description":"Provider RNC for security validation","title":"Issuer Rnc"},"description":"Provider RNC for security validation"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"ARECF XML document","content":{"application/xml":{"example":"<ARECF>...</ARECF>"}}},"400":{"description":"Missing or invalid issuer RNC parameter"},"404":{"description":"ARECF not found for given eNCF and issuer RNC"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/received-arecf/":{"get":{"tags":["ARECF Reception - Buyer Acknowledgments"],"summary":"List ARECFs returned by buyers","description":"List the acknowledgments buyers returned for invoices issued under `issuer_rnc`.","operationId":"list_received_arecf_received_arecf__get","parameters":[{"name":"issuer_rnc","in":"query","required":true,"schema":{"type":"string","description":"Our RNC as the invoice issuer","title":"Issuer Rnc"},"description":"Our RNC as the invoice issuer"},{"name":"encf","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by a single eNCF","title":"Encf"},"description":"Filter by a single eNCF"},{"name":"receipt_status","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1,"minimum":0},{"type":"null"}],"description":"0=Recibido, 1=No Recibido","title":"Receipt Status"},"description":"0=Recibido, 1=No Recibido"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum results to return","default":10,"title":"Limit"},"description":"Maximum results to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of results to skip","default":0,"title":"Offset"},"description":"Number of results to skip"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ReceivedAcknowledgmentResponse"},"title":"Response List Received Arecf Received Arecf  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/received-arecf/{encf}":{"get":{"tags":["ARECF Reception - Buyer Acknowledgments"],"summary":"Get the ARECF a buyer returned for one invoice","description":"Return the parsed acknowledgment, including why it failed validation if it did.","operationId":"get_received_arecf_received_arecf__encf__get","parameters":[{"name":"encf","in":"path","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"issuer_rnc","in":"query","required":true,"schema":{"type":"string","description":"Our RNC as the invoice issuer","title":"Issuer Rnc"},"description":"Our RNC as the invoice issuer"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceivedAcknowledgmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/received-arecf/{encf}/xml":{"get":{"tags":["ARECF Reception - Buyer Acknowledgments"],"summary":"Download the ARECF document a buyer returned","description":"Return the exact bytes the buyer sent back, as stored at delivery time.","operationId":"get_received_arecf_xml_received_arecf__encf__xml_get","parameters":[{"name":"encf","in":"path","required":true,"schema":{"type":"string","title":"Encf"}},{"name":"issuer_rnc","in":"query","required":true,"schema":{"type":"string","description":"Our RNC as the invoice issuer","title":"Issuer Rnc"},"description":"Our RNC as the invoice issuer"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/xml":{}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/acecf/":{"post":{"tags":["ACECF - Commercial Approval"],"summary":"Create Acecf Approval","description":"Creates and optionally sends an ACECF (Commercial Approval of e-CF) to the DGII.\n\n## ACECF — Commercial Approval\nOfficial document to approve or reject electronic invoices received from suppliers.\n\n## `approval_status` values\n- **1** — Commercially approved\n- **2** — Not commercially approved (requires `rejection_code`)\n\n## Rejection codes (`rejection_code`, only when `approval_status=2`)\n- **1** — Goods/services not received\n- **2** — Defective goods/services\n- **3** — Other (specify in `rejection_description`)\n\n## Query parameter\n- `submit_to_dgii=true` (default): signs, stores, and sends to the DGII in the same request.\n- `submit_to_dgii=false`: creates the local record without sending it yet.\n\n## Automatically generated fields\n`xml_gcs_path` and `xml_checksum` are generated by the service after storing the XML in GCS — do not include them in the request.\n\n## DGII deadline\nThe DGII requires the ACECF within the regulatory period after the invoice is received.\n","operationId":"create_acecf_approval_acecf__post","parameters":[{"name":"submit_to_dgii","in":"query","required":false,"schema":{"type":"boolean","description":"Submit to DGII immediately","default":true,"title":"Submit To Dgii"},"description":"Submit to DGII immediately"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ACECFApprovalRequest"},"example":{"ecf_document_id":6,"version":"1.0","issuer_rnc":"131793916","receiver_rnc":"131880681","encf":"E310000002353","approval_status":1,"approval_datetime":"2025-01-15T10:30:00Z","dgii_environment":"TesteCF","invoice_date_issued":"2025-01-15","invoice_total_amount":"7080.00"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ACECFApprovalResponse"},"example":{"id":42,"ecf_document_id":6,"version":"1.0","issuer_rnc":"131793916","receiver_rnc":"131880681","encf":"E310000002353","approval_status":1,"rejection_code":null,"rejection_description":null,"approval_datetime":"2025-01-15T10:30:00Z","dgii_environment":"TesteCF","invoice_date_issued":"2025-01-15","invoice_total_amount":"7080.00","xml_gcs_path":"gs://ecf-xmls/TesteCF/acecf/131880681/E310000002353.xml","xml_checksum":null,"xml_schema_version":"1.0","sent_to_dgii":true,"sent_to_dgii_at":"2025-01-15T10:30:05Z","dgii_submission_status":"submitted","dgii_response":"Aceptado","sent_to_issuer":false,"sent_to_issuer_at":null,"issuer_delivery_status":null,"issuer_delivery_error":null,"created_at":"2025-01-15T10:30:01Z"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["ACECF - Commercial Approval"],"summary":"List Acecf Approvals","description":"List ACECF approvals for a receiver.\n\nArgs:\n    receiver_rnc: Receiver RNC to filter by\n    limit: Maximum number of results (default: 10, max: 100)\n    offset: Number of results to skip for pagination (default: 0)\n    db: Database session (injected)\n\nReturns:\n    List of ACECF approvals","operationId":"list_acecf_approvals_acecf__get","parameters":[{"name":"receiver_rnc","in":"query","required":true,"schema":{"type":"string","description":"Filter by receiver RNC","title":"Receiver Rnc"},"description":"Filter by receiver RNC"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum results to return","default":10,"title":"Limit"},"description":"Maximum results to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of results to skip","default":0,"title":"Offset"},"description":"Number of results to skip"},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ACECFApprovalResponse"},"title":"Response List Acecf Approvals Acecf  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/acecf/{approval_id}":{"get":{"tags":["ACECF - Commercial Approval"],"summary":"Get Acecf Approval","description":"Get ACECF approval by ID.\n\nArgs:\n    approval_id: ACECF approval ID\n    db: Database session (injected)\n\nReturns:\n    ACECF approval with all related data\n\nRaises:\n    APIError: If approval not found","operationId":"get_acecf_approval_acecf__approval_id__get","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"integer","title":"Approval Id"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ACECFApprovalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/acecf/{approval_id}/xml":{"get":{"tags":["ACECF - Commercial Approval"],"summary":"Get Acecf Xml","description":"Retrieve signed ACECF XML document from GCS.\n\nArgs:\n    approval_id: ACECF approval ID\n    db: Database session (injected)\n    gcs_storage: GCS storage service (injected)\n\nReturns:\n    XML document as application/xml response\n\nRaises:\n    APIError: If approval or XML not found","operationId":"get_acecf_xml_acecf__approval_id__xml_get","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"integer","title":"Approval Id"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/directory/taxpayers":{"get":{"tags":["Taxpayer Directory"],"summary":"List Taxpayers","description":"List all authorized electronic taxpayers from DGII directory.\n\nThis endpoint queries the DGII Directorio de Facturadores to retrieve\nall taxpayers authorized for electronic invoicing, including their\nservice endpoints for invoice reception, commercial approval, and\noptional authentication.\n\nArgs:\n    env: DGII environment (TesteCF, CerteCF, or eCF)\n    redis_client: Redis client for auth token caching (injected)\n\nReturns:\n    List of all authorized electronic taxpayers\n\nRaises:\n    APIError: If DGII API call or parsing fails","operationId":"list_taxpayers_directory_taxpayers_get","parameters":[{"name":"env","in":"header","required":false,"schema":{"$ref":"#/components/schemas/ECFEnvironment","default":"TesteCF"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxpayerDirectoryList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/directory/taxpayers/{rnc}":{"get":{"tags":["Taxpayer Directory"],"summary":"Get Taxpayer","description":"Get specific taxpayer directory entry by RNC.\n\nQueries the DGII Directorio de Facturadores for a specific taxpayer\nto retrieve their service endpoints.\n\nArgs:\n    rnc: Taxpayer RNC (9 or 11 digits)\n    env: DGII environment (TesteCF, CerteCF, or eCF)\n    redis_client: Redis client for auth token caching (injected)\n\nReturns:\n    Taxpayer directory entry with service endpoints\n\nRaises:\n    APIError: If taxpayer not found or DGII API call fails","operationId":"get_taxpayer_directory_taxpayers__rnc__get","parameters":[{"name":"rnc","in":"path","required":true,"schema":{"type":"string","title":"Rnc"}},{"name":"env","in":"header","required":false,"schema":{"$ref":"#/components/schemas/ECFEnvironment","default":"TesteCF"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxpayerDirectory"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/monitoring/status":{"get":{"tags":["Monitoring - Service Status"],"summary":"Get DGII Service Status","description":"Query DGII service availability status for all eCF services.\n\n    Returns the current status of DGII services including:\n    - Authentication\n    - Reception\n    - Query Result\n    - Query Status\n    - Query Directory\n    - And more...\n\n    **Note**: Requires DGII_STATUS_APIKEY environment variable to be configured.","operationId":"get_service_status_monitoring_status_get","responses":{"200":{"description":"Successfully retrieved service status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceStatusResponse"},"example":{"services":[{"servicio":"Autenticación","estatus":"Disponible","ambiente":"Produccion"},{"servicio":"Recepción","estatus":"Disponible","ambiente":"Produccion"}]}}}},"500":{"description":"DGII API error or internal server error"}},"parameters":[{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}]}},"/monitoring/timbre/verify":{"post":{"tags":["Monitoring - Timbre Verification"],"summary":"Generate Timbre Verification URL (Regular e-CF)","description":"Generate DGII verification URL for regular e-CF invoice QR codes.\n\n    Accepts QR code parameters and returns the complete DGII URL that can be\n    visited to verify the invoice's validity.\n\n    **Parameters from QR code:**\n    - RNC Emisor\n    - RNC Comprador\n    - e-NCF\n    - Fecha Emisión (DD-MM-YYYY)\n    - Monto Total\n    - Fecha Firma (DD-MM-YYYY HH:MM:SS)\n    - Código Seguridad\n\n    **Note**: The DGII timbre endpoint returns an HTML page displaying the\n    invoice verification status, not a JSON response.","operationId":"verify_timbre_monitoring_timbre_verify_post","parameters":[{"name":"env","in":"header","required":false,"schema":{"$ref":"#/components/schemas/ECFEnvironment","default":"TesteCF"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TimbreVerificationRequest"}}}},"responses":{"200":{"description":"Successfully generated verification URL","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Verify Timbre Monitoring Timbre Verify Post"},"example":{"verification_url":"https://ecf.dgii.gov.do/testecf/consultatimbre?rncemisor=130000001&...","environment":"TesteCF"}}}},"400":{"description":"Invalid request parameters"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/monitoring/timbre/verify-fc":{"post":{"tags":["Monitoring - Timbre Verification"],"summary":"Generate Timbre Verification URL (Consumer FC)","description":"Generate DGII verification URL for consumer invoice (FC) QR codes.\n\n    For invoices with amount < RD$250,000.00.\n\n    **Parameters from QR code:**\n    - RNC Emisor\n    - e-NCF\n    - Monto Total\n    - Código Seguridad\n\n    **Note**: Consumer FC verification is only available in TesteCF and eCF environments.","operationId":"verify_timbre_fc_monitoring_timbre_verify_fc_post","parameters":[{"name":"env","in":"header","required":false,"schema":{"$ref":"#/components/schemas/ECFEnvironment","default":"TesteCF"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TimbreFCVerificationRequest"}}}},"responses":{"200":{"description":"Successfully generated verification URL","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Verify Timbre Fc Monitoring Timbre Verify Fc Post"},"example":{"verification_url":"https://fc.dgii.gov.do/testecf/consultatimbrefc?rncemisor=131880738&...","environment":"TesteCF"}}}},"400":{"description":"Invalid request parameters or environment"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/taxpayers/{rnc}/certificates":{"post":{"tags":["Certificate Management"],"summary":"Upload Certificate","description":"Upload and store a taxpayer certificate.\n\nThis endpoint allows uploading a digital certificate (.pfx/.p12 format) for a taxpayer.\nThe certificate will be:\n1. Validated to ensure it can be loaded with the provided password\n2. Stored securely in Google Cloud Storage\n3. Password encrypted before storing in database\n4. Associated with the taxpayer and DGII environment\n\nArgs:\n    rnc: Taxpayer RNC (9 or 11 digits)\n    certificate: Certificate file upload (.pfx or .p12)\n    certificate_name: Friendly name (e.g., \"Production 2025\")\n    password: Certificate password\n    dgii_environment: DGII environment this certificate is for\n    is_active: Whether to activate this certificate immediately\n    db: Database session (injected)\n\nReturns:\n    Certificate information including ID, validity dates, and GCS path\n\nRaises:\n    APIError: If taxpayer not found, certificate invalid, or upload fails","operationId":"upload_certificate_taxpayers__rnc__certificates_post","parameters":[{"name":"rnc","in":"path","required":true,"schema":{"type":"string","title":"Rnc"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_certificate_taxpayers__rnc__certificates_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Certificate Management"],"summary":"List Certificates","description":"List all certificates for a taxpayer.\n\nReturns all certificates associated with the taxpayer, including:\n- Active and inactive certificates\n- Certificates for all DGII environments\n- Validity dates and expiration status\n\nArgs:\n    rnc: Taxpayer RNC (9 or 11 digits)\n    db: Database session (injected)\n\nReturns:\n    List of certificates with metadata\n\nRaises:\n    APIError: If taxpayer not found","operationId":"list_certificates_taxpayers__rnc__certificates_get","parameters":[{"name":"rnc","in":"path","required":true,"schema":{"type":"string","title":"Rnc"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/taxpayers/{rnc}/certificates/{certificate_id}/activate":{"put":{"tags":["Certificate Management"],"summary":"Activate Certificate","description":"Activate a certificate (deactivates others in same environment).\n\nWhen a certificate is activated:\n1. All other certificates for the same taxpayer and environment are deactivated\n2. The specified certificate becomes the active one\n3. This certificate will be used for signing operations in that environment\n\nNote: Only one certificate can be active per taxpayer per DGII environment.\n\nArgs:\n    rnc: Taxpayer RNC (9 or 11 digits)\n    certificate_id: Certificate ID to activate\n    db: Database session (injected)\n\nReturns:\n    Activated certificate information\n\nRaises:\n    APIError: If taxpayer or certificate not found","operationId":"activate_certificate_taxpayers__rnc__certificates__certificate_id__activate_put","parameters":[{"name":"rnc","in":"path","required":true,"schema":{"type":"string","title":"Rnc"}},{"name":"certificate_id","in":"path","required":true,"schema":{"type":"integer","title":"Certificate Id"}},{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/errors":{"get":{"tags":["Developer"],"summary":"Error catalog","description":"Returns the structured error categories the API returns.","operationId":"error_catalog_errors_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Error Catalog Errors Get"}}}}},"parameters":[{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}]}},"/fe/autenticacion/api/semilla":{"get":{"tags":["Provider Authentication"],"summary":"Get Semilla","description":"Issue a fresh <SemillaModel> seed for a peer to sign.","operationId":"get_semilla_fe_autenticacion_api_semilla_get","responses":{"200":{"description":"Successful Response"}},"parameters":[{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}]}},"/fe/autenticacion/api/validacionCertificado":{"post":{"tags":["Provider Authentication"],"summary":"Post Validacioncertificado","description":"Exchange a signed seed for a Bearer token, if the signature and freshness check out.","operationId":"post_validacioncertificado_fe_autenticacion_api_validacionCertificado_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_post_validacioncertificado_fe_autenticacion_api_validacionCertificado_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Post Validacioncertificado Fe Autenticacion Api Validacioncertificado Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"parameters":[{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}]}},"/fe/autenticacion/api/validacioncertificado":{"post":{"tags":["Provider Authentication"],"summary":"Post Validacioncertificado","description":"Exchange a signed seed for a Bearer token, if the signature and freshness check out.","operationId":"post_validacioncertificado_fe_autenticacion_api_validacioncertificado_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_post_validacioncertificado_fe_autenticacion_api_validacioncertificado_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Post Validacioncertificado Fe Autenticacion Api Validacioncertificado Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"parameters":[{"name":"env","in":"header","required":false,"schema":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"default":"TesteCF"},"description":"Target DGII environment. Default: TesteCF (sandbox)."}]}},"/issued-invoices/":{"get":{"tags":["Issued Invoices - Portal View"],"summary":"List Issued Invoices Endpoint","description":"Retrieve paginated list of issued invoices with commercial approval, acknowledgment, and delivery statuses.\n\nBuyer-cycle tracking view: only e-CF types that take part in the emisor-receptor\nflow are listed (31, 33, 34, 44 — see ELIGIBLE_ECF_TYPES). Consumo invoices (32)\nand other non-eligible types are never delivered, acknowledged or approved, so\nthey are excluded rather than shown with empty satellites.","operationId":"list_issued_invoices_endpoint_issued_invoices__get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Page size limit","default":10,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Pagination offset","default":0,"title":"Offset"},"description":"Pagination offset"},{"name":"rnc-issuing","in":"header","required":true,"schema":{"type":"string","description":"Taxpayer RNC of the issuer","title":"Rnc-Issuing"},"description":"Taxpayer RNC of the issuer"},{"name":"buyer-rnc","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional buyer RNC filter","title":"Buyer-Rnc"},"description":"Optional buyer RNC filter"},{"name":"start-date","in":"header","required":true,"schema":{"type":"string","description":"Start date in DD-MM-YYYY format","title":"Start-Date"},"description":"Start date in DD-MM-YYYY format"},{"name":"end-date","in":"header","required":true,"schema":{"type":"string","description":"End date in DD-MM-YYYY format","title":"End-Date"},"description":"End date in DD-MM-YYYY format"},{"name":"env","in":"header","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ECFEnvironment"},{"type":"null"}],"default":"TesteCF","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedInvoicesList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ACECFApprovalRequest":{"properties":{"ecf_document_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ecf Document Id","description":"Received invoice document ID. Optional: when omitted, a metadata-only ECFDocument is auto-created from the request fields (for approving invoices received out-of-band / DGII certification of Aprobaciones Comerciales)."},"version":{"type":"string","maxLength":10,"title":"Version","description":"DGII document schema version","default":"1.0"},"issuer_rnc":{"type":"string","maxLength":11,"title":"Issuer Rnc","description":"Provider RNC"},"receiver_rnc":{"type":"string","maxLength":11,"title":"Receiver Rnc","description":"Our RNC"},"encf":{"type":"string","maxLength":13,"title":"Encf","description":"Invoice eNCF"},"dgii_environment":{"$ref":"#/components/schemas/DGIIEnvironment","description":"TesteCF, CerteCF, or eCF"},"approval_status":{"$ref":"#/components/schemas/ACECFDecision","description":"1=Accepted, 2=Rejected"},"approval_datetime":{"type":"string","format":"date-time","title":"Approval Datetime","description":"When approval or rejection occurred"},"rejection_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rejection Code","description":"DGII rejection code when rejected"},"rejection_description":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Rejection Description","description":"Human readable reason"},"invoice_date_issued":{"type":"string","format":"date","title":"Invoice Date Issued","description":"DGII FechaEmision"},"invoice_total_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d{0,2}0*$"}],"title":"Invoice Total Amount","description":"DGII MontoTotal"}},"type":"object","required":["issuer_rnc","receiver_rnc","encf","dgii_environment","approval_status","approval_datetime","invoice_date_issued","invoice_total_amount"],"title":"ACECFApprovalRequest","description":"Request schema for API endpoint - what clients send (no XML metadata).\n\nThis schema is used for the POST endpoint to validate incoming requests.\nAfter XML generation and storage, the service builds ACECFApprovalCreate\nwith the complete metadata for persistence."},"ACECFApprovalResponse":{"properties":{"approval_status":{"$ref":"#/components/schemas/ACECFDecision","description":"1=Accepted, 2=Rejected"},"rejection_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rejection Code","description":"DGII rejection code when rejected"},"rejection_description":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Rejection Description","description":"Human readable reason"},"approval_datetime":{"type":"string","format":"date-time","title":"Approval Datetime","description":"When approval or rejection occurred"},"xml_gcs_path":{"type":"string","maxLength":500,"title":"Xml Gcs Path","description":"gs://bucket/path/file.xml"},"xml_checksum":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Xml Checksum","description":"SHA-256 checksum"},"xml_schema_version":{"type":"string","maxLength":10,"title":"Xml Schema Version","description":"XML schema version","default":"1.0"},"dgii_environment":{"$ref":"#/components/schemas/DGIIEnvironment","description":"TesteCF, CerteCF, or eCF"},"version":{"type":"string","maxLength":10,"title":"Version","description":"DGII document schema version","default":"1.0"},"issuer_rnc":{"type":"string","maxLength":11,"title":"Issuer Rnc","description":"Provider RNC"},"receiver_rnc":{"type":"string","maxLength":11,"title":"Receiver Rnc","description":"Our RNC"},"encf":{"type":"string","maxLength":13,"title":"Encf","description":"Invoice eNCF"},"id":{"type":"integer","title":"Id"},"ecf_document_id":{"type":"integer","title":"Ecf Document Id"},"invoice_date_issued":{"type":"string","format":"date","title":"Invoice Date Issued"},"invoice_total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Invoice Total Amount"},"sent_to_dgii":{"type":"boolean","title":"Sent To Dgii","description":"Whether ACECF was sent to DGII"},"sent_to_dgii_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Sent To Dgii At","description":"When ACECF was sent to DGII"},"dgii_submission_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dgii Submission Status","description":"DGII submission status: submitted, failed, or null if not attempted"},"dgii_response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dgii Response","description":"Raw DGII response message"},"sent_to_issuer":{"type":"boolean","title":"Sent To Issuer","description":"Whether ACECF was sent to provider","default":false},"sent_to_issuer_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Sent To Issuer At","description":"When ACECF was sent to provider"},"issuer_delivery_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuer Delivery Status","description":"Delivery status to provider: sent, failed, pending"},"issuer_delivery_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuer Delivery Error","description":"Error message if delivery failed"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["approval_status","approval_datetime","xml_gcs_path","dgii_environment","issuer_rnc","receiver_rnc","encf","id","ecf_document_id","invoice_date_issued","invoice_total_amount","sent_to_dgii","created_at"],"title":"ACECFApprovalResponse","description":"Response schema for ACECF commercial approval.\n\nIncludes DGII submission tracking fields to provide transparency\nabout the actual submission status (not just DB persistence)."},"ACECFDecision":{"type":"integer","enum":[1,2],"title":"ACECFDecision","description":"ACECF approval decision codes."},"ANECFDetailLineCreate":{"properties":{"line_number":{"type":"integer","maximum":10,"minimum":1,"title":"Line Number","description":"Line number (1-10) within submission"},"ecf_type":{"type":"string","maxLength":2,"title":"Ecf Type","description":"31, 32, 33, 34, 41, 43, 44, 45, 46, 47"},"total_encf_canceled":{"type":"integer","minimum":1,"title":"Total Encf Canceled","description":"Total count for this e-CF type"},"sequence_ranges":{"items":{"$ref":"#/components/schemas/ANECFSequenceRangeCreate"},"type":"array","minItems":1,"title":"Sequence Ranges","description":"Sequence ranges for this detail line"}},"type":"object","required":["line_number","ecf_type","total_encf_canceled","sequence_ranges"],"title":"ANECFDetailLineCreate","description":"Schema for creating a detail line within an ANECF submission.\n\nGroups cancellations by e-CF type (1-10 lines per submission)."},"ANECFDetailLineResponse":{"properties":{"id":{"type":"integer","title":"Id"},"submission_id":{"type":"integer","title":"Submission Id"},"line_number":{"type":"integer","title":"Line Number"},"ecf_type":{"type":"string","title":"Ecf Type"},"total_encf_canceled":{"type":"integer","title":"Total Encf Canceled"},"sequence_ranges":{"items":{"$ref":"#/components/schemas/ANECFSequenceRangeResponse"},"type":"array","title":"Sequence Ranges"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","submission_id","line_number","ecf_type","total_encf_canceled","sequence_ranges","created_at"],"title":"ANECFDetailLineResponse","description":"Response schema for ANECF detail line."},"ANECFSequenceRangeCreate":{"properties":{"encf_desde":{"type":"string","maxLength":13,"title":"Encf Desde","description":"Starting eNCF (e.g., E310000000001)"},"encf_hasta":{"type":"string","maxLength":13,"title":"Encf Hasta","description":"Ending eNCF (e.g., E310000000050)"},"quantity_canceled":{"type":"integer","minimum":1,"title":"Quantity Canceled","description":"Count of eNCFs in this range"}},"type":"object","required":["encf_desde","encf_hasta","quantity_canceled"],"title":"ANECFSequenceRangeCreate","description":"Schema for creating a sequence range within an ANECF detail line.\n\nRepresents a contiguous range of canceled eNCFs."},"ANECFSequenceRangeResponse":{"properties":{"id":{"type":"integer","title":"Id"},"detail_line_id":{"type":"integer","title":"Detail Line Id"},"encf_desde":{"type":"string","title":"Encf Desde"},"encf_hasta":{"type":"string","title":"Encf Hasta"},"quantity_canceled":{"type":"integer","title":"Quantity Canceled"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","detail_line_id","encf_desde","encf_hasta","quantity_canceled","created_at"],"title":"ANECFSequenceRangeResponse","description":"Response schema for ANECF sequence range."},"ANECFSubmissionCreate":{"properties":{"version":{"type":"string","maxLength":10,"title":"Version","default":"1.0"},"issuer_rnc":{"type":"string","maxLength":11,"title":"Issuer Rnc","description":"Our RNC"},"total_encf_canceled":{"type":"integer","minimum":1,"title":"Total Encf Canceled","description":"Total count of canceled eNCFs across all detail lines"},"generation_datetime":{"type":"string","format":"date-time","title":"Generation Datetime","description":"When ANECF was generated"},"detail_lines":{"items":{"$ref":"#/components/schemas/ANECFDetailLineCreate"},"type":"array","maxItems":10,"minItems":1,"title":"Detail Lines","description":"Detail lines (1-10 per submission)"},"dgii_environment":{"type":"string","maxLength":10,"title":"Dgii Environment","description":"TesteCF, CerteCF, or eCF","default":"TesteCF"},"xml_schema_version":{"type":"string","maxLength":10,"title":"Xml Schema Version","description":"XML schema version","default":"1.0"},"created_by":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Created By","description":"User or system that created cancellation"},"cancellation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Reason","description":"Business reason for cancellation"}},"type":"object","required":["issuer_rnc","total_encf_canceled","generation_datetime","detail_lines"],"title":"ANECFSubmissionCreate","description":"Schema for creating an ANECF cancellation submission.\n\nReports canceled e-NCF sequences to DGII (batch of 1-10 detail lines)."},"ANECFSubmissionResponse":{"properties":{"id":{"type":"integer","title":"Id"},"version":{"type":"string","title":"Version"},"issuer_rnc":{"type":"string","title":"Issuer Rnc"},"total_encf_canceled":{"type":"integer","title":"Total Encf Canceled"},"generation_datetime":{"type":"string","format":"date-time","title":"Generation Datetime"},"detail_lines":{"items":{"$ref":"#/components/schemas/ANECFDetailLineResponse"},"type":"array","title":"Detail Lines"},"sent_to_dgii":{"type":"boolean","title":"Sent To Dgii"},"sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Sent At"},"dgii_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dgii Status"},"dgii_response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dgii Response"},"xml_gcs_path":{"type":"string","title":"Xml Gcs Path"},"xml_checksum":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Xml Checksum"},"xml_schema_version":{"type":"string","title":"Xml Schema Version"},"dgii_environment":{"type":"string","title":"Dgii Environment"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"cancellation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Reason"}},"type":"object","required":["id","version","issuer_rnc","total_encf_canceled","generation_datetime","detail_lines","sent_to_dgii","sent_at","dgii_status","dgii_response","xml_gcs_path","xml_checksum","xml_schema_version","dgii_environment","created_at","created_by","cancellation_reason"],"title":"ANECFSubmissionResponse","description":"Response schema for ANECF cancellation submission."},"AcknowledgmentSummary":{"properties":{"receipt_status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Receipt Status"},"rejection_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rejection Code"},"acknowledgment_datetime":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Acknowledgment Datetime"},"is_valid":{"type":"boolean","title":"Is Valid","default":false},"xml_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Xml Url"},"receipt_status_label":{"type":"string","title":"Receipt Status Label","readOnly":true}},"type":"object","required":["receipt_status_label"],"title":"AcknowledgmentSummary","description":"Summary of buyer's reception acknowledgment (ARECF)."},"AllReceivedInvoicesList":{"properties":{"count":{"type":"integer","minimum":0,"title":"Count","description":"Total number of items in the list"},"invoices":{"items":{"$ref":"#/components/schemas/ReceivedInvoice"},"type":"array","title":"Invoices","description":"List of received invoices"},"start_date":{"type":"string","title":"Start Date","description":"Start date of query range (DD-MM-YYYY)"},"end_date":{"type":"string","title":"End Date","description":"End date of query range (DD-MM-YYYY)"},"env":{"type":"string","title":"Env","description":"DGII environment"},"has_more":{"type":"boolean","title":"Has More","description":"True if more rows exist beyond this page"}},"type":"object","required":["count","invoices","start_date","end_date","env","has_more"],"title":"AllReceivedInvoicesList","description":"Response schema for GET /fe/recepcion/api/invoices/all endpoint.\n\nReturns all received invoices across all providers in the given period."},"Body_fe_submit_fe_Submit_post":{"properties":{"data":{"type":"string","format":"binary","title":"Data"},"password":{"type":"string","title":"Password"},"certificate":{"type":"string","format":"binary","title":"Certificate"}},"type":"object","required":["data","password","certificate"],"title":"Body_fe_submit_fe_Submit_post"},"Body_post_validacioncertificado_fe_autenticacion_api_validacionCertificado_post":{"properties":{"data":{"type":"string","format":"binary","title":"Data","description":"The signed seed XML"}},"type":"object","required":["data"],"title":"Body_post_validacioncertificado_fe_autenticacion_api_validacionCertificado_post"},"Body_post_validacioncertificado_fe_autenticacion_api_validacioncertificado_post":{"properties":{"data":{"type":"string","format":"binary","title":"Data","description":"The signed seed XML"}},"type":"object","required":["data"],"title":"Body_post_validacioncertificado_fe_autenticacion_api_validacioncertificado_post"},"Body_receive_commercial_approval_fe_aprobacioncomercial_api_ecf_post":{"properties":{"data":{"type":"string","format":"binary","title":"Data","description":"Inbound ACECF XML file"}},"type":"object","required":["data"],"title":"Body_receive_commercial_approval_fe_aprobacioncomercial_api_ecf_post"},"Body_receive_provider_invoice_fe_recepcion_api_ecf_post":{"properties":{"data":{"type":"string","format":"binary","title":"Data","description":"Provider invoice XML file"}},"type":"object","required":["data"],"title":"Body_receive_provider_invoice_fe_recepcion_api_ecf_post"},"Body_upload_certificate_taxpayers__rnc__certificates_post":{"properties":{"certificate":{"type":"string","format":"binary","title":"Certificate","description":"Certificate file (.pfx or .p12 format)"},"certificate_name":{"type":"string","title":"Certificate Name","description":"Friendly name for certificate (e.g., 'Production 2025')"},"dgii_environment":{"$ref":"#/components/schemas/ECFEnvironment","description":"DGII environment (TesteCF, CerteCF, or eCF)"},"password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Password","description":"Certificate password (if required)"},"is_active":{"type":"boolean","title":"Is Active","description":"Set as active certificate for this environment","default":false}},"type":"object","required":["certificate","certificate_name","dgii_environment"],"title":"Body_upload_certificate_taxpayers__rnc__certificates_post"},"CertificateListResponse":{"properties":{"certificates":{"items":{"$ref":"#/components/schemas/CertificateResponse"},"type":"array","title":"Certificates","description":"List of certificates"},"total":{"type":"integer","title":"Total","description":"Total number of certificates"}},"type":"object","required":["certificates","total"],"title":"CertificateListResponse","description":"Response schema for listing certificates."},"CertificateResponse":{"properties":{"id":{"type":"integer","title":"Id","description":"Certificate ID"},"taxpayer_id":{"type":"integer","title":"Taxpayer Id","description":"Taxpayer ID"},"certificate_name":{"type":"string","title":"Certificate Name","description":"Certificate friendly name"},"certificate_gcs_path":{"type":"string","title":"Certificate Gcs Path","description":"GCS path to certificate file"},"valid_from":{"type":"string","format":"date-time","title":"Valid From","description":"Certificate valid from date"},"valid_until":{"type":"string","format":"date-time","title":"Valid Until","description":"Certificate expiration date"},"is_active":{"type":"boolean","title":"Is Active","description":"Whether this certificate is currently active"},"dgii_environment":{"type":"string","title":"Dgii Environment","description":"DGII environment (TesteCF, CerteCF, eCF)"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When certificate was uploaded"}},"type":"object","required":["id","taxpayer_id","certificate_name","certificate_gcs_path","valid_from","valid_until","is_active","dgii_environment","created_at"],"title":"CertificateResponse","description":"Response schema for certificate information."},"CommercialApprovalSummary":{"properties":{"approval_status":{"type":"integer","enum":[1,2],"title":"Approval Status"},"rejection_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rejection Detail"},"approval_datetime":{"type":"string","format":"date-time","title":"Approval Datetime"},"approval_status_label":{"type":"string","title":"Approval Status Label","readOnly":true}},"type":"object","required":["approval_status","approval_datetime","approval_status_label"],"title":"CommercialApprovalSummary","description":"Summary of buyer's commercial approval (ACECF) decision."},"ConsumptionInvoiceStatusResponse":{"properties":{"rnc_issuing":{"type":"string","title":"Rnc Issuing","description":"RNC of the issuer"},"encf":{"type":"string","title":"Encf","description":"e-NCF number"},"status":{"type":"string","title":"Status","description":"Current status from DGII"},"messages":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Messages","description":"Status messages from DGII"}},"type":"object","required":["rnc_issuing","encf","status"],"title":"ConsumptionInvoiceStatusResponse","description":"Response schema for GET /query-consumption-invoice/ endpoint.\nReturns the status of a consumption invoice (RFCE) based on RNC, eNCF, and security code."},"DGIIEnvironment":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"title":"DGIIEnvironment","description":"DGII operating environments."},"DGIIMessage":{"properties":{"codigo":{"anyOf":[{"type":"string"},{"type":"integer"}],"title":"Codigo","description":"Message code from DGII"},"valor":{"type":"string","title":"Valor","description":"Message value or description"}},"type":"object","required":["codigo","valor"],"title":"DGIIMessage","description":"Represents a single message in DGII API responses.\n\nDGII sometimes returns 'codigo' as string, sometimes as integer.\nThis schema accepts both and normalizes to string for consistency.\n\nBased on DGII documentation: {\"codigo\": \"string\", \"valor\": \"string\"}\n\nAttributes:\n    codigo: Message code (can be string or integer from DGII)\n    valor: Message value/description"},"DeliverySummary":{"properties":{"status":{"type":"string","title":"Status"},"attempt":{"type":"integer","title":"Attempt"},"http_status_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Http Status Code"},"sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Sent At"}},"type":"object","required":["status","attempt"],"title":"DeliverySummary","description":"Summary of outbound e-CF delivery to the buyer's endpoint."},"ECFEnvironment":{"type":"string","enum":["TesteCF","CerteCF","eCF"],"title":"ECFEnvironment","description":"DGII e-CF environments for API endpoints."},"ECFResponse":{"properties":{"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/DGIIMessage"},"type":"array"},{"type":"null"}],"title":"Messages","description":"Response messages from DGII API in structured format"},"trackId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trackid","description":"Tracking ID provided by DGII for ECF documents"},"security_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Security Code","description":"Security code extracted from XML digital signature"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url","description":"DGII timbre verification URL"}},"type":"object","title":"ECFResponse","description":"Response schema for ECF (Electronic Credit Invoice) submission.\nUsed by submit_ecf endpoint.\n\nBased on the actual DGII response structure:\n{\n    \"mensajes\": [{\"codigo\": \"...\", \"valor\": \"...\"}],  // Lista de DGIIMessage\n    \"trackId\": \"ID de seguimiento\"\n}"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Invoice":{"properties":{"encf":{"type":"string","title":"Encf","description":"e-NCF number"},"rnc_issuing":{"type":"string","title":"Rnc Issuing","description":"RNC of the issuer"},"date_issued":{"type":"string","format":"date-time","title":"Date Issued","description":"Date when the invoice was issued"},"rnc_buyer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rnc Buyer","description":"RNC of the buyer"},"total_amount":{"type":"string","title":"Total Amount","description":"Total amount of the invoice"},"status":{"type":"string","title":"Status","description":"Current status of the invoice"},"track_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Track Id","description":"Tracking ID from DGII"},"env":{"type":"string","title":"Env","description":"Environment (TesteCF, CerteCF)"},"comment_dgii":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment Dgii","description":"Comments from DGII"},"ecf_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ecf Type","description":"Type of e-NCF (31, 32, etc.)"},"client_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Name","description":"Client name from invoice"},"xml_gcs_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Xml Gcs Path","description":"GCS path to the signed invoice XML"}},"type":"object","required":["encf","rnc_issuing","date_issued","total_amount","status","env"],"title":"Invoice","description":"Schema representing a single invoice in query responses.\nUsed by the get_invoices endpoint."},"InvoiceAggregateResponse":{"properties":{"rnc_issuing":{"type":"string","title":"Rnc Issuing","description":"RNC of the issuer"},"total_invoices":{"type":"integer","title":"Total Invoices","description":"Total number of invoices found"},"total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Amount","description":"Sum of all invoice amounts"},"by_month":{"items":{"$ref":"#/components/schemas/MonthlyAggregate"},"type":"array","title":"By Month","description":"Chronological month-by-month breakdown"},"by_type":{"items":{"$ref":"#/components/schemas/TypeAggregate"},"type":"array","title":"By Type","description":"Breakdown by e-CF type, count descending"},"by_status":{"items":{"$ref":"#/components/schemas/StatusAggregate"},"type":"array","title":"By Status","description":"Breakdown by resolved DGII status, count descending"},"top_clients":{"items":{"$ref":"#/components/schemas/TopClientAggregate"},"type":"array","title":"Top Clients","description":"Top buyers by amount, descending"},"start_date":{"type":"string","title":"Start Date","description":"Start date of the query range (DD-MM-YYYY)"},"end_date":{"type":"string","title":"End Date","description":"End date of the query range (DD-MM-YYYY)"},"env":{"type":"string","title":"Env","description":"Environment used in query"}},"type":"object","required":["rnc_issuing","total_invoices","total_amount","by_month","by_type","by_status","top_clients","start_date","end_date","env"],"title":"InvoiceAggregateResponse","description":"Response schema for GET /invoices/aggregate/ endpoint.\nPre-aggregated totals + breakdowns for dashboard/report charts, computed via\nSQL GROUP BY — never by fetching row-level data, so cost stays flat regardless\nof how many invoices exist in the date range."},"InvoiceCountResponse":{"properties":{"rnc_issuing":{"type":"string","title":"Rnc Issuing","description":"RNC of the issuer"},"total_invoices":{"type":"integer","title":"Total Invoices","description":"Total number of invoices found"},"total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Amount","description":"Sum of all invoice amounts"},"start_date":{"type":"string","title":"Start Date","description":"Start date of the query range (DD-MM-YYYY)"},"end_date":{"type":"string","title":"End Date","description":"End date of the query range (DD-MM-YYYY)"},"env":{"type":"string","title":"Env","description":"Environment used in query"}},"type":"object","required":["rnc_issuing","total_invoices","total_amount","start_date","end_date","env"],"title":"InvoiceCountResponse","description":"Response schema for GET /invoices/count/ endpoint.\nReturns count of invoices matching the query criteria."},"InvoiceStatusResponse":{"properties":{"status":{"type":"string","title":"Status","description":"Current status from DGII"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Status code from DGII"},"track_id":{"type":"string","title":"Track Id","description":"Tracking ID of the invoice"},"rnc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rnc","description":"RNC from DGII response"},"date_received":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date Received","description":"Date when status was received from DGII"},"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/DGIIMessage"},"type":"array"},{"type":"null"}],"title":"Messages","description":"Status messages from DGII"}},"type":"object","required":["status","track_id"],"title":"InvoiceStatusResponse","description":"Response schema for GET /invoice-status/{track_id} endpoint.\nReturns the current status of an invoice based on track ID."},"InvoicesList":{"properties":{"count":{"type":"integer","minimum":0,"title":"Count","description":"Total number of items in the list"},"invoices":{"items":{"$ref":"#/components/schemas/Invoice"},"type":"array","title":"Invoices","description":"List of invoices found"},"rnc_issuing":{"type":"string","title":"Rnc Issuing","description":"RNC of the issuer used in query"},"start_date":{"type":"string","title":"Start Date","description":"Start date of the query range"},"end_date":{"type":"string","title":"End Date","description":"End date of the query range"},"env":{"type":"string","title":"Env","description":"Environment used in query"},"has_more":{"type":"boolean","title":"Has More","description":"True if more rows exist beyond this page"}},"type":"object","required":["count","invoices","rnc_issuing","start_date","end_date","env","has_more"],"title":"InvoicesList","description":"Response schema for GET /invoices/ endpoint.\nReturns list of invoices matching the query criteria."},"IssuedInvoiceDetail":{"properties":{"encf":{"type":"string","title":"Encf"},"date_issued":{"type":"string","format":"date-time","title":"Date Issued"},"buyer_rnc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Buyer Rnc"},"buyer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Buyer Name"},"total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Amount"},"ecf_type":{"type":"string","title":"Ecf Type"},"dgii_environment":{"type":"string","title":"Dgii Environment"},"invoice_xml_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Xml Url"},"commercial_approval":{"anyOf":[{"$ref":"#/components/schemas/CommercialApprovalSummary"},{"type":"null"}]},"acknowledgment":{"anyOf":[{"$ref":"#/components/schemas/AcknowledgmentSummary"},{"type":"null"}]},"delivery":{"anyOf":[{"$ref":"#/components/schemas/DeliverySummary"},{"type":"null"}]}},"type":"object","required":["encf","date_issued","total_amount","ecf_type","dgii_environment"],"title":"IssuedInvoiceDetail","description":"Aggregated detail of an issued invoice and its satellites."},"IssuedInvoicesList":{"properties":{"count":{"type":"integer","title":"Count"},"invoices":{"items":{"$ref":"#/components/schemas/IssuedInvoiceDetail"},"type":"array","title":"Invoices"}},"type":"object","required":["count","invoices"],"title":"IssuedInvoicesList","description":"Paginated list response of issued invoices."},"MonthlyAggregate":{"properties":{"month":{"type":"string","title":"Month","description":"YYYY-MM"},"count":{"type":"integer","title":"Count","description":"Number of invoices issued in this month"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount","description":"Sum of total_amount for this month"}},"type":"object","required":["month","count","amount"],"title":"MonthlyAggregate","description":"One month's invoice count + amount, for chart data."},"RFCEResponse":{"properties":{"status":{"type":"string","title":"Status","description":"Submission status returned by DGII (e.g., 'Aceptado', 'Rechazado', 'error')"},"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/DGIIMessage"},"type":"array"},{"type":"null"}],"title":"Messages","description":"Response messages from DGII API in structured format"},"security_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Security Code","description":"Security code extracted from XML digital signature"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url","description":"DGII timbre verification URL"}},"type":"object","required":["status"],"title":"RFCEResponse","description":"Response schema for RFCE (Electronic Consumer Invoice) submission.\nUsed by submit_fc endpoint.\n\nBased on the actual DGII response structure:\n{\n    \"status\": \"Aceptado\" | \"Rechazado\" | \"error\",\n    \"mensajes\": [{\"codigo\": \"...\", \"valor\": \"...\"}]  // List of DGIIMessage\n}\n\nNote: Current implementation extracts only the \"valor\" from the first message,\nbut this DTO preserves the full DGII structure for better type safety."},"ReceivedAcknowledgmentResponse":{"properties":{"encf":{"type":"string","title":"Encf"},"issuer_rnc":{"type":"string","title":"Issuer Rnc"},"buyer_rnc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Buyer Rnc"},"signer_rnc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signer Rnc"},"receipt_status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Receipt Status"},"rejection_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rejection Code"},"acknowledgment_datetime":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Acknowledgment Datetime"},"is_valid":{"type":"boolean","title":"Is Valid"},"validation_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validation Error"},"dgii_environment":{"type":"string","title":"Dgii Environment"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"receipt_status_label":{"type":"string","title":"Receipt Status Label","description":"'received', 'not_received' or 'unknown' — derived, never set independently.","readOnly":true}},"type":"object","required":["encf","issuer_rnc","buyer_rnc","signer_rnc","receipt_status","rejection_code","acknowledgment_datetime","is_valid","validation_error","dgii_environment","created_at","receipt_status_label"],"title":"ReceivedAcknowledgmentResponse","description":"Response schema for the /received-arecf endpoints.\n\nxml_gcs_path and xml_checksum are deliberately omitted: they are internal,\na client cannot fetch a gs:// URI, and /received-arecf/{encf}/xml exists for\nthe document itself."},"ReceivedCommercialApprovalResponse":{"properties":{"encf":{"type":"string","title":"Encf"},"issuer_rnc":{"type":"string","title":"Issuer Rnc"},"buyer_rnc":{"type":"string","title":"Buyer Rnc"},"approval_status":{"type":"integer","enum":[1,2],"title":"Approval Status"},"rejection_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rejection Detail"},"approval_datetime":{"type":"string","format":"date-time","title":"Approval Datetime"},"dgii_environment":{"type":"string","title":"Dgii Environment"},"approval_status_label":{"type":"string","title":"Approval Status Label","description":"'approved' or 'rejected', derived from approval_status — never set independently.","readOnly":true}},"type":"object","required":["encf","issuer_rnc","buyer_rnc","approval_status","rejection_detail","approval_datetime","dgii_environment","approval_status_label"],"title":"ReceivedCommercialApprovalResponse","description":"Response schema for GET /fe/aprobacioncomercial/api/invoices/{encf}."},"ReceivedInvoice":{"properties":{"encf":{"type":"string","title":"Encf","description":"e-NCF number"},"ecf_type":{"type":"string","title":"Ecf Type","description":"Type of e-NCF (31, 32, etc.)"},"date_received":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Date Received","description":"When we received the invoice via the reception pipeline. NULL for a row created via emission, where this tenant is the buyer of an invoice a fellow tenant issued — no reception upload ever happened for it."},"date_issued":{"type":"string","format":"date-time","title":"Date Issued","description":"Invoice issue date"},"total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Amount","description":"Total invoice amount"},"provider_rnc":{"type":"string","title":"Provider Rnc","description":"RNC of the provider (issuer)"},"provider_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider Name","description":"Provider business name"},"xml_gcs_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Xml Gcs Path","description":"GCS path to original invoice XML"},"approval_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Approval Status","description":"pending (no decision yet), approved, or rejected"},"approval_datetime":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Approval Datetime","description":"When approval decision was made"}},"type":"object","required":["encf","ecf_type","date_issued","total_amount","provider_rnc"],"title":"ReceivedInvoice","description":"Schema for a single received invoice from provider.\n\nSimplified response focused on business-relevant data:\n- Invoice details (encf, amount, dates)\n- Provider info\n- Commercial approval status (ACECF)\n- Path to original XML document"},"ReceivedInvoicesCountResponse":{"properties":{"total_invoices":{"type":"integer","title":"Total Invoices","description":"Total number of invoices received"},"total_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Amount","description":"Sum of all invoice amounts"},"buyer_rnc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Buyer Rnc","description":"Receiver company RNC (tenancy scope)"},"start_date":{"type":"string","title":"Start Date","description":"Start date of the query range (DD-MM-YYYY)"},"end_date":{"type":"string","title":"End Date","description":"End date of the query range (DD-MM-YYYY)"},"env":{"type":"string","title":"Env","description":"DGII environment"}},"type":"object","required":["total_invoices","total_amount","start_date","end_date","env"],"title":"ReceivedInvoicesCountResponse","description":"Response schema for GET /fe/recepcion/api/invoices/count endpoint."},"ReceivedInvoicesList":{"properties":{"count":{"type":"integer","minimum":0,"title":"Count","description":"Total number of items in the list"},"invoices":{"items":{"$ref":"#/components/schemas/ReceivedInvoice"},"type":"array","title":"Invoices","description":"List of received invoices"},"provider_rnc":{"type":"string","title":"Provider Rnc","description":"Provider RNC used in query"},"start_date":{"type":"string","title":"Start Date","description":"Start date of query range (DD-MM-YYYY)"},"end_date":{"type":"string","title":"End Date","description":"End date of query range (DD-MM-YYYY)"},"env":{"type":"string","title":"Env","description":"DGII environment"},"has_more":{"type":"boolean","title":"Has More","description":"True if more rows exist beyond this page"}},"type":"object","required":["count","invoices","provider_rnc","start_date","end_date","env","has_more"],"title":"ReceivedInvoicesList","description":"Response schema for GET /fe/recepcion/api/invoices endpoint.\n\nReturns list of received invoices from a specific provider."},"ServiceStatus":{"properties":{"servicio":{"type":"string","title":"Servicio","description":"Service name (e.g., 'Autenticación', 'Recepción')"},"estatus":{"type":"string","title":"Estatus","description":"Service status (e.g., 'Disponible', 'No Disponible')"},"ambiente":{"type":"string","title":"Ambiente","description":"Environment ('Produccion', 'PreCertificacion')"}},"type":"object","required":["servicio","estatus","ambiente"],"title":"ServiceStatus","description":"DGII Service Status Entry.\n\nRepresents the status of a single DGII service endpoint.\n\nExample:\n    {\n        \"servicio\": \"Autenticación\",\n        \"estatus\": \"Disponible\",\n        \"ambiente\": \"Produccion\"\n    }","example":{"ambiente":"Produccion","estatus":"Disponible","servicio":"Autenticación"}},"ServiceStatusResponse":{"properties":{"services":{"items":{"$ref":"#/components/schemas/ServiceStatus"},"type":"array","title":"Services","description":"List of service status entries"}},"type":"object","required":["services"],"title":"ServiceStatusResponse","description":"DGII Service Status Response.\n\nComplete response from DGII service status endpoint containing\nstatus information for all available services.\n\nExample:\n    {\n        \"services\": [\n            {\n                \"servicio\": \"Autenticación\",\n                \"estatus\": \"Disponible\",\n                \"ambiente\": \"Produccion\"\n            },\n            ...\n        ]\n    }","example":{"services":[{"ambiente":"Produccion","estatus":"Disponible","servicio":"Autenticación"},{"ambiente":"Produccion","estatus":"Disponible","servicio":"Recepción"}]}},"StatusAggregate":{"properties":{"status":{"type":"string","title":"Status","description":"Resolved DGII status (Aceptado, Rechazado, etc.)"},"count":{"type":"integer","title":"Count","description":"Number of invoices with this status"}},"type":"object","required":["status","count"],"title":"StatusAggregate","description":"Invoice count for one resolved DGII status."},"SubmissionResponse":{"properties":{"status":{"type":"string","title":"Status","description":"Overall submission status"},"xml":{"type":"string","title":"Xml","description":"Signed XML document that was submitted"},"qr_url":{"type":"string","title":"Qr Url","description":"QR confirmation URL for the submitted document"},"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/DGIIMessage"},"type":"array"},{"type":"null"}],"title":"Messages","description":"Response messages from DGII API"},"trackId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trackid","description":"Tracking ID (available for ECF documents only)"}},"type":"object","required":["status","xml","qr_url"],"title":"SubmissionResponse","description":"Response schema for fe_submit endpoint.\nThis endpoint handles the complete flow: JSON to XML conversion, signing, and submission.\nReturns comprehensive response including the signed XML and confirmation URL."},"TaxpayerDirectory":{"properties":{"nombre":{"type":"string","title":"Nombre","description":"Business name (razón social)"},"rnc":{"type":"string","title":"Rnc","description":"Tax ID (RNC)"},"urlRecepcion":{"type":"string","title":"Urlrecepcion","description":"Invoice reception service URL"},"urlAceptacion":{"type":"string","title":"Urlaceptacion","description":"Commercial approval service URL"},"urlOpcional":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Urlopcional","description":"Optional authentication service URL"}},"type":"object","required":["nombre","rnc","urlRecepcion","urlAceptacion"],"title":"TaxpayerDirectory","description":"DGII Taxpayer Directory Entry.\n\nRepresents a taxpayer authorized for electronic invoicing with their\nservice endpoints for invoice reception, commercial approval, and\noptional authentication.\n\nExample:\n    >>> taxpayer = TaxpayerDirectory(\n    ...     nombre=\"EMPRESA EJEMPLO SRL\",\n    ...     rnc=\"131880738\",\n    ...     urlRecepcion=\"https://api.empresa.com/ecf/recepcion\",\n    ...     urlAceptacion=\"https://api.empresa.com/ecf/aprobacion\",\n    ...     urlOpcional=\"https://api.empresa.com/ecf/auth\"\n    ... )","example":{"nombre":"EMPRESA EJEMPLO SRL","rnc":"131880738","urlAceptacion":"https://api.empresa.com/ecf/aprobacion","urlOpcional":"https://api.empresa.com/ecf/auth","urlRecepcion":"https://api.empresa.com/ecf/recepcion"}},"TaxpayerDirectoryList":{"properties":{"taxpayers":{"items":{"$ref":"#/components/schemas/TaxpayerDirectory"},"type":"array","title":"Taxpayers","description":"List of authorized electronic taxpayers"},"total":{"type":"integer","title":"Total","description":"Total number of taxpayers in list"}},"type":"object","required":["taxpayers","total"],"title":"TaxpayerDirectoryList","description":"List of taxpayer directory entries.\n\nWrapper for paginated or full directory listings.","example":{"taxpayers":[{"nombre":"EMPRESA EJEMPLO SRL","rnc":"131880738","urlAceptacion":"https://api.empresa.com/ecf/aprobacion","urlOpcional":"https://api.empresa.com/ecf/auth","urlRecepcion":"https://api.empresa.com/ecf/recepcion"}],"total":1}},"TimbreFCVerificationRequest":{"properties":{"rnc_emisor":{"type":"string","title":"Rnc Emisor","description":"Issuer RNC"},"encf":{"type":"string","title":"Encf","description":"Electronic invoice number (e-NCF)"},"monto_total":{"type":"string","title":"Monto Total","description":"Total amount"},"codigo_seguridad":{"type":"string","title":"Codigo Seguridad","description":"Security code from QR"}},"type":"object","required":["rnc_emisor","encf","monto_total","codigo_seguridad"],"title":"TimbreFCVerificationRequest","description":"Consumer Invoice (FC) Timbre Verification Request.\n\nParameters extracted from QR code on printed consumer invoice (< RD$250,000).\n\nExample:\n    {\n        \"rnc_emisor\": \"131880738\",\n        \"encf\": \"e320000000064\",\n        \"monto_total\": \"6225.09\",\n        \"codigo_seguridad\": \"uabnyh\"\n    }","example":{"codigo_seguridad":"uabnyh","encf":"e320000000064","monto_total":"6225.09","rnc_emisor":"131880738"}},"TimbreVerificationRequest":{"properties":{"rnc_emisor":{"type":"string","title":"Rnc Emisor","description":"Issuer RNC"},"rnc_comprador":{"type":"string","title":"Rnc Comprador","description":"Buyer RNC"},"encf":{"type":"string","title":"Encf","description":"Electronic invoice number (e-NCF)"},"fecha_emision":{"type":"string","title":"Fecha Emision","description":"Issue date (DD-MM-YYYY)"},"monto_total":{"type":"string","title":"Monto Total","description":"Total amount"},"fecha_firma":{"type":"string","title":"Fecha Firma","description":"Signature date and time (DD-MM-YYYY HH:MM:SS)"},"codigo_seguridad":{"type":"string","title":"Codigo Seguridad","description":"Security code from QR"}},"type":"object","required":["rnc_emisor","rnc_comprador","encf","fecha_emision","monto_total","fecha_firma","codigo_seguridad"],"title":"TimbreVerificationRequest","description":"Regular e-CF Timbre Verification Request.\n\nParameters extracted from QR code on printed invoice representation.\n\nExample:\n    {\n        \"rnc_emisor\": \"130000001\",\n        \"rnc_comprador\": \"130000002\",\n        \"encf\": \"e310000000001\",\n        \"fecha_emision\": \"10-10-2020\",\n        \"monto_total\": \"02.11\",\n        \"fecha_firma\": \"10-10-2020 09:00:00\",\n        \"codigo_seguridad\": \"dcp79q\"\n    }","example":{"codigo_seguridad":"dcp79q","encf":"e310000000001","fecha_emision":"10-10-2020","fecha_firma":"10-10-2020 09:00:00","monto_total":"02.11","rnc_comprador":"130000002","rnc_emisor":"130000001"}},"TopClientAggregate":{"properties":{"rnc":{"type":"string","title":"Rnc","description":"RNC of the buyer"},"name":{"type":"string","title":"Name","description":"Buyer's business name (most recent snapshot seen)"},"count":{"type":"integer","title":"Count","description":"Number of invoices issued to this buyer"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount","description":"Sum of total_amount for this buyer"}},"type":"object","required":["rnc","name","count","amount"],"title":"TopClientAggregate","description":"One buyer's invoice count + amount, for the top-clients ranking."},"TrackIdEntry":{"properties":{"track_id":{"type":"string","title":"Track Id","description":"DGII tracking identifier"},"submission_timestamp":{"type":"string","format":"date-time","title":"Submission Timestamp","description":"When submission was sent"},"status":{"type":"string","title":"Status","description":"Current status: Pending, Sent, Accepted, Rejected"},"dgii_response_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dgii Response Code","description":"DGII response code"},"comment_dgii":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment Dgii","description":"DGII response message"}},"type":"object","required":["track_id","submission_timestamp","status"],"title":"TrackIdEntry","description":"Single TrackId entry with submission details."},"TrackIdsResponse":{"properties":{"rnc_issuing":{"type":"string","title":"Rnc Issuing","description":"RNC of the issuer"},"encf":{"type":"string","title":"Encf","description":"e-NCF number"},"total_submissions":{"type":"integer","title":"Total Submissions","description":"Total number of submissions found"},"track_ids":{"items":{"$ref":"#/components/schemas/TrackIdEntry"},"type":"array","title":"Track Ids","description":"List of all TrackIds for this eNCF"}},"type":"object","required":["rnc_issuing","encf","total_submissions","track_ids"],"title":"TrackIdsResponse","description":"Response schema for GET /trackids/{encf} endpoint.\nReturns all TrackIds for a given eNCF."},"TypeAggregate":{"properties":{"ecf_type":{"type":"string","title":"Ecf Type","description":"e-CF type code (31-34, 41, 43-47)"},"count":{"type":"integer","title":"Count","description":"Number of invoices of this type"},"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Amount","description":"Sum of total_amount for this type"}},"type":"object","required":["ecf_type","count","amount"],"title":"TypeAggregate","description":"Invoice count + amount for one e-CF type."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"XmlItem":{"properties":{"xml":{"type":"string","format":"binary","title":"Xml","description":"Signed XML document content"}},"type":"object","required":["xml"],"title":"XmlItem","description":"Model for XML document submission.\nUsed for ECF and RFCE documents sent to DGII."}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Company API key. Validated at the GCP API Gateway."}}},"tags":[{"name":"Authentication","description":"The API handles authentication against the DGII for you. Under the hood, the DGII uses a **seed + digital certificate** scheme: a seed is requested, signed with the taxpayer's certificate, and exchanged for a **Bearer token valid for 1 hour**.\n\n## How it works in this API\n- Upload your company's digital certificate once (certificate endpoints).\n- `GET /obtain_token` obtains and caches the DGII token per RNC, renewing it only when it expires.\n- The token is used internally as `Authorization: Bearer {token}` on every call to the DGII. You only authenticate with your `x-api-key` header.\n\n## Underlying DGII flow (reference)\n1. Request a **seed** — XML with `valor` and `fecha`.\n2. **Sign** the seed with the digital certificate.\n3. **Validate** the signed seed → token (`expedido`, `expira`).\n\n> The certificate must be valid and the signer must be an **authorized delegate** of the issuing RNC.\n"},{"name":"Emission","description":"Building, signing, and sending e-CF to the DGII. You send the document data and the API performs **JSON → XML → signing → submission**, returning a **TrackId** (acknowledgment) to query the result.\n\n## Types and routing\n- **General e-CF** (types 31, 33, 34, 41, 43–47, and Consumo 32 ≥ RD$250,000): **e-CF Reception** service.\n- **Consumo Invoice 32 < RD$250,000**: a **Summary (RFCE)** with the main information is sent; the issuer keeps the extended e-CF.\n\n## Response\n- `trackId` — unique submission identifier; use it in **Query** to see the final result.\n- `status` / `estado` — `Aceptado`, `Aceptado condicional`, or `Rechazado`.\n- `xml` — signed XML · `qr_url` — verification stamp · `messages` — DGII codes/messages.\n\n## Key rules\n- The XML file is named using the `RNC+e-NCF` format (e.g. `101672919E310000001`).\n- In RFCE, `secuenciaUtilizada` indicates whether the eNCF can be reused after a rejection (`false` = it can).\n\n> **Field reference:** the complete e-CF structure — field by field, with XML tag, type, length, and requirement per type — is in the [e-CF Format Reference](/developers/formato-ecf).\n"},{"name":"Query","description":"Verification of the status or result of an e-CF, by **TrackId** or by the document identifiers.\n\n## Query types\n- **Result by TrackId** — submission processing status (`/invoice-status/{track_id}`).\n- **Status by document** — by `RncEmisor` + `eNCF` (+ `RncComprador` / `CodigoSeguridad`).\n- **TrackIds by eNCF** — all submissions of the same eNCF (`/trackids/{encf}`).\n- **Document listing** — by RNC and date range.\n\n## Result codes (DGII)\n| Code | Status | Meaning |\n|---|---|---|\n| 0 | Not found | TrackId not registered |\n| 1 | Aceptado | Valid, with fiscal validity |\n| 2 | Rechazado | Void for tax purposes |\n| 3 | En Proceso | Not yet validated (≈200 ms) |\n| 4 | Aceptado Condicional | Observed, but with fiscal validity |\n\n> The `CodigoSeguridad` is the **first 6 digits** of the hash of the e-CF signature's `SignatureValue`. The requester must be **delegated** by the issuer or the receiver.\n"},{"name":"Reception","description":"Reception of e-CF issued by your suppliers and emission of the **acknowledgment of receipt (ARECF)**.\n\n## How it works\n- Your supplier (or the DGII) delivers the e-CF to your reception inbox (`/fe/recepcion/api/ecf`).\n- The API validates the document (structure/XSD, digital signature, duplicate, buyer RNC) and responds with the corresponding **ARECF**.\n- You query the received documents and their acknowledgments.\n\n## ARECF statuses\n- **Received (0)** — the e-CF was received successfully.\n- **Not received (1)** — with `CodigoMotivoNoRecibido`:\n  - `1` Specification error (XSD / rules)\n  - `2` Digital signature error\n  - `3` Duplicate submission\n  - `4` Buyer RNC does not match\n\n> In production, issuer and receiver communicate directly using the URLs published in the **Services Directory**. The receiver's prior authentication follows the same seed → token scheme.\n"},{"name":"Cancellation","description":"Cancellation of **unused e-NCF sequence ranges** (ANECF).\n\n## How it works\nYou send one or more ranges (`SecuenciaeNCFDesde` → `SecuenciaeNCFHasta`) per document type; the DGII validates and cancels the unused sequences (`POST /anecf/`).\n\n## Key rules\n- `SecuenciaeNCFDesde` cannot be greater than `SecuenciaeNCFHasta`; the `NoLinea` field must be in sequential order.\n- Sequences that are **already used are rejected** individually — a partial response is possible (all are cancelled except those in the detail).\n- A **cancelled sequence cannot be reused**.\n- For Consumo (32), the system validates that the sequence has not been used in any channel (amounts ≷ RD$250,000) before cancelling.\n- The certificate must be **delegated** for the taxpayer's RNC.\n"},{"name":"Commercial Approval","description":"Commercial approval or rejection of an e-CF received from a supplier (**ACECF**). It expresses the receiver's agreement with the transaction; the document is sent simultaneously to the issuer and to the DGII.\n\n## How it works\n`POST /acecf/` with the approval detail. The API builds, signs, and sends the ACECF.\n\n## Status / codes\n- **Approved (1)** — commercial approval validated successfully.\n- **Rejected (2)** — requires `rejection_code`:\n  - `1` Goods/services not received\n  - `2` Defective goods/services\n  - `3` Other (specify in `rejection_description`)\n\n## Key rules\n- The XML must be valid (XSD) and the signature valid; the certificate's RNC must be **delegated** by the issuer.\n- Commercial approval is **not required** for certain e-CF types nor for referenced e-CF.\n- It must be sent within the **regulatory deadline** after the invoice is received.\n"},{"name":"Directory","description":"Directory of taxpayers authorized for electronic invoicing and the **URLs of their services** (e-CF reception, commercial approval, and, optionally, authentication).\n\n## What it's for\nBefore sending an e-CF or a commercial approval to another taxpayer, you query the directory to discover **where** to send it.\n\n## Endpoints\n- **Full listing** of authorized taxpayers (`/directory/taxpayers`).\n- **By specific RNC** (`/directory/taxpayers/{rnc}`).\n\n## Fields per taxpayer\n- `nombre`, `rnc` — taxpayer's legal name and registration.\n- `urlRecepcion` — host of the e-CF reception service.\n- `urlAceptacion` — host of the commercial approval service.\n- `urlOpcional` — host of the authentication service (if the taxpayer uses it).\n"},{"name":"Monitoring","description":"DGII service status and stamp verification."},{"name":"Developer","description":"Resources for developers: error catalog and llms.txt index."}],"servers":[{"url":"https://test.fixcal.do","description":"Sandbox / testing (env header: TesteCF or CerteCF)"},{"url":"https://api.fixcal.do","description":"Production (env header: eCF)"}],"security":[{"ApiKeyAuth":[]}]}