Emitir comprobante de retención
Numera el comprobante, lo guarda y lo encola para firmarlo y enviarlo al SRI. El estado avanza solo: consúltalo o recibe un webhook. Envía un Idempotency-Key para reintentar sin duplicar.
Tu clave API: fb_sandbox_… emite en Sandbox, fb_test_… en test, el servicio de pruebas de la autoridad tributaria, y fb_live_… en live, su producción.
En: header
Encabezados
1 <= length <= 255Cuerpo de la solicitud
application/json
Tipos de TypeScript
Usa el tipo request body en TypeScript.
La fecha de emisión es siempre hoy en Ecuador: los comprobantes se transmiten al emitirse.
Persona natural o sociedad (tipoSujetoRetenido), obligatorio si el proveedor tiene identificación del exterior.
Valores posibles
- "persona_natural"
- "sociedad"
Si el proveedor es parte relacionada (parteRel).
falseLos documentos del proveedor que sustentan la retención.
1 <= itemsLa máquina fiscal desde la que se emite el comprobante (anexo 13). Solo si lo emite una.
[]uuid^\d{3}$^\d{3}${}Cuerpo de la respuesta
application/json
application/json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X POST "https://example.com/v1/ec/withholdings" \ -H "Content-Type: application/json" \ -d '{ "supplier": { "identification_type": "ruc", "identification": "string", "name": "string", "email": "user@example.com" }, "support_documents": [ { "document_type": "factura", "number": "string", "issue_date": "2019-08-24", "tax_support": "10", "subtotal": "string", "total": "string", "taxes": [ { "type": "iva", "rate": "iva_15", "base": "string", "value": "string" } ], "withholdings": [ { "tax": "renta", "code": "strin", "base": "string" } ], "payments": [ { "method": "sin_sistema_financiero" } ] } ] }'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "country": "ec", "currency": "string", "environment": "sandbox", "status": "pending", "status_transitions": { "pending": "2019-08-24T14:15:22Z", "submitted": "2019-08-24T14:15:22Z", "authorized": "2019-08-24T14:15:22Z", "returned": "2019-08-24T14:15:22Z", "not_authorized": "2019-08-24T14:15:22Z", "annulled": "2019-08-24T14:15:22Z" }, "entity_id": "8161163a-f227-466f-bc01-090a01e80165", "number": "string", "access_key": "stringstringstringstringstringstringstringstrings", "authorization": { "number": "string", "authorized_at": "2019-08-24T14:15:22Z" }, "sri_messages": [ { "code": "string", "message": "string", "detail": "string", "type": "error" } ], "metadata": { "property1": "string", "property2": "string" }, "issued_at": "2019-08-24T14:15:22Z", "delivery_status": "sent", "emails": [ { "to": "string", "status": "sent", "sent_at": "2019-08-24T14:15:22Z", "delivered_at": "2019-08-24T14:15:22Z", "opened_at": "2019-08-24T14:15:22Z", "bounced_at": "2019-08-24T14:15:22Z", "complained_at": "2019-08-24T14:15:22Z", "bounce_type": "permanent" } ], "portal_views": 0, "portal_last_viewed_at": "2019-08-24T14:15:22Z", "channel": "api", "import_id": "13230382-dadc-41f2-963d-e123bd5c0585", "verification": "sri", "listing": { "import_id": "13230382-dadc-41f2-963d-e123bd5c0585", "file": "string", "entry": "string", "sha256": "stringstringstringstringstringstringstringstringstringstringstri", "line": 1, "authorized_at": "2019-08-24T14:15:22Z" }, "object": "withholding", "issue_date": "string", "fiscal_period": "string", "supplier": { "identification_type": "ruc", "identification": "string", "name": "string", "address": "string", "email": "string" }, "supplier_type": "persona_natural", "related_party": true, "support_documents": [ { "document_type": "factura", "number": "string", "issue_date": "string", "authorization_number": "string", "accounting_date": "string", "tax_support": "10", "foreign_payment": { "regime": "general", "country": "string", "double_taxation_treaty": true, "subject_to_withholding": true, "preferential_regime_payment": true }, "subtotal": "string", "total": "string", "taxes": [ { "type": "iva", "rate": "iva_15", "base": "string", "value": "string" } ], "withholdings": [ { "tax": "renta", "code": "string", "percent": "string", "base": "string", "value": "string", "dividends": { "payment_date": "string", "income_tax_paid": "string", "fiscal_year": "string" }, "banana_boxes": { "boxes": 0, "box_price": "string" } } ], "reimbursement": { "document_type": "factura", "total": "string", "base": "string", "tax": "string", "documents": [ { "supplier": { "identification_type": "ruc", "identification": "string" }, "supplier_type": "persona_natural", "payment_country": "string", "document_type": "factura", "number": "string", "issue_date": "string", "authorization_number": "string", "taxes": [ { "type": "iva", "rate": "iva_15", "base": "string", "value": "string" } ], "compensations": [ { "code": "string", "rate": "string", "value": "string" } ] } ] }, "payments": [ { "method": "sin_sistema_financiero", "amount": "string", "term": { "length": 0, "unit": "days" } } ] } ], "renta": "string", "iva": "string", "isd": "string", "total": "string", "fiscal_machine": { "brand": "string", "model": "string", "serial": "string" }, "additional_info": [ { "name": "string", "value": "string" } ], "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z"}Registrar la anulación de comprobante de retención POST
Solo registra una anulación que ya hiciste en SRI en línea; no la pide al SRI. El comprobante pasa a `annulled`, conserva sus archivos, sale del portal de tu cliente y se envía `<object>.annulled` a tus webhooks. Solo para uno `authorized`, y nunca para uno emitido a consumidor final, que el SRI no anula.
Listar comprobantes de retención GET
Del más reciente al más antiguo, en el ambiente de tu clave.