{"openapi":"3.1.0","info":{"title":"4invoices Public API","version":"1.0.0","summary":"Issue invoices and drive ANAF e-Factura programmatically.","description":"REST API for sending invoicing data into 4invoices from your own system (ERP, shop, CRM).\n\n**Test mode.** A credential created with *Mod: Test* (`cli_test_…`) uses the same endpoints but produces nothing fiscal: numbers come from an auto-created `TEST` series, e-Factura is simulated (the CIUS-RO validation is still the real one; nothing is sent to ANAF), the plan quota is untouched, and test documents are invisible to live credentials and to the panel. Responses carry `livemode: false`. Create the invoice with `metadata.test_efactura = \"rejected\"` to get a simulated ANAF rejection on refresh. The signed-response download and the inbox endpoints answer `409 not_available_in_test_mode` (the inbox list is empty). Test events are delivered only to webhook endpoints created in test mode.\n\n**Authentication.** Mint a credential in the panel under *Facturare → Setări → Acces API*, then exchange it for a token:\n\n```\nPOST /v1/auth/token\n{\"grant_type\":\"client_credentials\",\"client_id\":\"cli_...\",\"client_secret\":\"sec_...\"}\n```\n\nSend the result as `Authorization: Bearer <access_token>`. Tokens last one hour. The `client_secret` is shown once, at creation — it is stored only as a hash and cannot be recovered.\n\n**Revocation is not instant.** Revoking a credential immediately stops it minting *new* tokens, but a token already issued stays valid until it expires — up to one hour. If you believe a secret leaked, revoke it and treat the following hour as exposed.\n\n**Server-to-server only.** Never call this API from browser JavaScript: the `client_secret` would be exposed. No browser origin is allowed by CORS.\n\n**Idempotency.** `POST /invoices`, `POST /invoices/{id}/storno` and `POST /invoices/{id}/efactura/submit` require an `Idempotency-Key` header. Issuing a fiscal document and submitting to ANAF are legally irreversible, so a retry after a timeout must never create a second one.\n\n**VAT rates are percents.** Send `21`, not `0.21`.\n\n**Before you issue,** complete the company profile in the panel (*Facturare → Setări → Companie*) and configure at least one active `fiscale` series. Without them issuance returns `issuer_profile_incomplete` or `no_series_configured` rather than producing an invalid invoice.","contact":{"name":"4invoices","url":"https://4invoices.net/ro/contact"}},"servers":[{"url":"https://api.4invoices.net/v1","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Auth","description":"Token exchange and credential introspection."},{"name":"Invoices","description":"Issue, list, read, storno, mark paid, PDF and UBL/XML."},{"name":"Clients","description":"Customer records and ANAF registry lookup."},{"name":"Series","description":"Document numbering series."},{"name":"e-Factura","description":"ANAF SPV: validate, submit, track, and read inbound supplier invoices."},{"name":"Webhooks","description":"Signed outbound notifications. Endpoints are managed in the panel, not through this API."}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}},"InvoiceCreate":{"type":"object","required":["buyer","lines"],"properties":{"buyer":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":255},"tax_id":{"type":"string","description":"CUI/VAT id, with or without the country prefix."},"trade_register":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"county":{"type":"string","description":"For Romania, the real county name; for Bucharest use a sector as the city."},"country":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"iban":{"type":"string"}}},"lines":{"type":"array","minItems":1,"maxItems":400,"items":{"type":"object","required":["description","unit_price"],"properties":{"description":{"type":"string","maxLength":1024},"quantity":{"type":"number","exclusiveMinimum":0,"default":1},"unit_price":{"type":"number","minimum":0,"description":"NET unit price when the issuer is a VAT payer."},"vat_rate":{"type":"number","minimum":0,"maximum":100,"default":21,"description":"VAT as a PERCENT (21), never a fraction. Values in (0, 1] are rejected: 0.19 is a fraction, and 1 is ambiguous between 1% and 100%."},"unit":{"type":"string","default":"buc"},"sku":{"type":"string"}}}},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"RON"},"issue_date":{"type":"string","format":"date","description":"ISO YYYY-MM-DD. Defaults to today (UTC)."},"due_date":{"type":"string","format":"date","description":"ISO YYYY-MM-DD. Defaults to issue_date."},"document_kind":{"type":"string","enum":["factura","proforma"],"default":"factura"},"notes":{"type":"array","items":{"type":"string"},"maxItems":20},"metadata":{"type":"object","description":"Echoed back on reads. Use it for your own order id."}}},"Invoice":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"invoice"},"number":{"type":"string","nullable":true},"series":{"type":"string","nullable":true},"document_kind":{"type":"string","enum":["factura","proforma"]},"status":{"type":"string","enum":["draft","issued"]},"payment_status":{"type":"string","nullable":true},"currency":{"type":"string"},"issue_date":{"type":"string","nullable":true},"due_date":{"type":"string","nullable":true},"buyer":{"type":"object"},"lines":{"type":"array","items":{"type":"object"}},"totals":{"type":"object","properties":{"net":{"type":"number"},"vat":{"type":"number"},"gross":{"type":"number"}}},"notes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"},"livemode":{"type":"boolean","description":"false for documents created with a test credential."},"created_at":{"type":"string","format":"date-time","nullable":true}}},"List":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}},"Totals":{"type":"object","properties":{"net":{"type":"number"},"vat":{"type":"number"},"gross":{"type":"number"}}},"EfacturaStatus":{"type":"string","enum":["not_sent","validating","queued","sent","processing","accepted","rejected","error"],"description":"Normalized lifecycle. `accepted` means ANAF accepted the invoice and it is legally transmitted. `rejected` means ANAF refused it — fix the errors and submit again. `error` is a transport or authentication failure on our side and is safe to retry."}}},"webhooks":{"invoice.issued":{"post":{"tags":["Webhooks"],"summary":"An invoice or proforma was issued","description":"Sent to every HTTPS endpoint registered in the panel (Setări → Acces API → Webhook-uri) that subscribed to this event. Signed: `X-4invoices-Signature: t=<unix>,v1=<hex>` where `v1 = HMAC_SHA256(secret, t + \".\" + raw_body)`; reject a `t` older than 5 minutes. Answer 2xx within 10 s. Anything else is retried at 1m, 5m, 30m, 2h, 6h, 12h, 24h. Redirects are not followed. Deliveries can repeat and arrive out of order — dedupe on `id`.","parameters":[{"name":"X-4invoices-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event-Id","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created","api_version","data"],"properties":{"id":{"type":"string","description":"evt_… — stable across retries."},"type":{"type":"string","const":"invoice.issued"},"created":{"type":"integer","description":"Unix seconds."},"api_version":{"type":"string","const":"v1"},"data":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/Invoice"}}}}}}}},"responses":{"2XX":{"description":"Acknowledged."}}}},"invoice.storno_issued":{"post":{"tags":["Webhooks"],"summary":"A storno (reversal) invoice was issued","description":"Sent to every HTTPS endpoint registered in the panel (Setări → Acces API → Webhook-uri) that subscribed to this event. Signed: `X-4invoices-Signature: t=<unix>,v1=<hex>` where `v1 = HMAC_SHA256(secret, t + \".\" + raw_body)`; reject a `t` older than 5 minutes. Answer 2xx within 10 s. Anything else is retried at 1m, 5m, 30m, 2h, 6h, 12h, 24h. Redirects are not followed. Deliveries can repeat and arrive out of order — dedupe on `id`.","parameters":[{"name":"X-4invoices-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event-Id","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created","api_version","data"],"properties":{"id":{"type":"string","description":"evt_… — stable across retries."},"type":{"type":"string","const":"invoice.storno_issued"},"created":{"type":"integer","description":"Unix seconds."},"api_version":{"type":"string","const":"v1"},"data":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/Invoice"}}}}}}}},"responses":{"2XX":{"description":"Acknowledged."}}}},"invoice.paid":{"post":{"tags":["Webhooks"],"summary":"An invoice was marked as paid","description":"Sent to every HTTPS endpoint registered in the panel (Setări → Acces API → Webhook-uri) that subscribed to this event. Signed: `X-4invoices-Signature: t=<unix>,v1=<hex>` where `v1 = HMAC_SHA256(secret, t + \".\" + raw_body)`; reject a `t` older than 5 minutes. Answer 2xx within 10 s. Anything else is retried at 1m, 5m, 30m, 2h, 6h, 12h, 24h. Redirects are not followed. Deliveries can repeat and arrive out of order — dedupe on `id`.","parameters":[{"name":"X-4invoices-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event-Id","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created","api_version","data"],"properties":{"id":{"type":"string","description":"evt_… — stable across retries."},"type":{"type":"string","const":"invoice.paid"},"created":{"type":"integer","description":"Unix seconds."},"api_version":{"type":"string","const":"v1"},"data":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/Invoice"}}}}}}}},"responses":{"2XX":{"description":"Acknowledged."}}}},"invoice.unpaid":{"post":{"tags":["Webhooks"],"summary":"A payment was removed","description":"Sent to every HTTPS endpoint registered in the panel (Setări → Acces API → Webhook-uri) that subscribed to this event. Signed: `X-4invoices-Signature: t=<unix>,v1=<hex>` where `v1 = HMAC_SHA256(secret, t + \".\" + raw_body)`; reject a `t` older than 5 minutes. Answer 2xx within 10 s. Anything else is retried at 1m, 5m, 30m, 2h, 6h, 12h, 24h. Redirects are not followed. Deliveries can repeat and arrive out of order — dedupe on `id`.","parameters":[{"name":"X-4invoices-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event-Id","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created","api_version","data"],"properties":{"id":{"type":"string","description":"evt_… — stable across retries."},"type":{"type":"string","const":"invoice.unpaid"},"created":{"type":"integer","description":"Unix seconds."},"api_version":{"type":"string","const":"v1"},"data":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/Invoice"}}}}}}}},"responses":{"2XX":{"description":"Acknowledged."}}}},"efactura.status_changed":{"post":{"tags":["Webhooks"],"summary":"The public e-Factura status of a submission changed","description":"Sent to every HTTPS endpoint registered in the panel (Setări → Acces API → Webhook-uri) that subscribed to this event. Signed: `X-4invoices-Signature: t=<unix>,v1=<hex>` where `v1 = HMAC_SHA256(secret, t + \".\" + raw_body)`; reject a `t` older than 5 minutes. Answer 2xx within 10 s. Anything else is retried at 1m, 5m, 30m, 2h, 6h, 12h, 24h. Redirects are not followed. Deliveries can repeat and arrive out of order — dedupe on `id`.","parameters":[{"name":"X-4invoices-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event","in":"header","required":true,"schema":{"type":"string"}},{"name":"X-4invoices-Event-Id","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","created","api_version","data"],"properties":{"id":{"type":"string","description":"evt_… — stable across retries."},"type":{"type":"string","const":"efactura.status_changed"},"created":{"type":"integer","description":"Unix seconds."},"api_version":{"type":"string","const":"v1"},"data":{"type":"object","properties":{"submission":{"type":"object","properties":{"id":{"type":"string"},"invoice_id":{"type":["string","null"]},"status":{"$ref":"#/components/schemas/EfacturaStatus"},"previous_status":{"$ref":"#/components/schemas/EfacturaStatus"},"anaf_reference":{"type":["string","null"]},"error":{"type":["string","null"]}}}}}}}}}},"responses":{"2XX":{"description":"Acknowledged."}}}}},"paths":{"/auth/token":{"post":{"tags":["Auth"],"summary":"Exchange credentials for an access token","security":[],"description":"OAuth2 client_credentials (RFC 6749 §4.4). Accepts a JSON body, an application/x-www-form-urlencoded body, or HTTP Basic (client_id:client_secret) with grant_type in the form body.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"grant_type":{"type":"string","const":"client_credentials"},"client_id":{"type":"string","description":"Omit when sent via HTTP Basic."},"client_secret":{"type":"string","description":"Omit when sent via HTTP Basic."}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"grant_type":{"type":"string","const":"client_credentials"},"client_id":{"type":"string","description":"Omit when sent via HTTP Basic."},"client_secret":{"type":"string","description":"Omit when sent via HTTP Basic."}}}}}},"responses":{"200":{"description":"Token issued","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string","const":"Bearer"},"expires_in":{"type":"integer","example":3600},"scope":{"type":"string","description":"Space-delimited granted scopes."}}}}}},"401":{"description":"invalid_client","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Too many token requests from this IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/me":{"get":{"tags":["Auth"],"summary":"Who am I — tenant, scopes and current limits","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices":{"post":{"tags":["Invoices"],"summary":"Issue an invoice or proforma","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":255},"description":"Required. A unique string per logical operation. Replaying the same key with the same body returns the original result and sets `Idempotency-Replayed: true`; the same key with a different body returns 409. Keys are remembered for 24 hours."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["buyer","lines"],"properties":{"buyer":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":255},"tax_id":{"type":"string","description":"CUI/VAT id, with or without the country prefix."},"trade_register":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"county":{"type":"string","description":"For Romania, the real county name; for Bucharest use a sector as the city."},"country":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"iban":{"type":"string"}}},"lines":{"type":"array","minItems":1,"maxItems":400,"items":{"type":"object","required":["description","unit_price"],"properties":{"description":{"type":"string","maxLength":1024},"quantity":{"type":"number","exclusiveMinimum":0,"default":1},"unit_price":{"type":"number","minimum":0,"description":"NET unit price when the issuer is a VAT payer."},"vat_rate":{"type":"number","minimum":0,"maximum":100,"default":21,"description":"VAT as a PERCENT (21), never a fraction. Values in (0, 1] are rejected: 0.19 is a fraction, and 1 is ambiguous between 1% and 100%."},"unit":{"type":"string","default":"buc"},"sku":{"type":"string"}}}},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"RON"},"issue_date":{"type":"string","format":"date","description":"ISO YYYY-MM-DD. Defaults to today (UTC)."},"due_date":{"type":"string","format":"date","description":"ISO YYYY-MM-DD. Defaults to issue_date."},"document_kind":{"type":"string","enum":["factura","proforma"],"default":"factura"},"notes":{"type":"array","items":{"type":"string"},"maxItems":20},"metadata":{"type":"object","description":"Echoed back on reads. Use it for your own order id."}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"invoice"},"number":{"type":"string","nullable":true},"series":{"type":"string","nullable":true},"document_kind":{"type":"string","enum":["factura","proforma"]},"status":{"type":"string","enum":["draft","issued"]},"payment_status":{"type":"string","nullable":true},"currency":{"type":"string"},"issue_date":{"type":"string","nullable":true},"due_date":{"type":"string","nullable":true},"buyer":{"type":"object"},"lines":{"type":"array","items":{"type":"object"}},"totals":{"type":"object","properties":{"net":{"type":"number"},"vat":{"type":"number"},"gross":{"type":"number"}}},"notes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"},"livemode":{"type":"boolean","description":"false for documents created with a test credential."},"created_at":{"type":"string","format":"date-time","nullable":true}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"200":{"description":"Replay of a previous call with the same Idempotency-Key","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"invoice"},"number":{"type":"string","nullable":true},"series":{"type":"string","nullable":true},"document_kind":{"type":"string","enum":["factura","proforma"]},"status":{"type":"string","enum":["draft","issued"]},"payment_status":{"type":"string","nullable":true},"currency":{"type":"string"},"issue_date":{"type":"string","nullable":true},"due_date":{"type":"string","nullable":true},"buyer":{"type":"object"},"lines":{"type":"array","items":{"type":"object"}},"totals":{"type":"object","properties":{"net":{"type":"number"},"vat":{"type":"number"},"gross":{"type":"number"}}},"notes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"},"livemode":{"type":"boolean","description":"false for documents created with a test credential."},"created_at":{"type":"string","format":"date-time","nullable":true}}}}}},"409":{"description":"`idempotency_key_reuse`, `no_series_configured`","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"422":{"description":"`validation_failed`, `issuer_profile_incomplete`, fraction VAT rate","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}},"get":{"tags":["Invoices"],"summary":"List invoices (filterable, cursor-paginated)","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"`next_cursor` from the previous page."},{"name":"document_kind","in":"query","schema":{"type":"string","enum":["factura","proforma","storno"]}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","issued"]}},{"name":"payment_status","in":"query","schema":{"type":"string"}},{"name":"number","in":"query","schema":{"type":"string"}},{"name":"buyer_tax_id","in":"query","schema":{"type":"string"}},{"name":"issued_from","in":"query","schema":{"type":"string","format":"date"}},{"name":"issued_to","in":"query","schema":{"type":"string","format":"date"}},{"name":"q","in":"query","schema":{"type":"string"},"description":"Substring match on buyer name or invoice number."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices/preview-totals":{"post":{"tags":["Invoices"],"summary":"Compute totals without creating anything","description":"Same arithmetic as issuance, no side effects, no fiscal number consumed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["buyer","lines"],"properties":{"buyer":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":255},"tax_id":{"type":"string","description":"CUI/VAT id, with or without the country prefix."},"trade_register":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"county":{"type":"string","description":"For Romania, the real county name; for Bucharest use a sector as the city."},"country":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"iban":{"type":"string"}}},"lines":{"type":"array","minItems":1,"maxItems":400,"items":{"type":"object","required":["description","unit_price"],"properties":{"description":{"type":"string","maxLength":1024},"quantity":{"type":"number","exclusiveMinimum":0,"default":1},"unit_price":{"type":"number","minimum":0,"description":"NET unit price when the issuer is a VAT payer."},"vat_rate":{"type":"number","minimum":0,"maximum":100,"default":21,"description":"VAT as a PERCENT (21), never a fraction. Values in (0, 1] are rejected: 0.19 is a fraction, and 1 is ambiguous between 1% and 100%."},"unit":{"type":"string","default":"buc"},"sku":{"type":"string"}}}},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"RON"},"issue_date":{"type":"string","format":"date","description":"ISO YYYY-MM-DD. Defaults to today (UTC)."},"due_date":{"type":"string","format":"date","description":"ISO YYYY-MM-DD. Defaults to issue_date."},"document_kind":{"type":"string","enum":["factura","proforma"],"default":"factura"},"notes":{"type":"array","items":{"type":"string"},"maxItems":20},"metadata":{"type":"object","description":"Echoed back on reads. Use it for your own order id."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"invoice.preview"},"currency":{"type":"string"},"lines":{"type":"array","items":{"type":"object"}},"totals":{"type":"object","properties":{"net":{"type":"number"},"vat":{"type":"number"},"gross":{"type":"number"}}}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices/{invoice_id}":{"get":{"tags":["Invoices"],"summary":"Retrieve one invoice","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"invoice"},"number":{"type":"string","nullable":true},"series":{"type":"string","nullable":true},"document_kind":{"type":"string","enum":["factura","proforma"]},"status":{"type":"string","enum":["draft","issued"]},"payment_status":{"type":"string","nullable":true},"currency":{"type":"string"},"issue_date":{"type":"string","nullable":true},"due_date":{"type":"string","nullable":true},"buyer":{"type":"object"},"lines":{"type":"array","items":{"type":"object"}},"totals":{"type":"object","properties":{"net":{"type":"number"},"vat":{"type":"number"},"gross":{"type":"number"}}},"notes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"},"livemode":{"type":"boolean","description":"false for documents created with a test credential."},"created_at":{"type":"string","format":"date-time","nullable":true}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"404":{"description":"Not found (also for another tenant's id)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices/{invoice_id}/pdf":{"get":{"tags":["Invoices"],"summary":"Download the invoice PDF","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"PDF bytes","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthenticated","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices/{invoice_id}/xml":{"get":{"tags":["Invoices"],"summary":"Download the UBL / CIUS-RO XML","description":"Generated without submitting anything to ANAF.","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"UBL XML","content":{"application/xml":{"schema":{"type":"string"}}}},"401":{"description":"Unauthenticated","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices/{invoice_id}/storno":{"post":{"tags":["Invoices"],"summary":"Issue a credit note reversing this invoice","description":"The storno gets its own fiscal number; the original's is never reused.","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":255},"description":"Required. A unique string per logical operation. Replaying the same key with the same body returns the original result and sets `Idempotency-Replayed: true`; the same key with a different body returns 409. Keys are remembered for 24 hours."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":512}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"invoice"},"number":{"type":"string","nullable":true},"series":{"type":"string","nullable":true},"document_kind":{"type":"string","enum":["factura","proforma"]},"status":{"type":"string","enum":["draft","issued"]},"payment_status":{"type":"string","nullable":true},"currency":{"type":"string"},"issue_date":{"type":"string","nullable":true},"due_date":{"type":"string","nullable":true},"buyer":{"type":"object"},"lines":{"type":"array","items":{"type":"object"}},"totals":{"type":"object","properties":{"net":{"type":"number"},"vat":{"type":"number"},"gross":{"type":"number"}}},"notes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"},"livemode":{"type":"boolean","description":"false for documents created with a test credential."},"created_at":{"type":"string","format":"date-time","nullable":true}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"422":{"description":"`cannot_storno_draft`, `nothing_to_storno`","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices/{invoice_id}/payments":{"post":{"tags":["Invoices"],"summary":"Mark the invoice as paid","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"amount_cents":{"type":"integer","description":"Paid amount in minor units. Defaults to the gross total."},"paid_at":{"type":"string","description":"ISO datetime of the actual encashment. Defaults to now."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}},"delete":{"tags":["Invoices"],"summary":"Mark the invoice as unpaid","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/clients":{"get":{"tags":["Clients"],"summary":"List clients","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"q","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}},"post":{"tags":["Clients"],"summary":"Create or update a client","description":"Deduplicated on tax id, falling back to a normalized name — re-sending the same customer updates it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"tax_id":{"type":"string"},"trade_register":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"contact_person":{"type":"string"},"country":{"type":"string"},"county":{"type":"string"},"city":{"type":"string"},"address":{"type":"string"},"iban":{"type":"string"},"bank_name":{"type":"string"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/lookup/company/{tax_id}":{"get":{"tags":["Clients"],"summary":"Validate a CUI against the ANAF registry","description":"Pre-fill a buyer with official registry data so ANAF does not reject the e-Factura.","parameters":[{"name":"tax_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/series":{"get":{"tags":["Series"],"summary":"List numbering series","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices/{invoice_id}/efactura/validate":{"post":{"tags":["e-Factura"],"summary":"CIUS-RO preflight — validate without sending","description":"Returns the exact fields ANAF would reject. Always call this before submitting.","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"include_xml","in":"query","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"invoice_id":{"type":"string"},"valid":{"type":"boolean"},"errors":{"type":"array","items":{"type":"string"}},"xml_base64":{"type":"string"}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/invoices/{invoice_id}/efactura/submit":{"post":{"tags":["e-Factura"],"summary":"Submit the invoice to ANAF (SPV)","description":"Irreversible: a second copy of the same invoice in the SPV cannot be withdrawn. Requires the `efactura:submit` scope and an `Idempotency-Key`.","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":255},"description":"Required. A unique string per logical operation. Replaying the same key with the same body returns the original result and sets `Idempotency-Replayed: true`; the same key with a different body returns 409. Keys are remembered for 24 hours."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"submission_id":{"type":"string"},"status":{"type":"string","enum":["not_sent","validating","queued","sent","processing","accepted","rejected","error"],"description":"Normalized lifecycle. `accepted` means ANAF accepted the invoice and it is legally transmitted. `rejected` means ANAF refused it — fix the errors and submit again. `error` is a transport or authentication failure on our side and is safe to retry."}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"422":{"description":"`cius_ro_incomplete` — see `error.errors[]`","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"404":{"description":"Not a Romanian tenant, or invoice not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/efactura/submissions":{"get":{"tags":["e-Factura"],"summary":"List ANAF submissions","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"invoice_id","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/efactura/submissions/{submission_id}":{"get":{"tags":["e-Factura"],"summary":"Retrieve one submission","parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["not_sent","validating","queued","sent","processing","accepted","rejected","error"],"description":"Normalized lifecycle. `accepted` means ANAF accepted the invoice and it is legally transmitted. `rejected` means ANAF refused it — fix the errors and submit again. `error` is a transport or authentication failure on our side and is safe to retry."},"upload_index":{"type":"string","nullable":true,"description":"ANAF `index_incarcare`."},"download_id":{"type":"string","nullable":true,"description":"ANAF `id_descarcare`."},"anaf_status_raw":{"type":"string","nullable":true,"description":"ANAF's own `stare`, verbatim."}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/efactura/submissions/{submission_id}/refresh":{"post":{"tags":["e-Factura"],"summary":"Ask ANAF for the current state","description":"Counts against the tighter submit rate bucket — ANAF throttles this upstream.","parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/efactura/submissions/{submission_id}/download":{"get":{"tags":["e-Factura"],"summary":"Download the signed response archive from ANAF","parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ZIP archive","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthenticated","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/efactura/inbox":{"get":{"tags":["e-Factura"],"summary":"Supplier invoices received via the SPV","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/efactura/inbox/{inbound_id}":{"get":{"tags":["e-Factura"],"summary":"Retrieve one inbound invoice","parameters":[{"name":"inbound_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/efactura/inbox/{inbound_id}/download":{"get":{"tags":["e-Factura"],"summary":"Download the inbound invoice archive","parameters":[{"name":"inbound_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ZIP archive","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthenticated","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}},"/efactura/inbox/sync":{"post":{"tags":["e-Factura"],"summary":"Pull new SPV messages into the inbox","description":"Counts against the submit rate bucket — ANAF allows roughly one message-list call per minute per CIF.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"403":{"description":"The credential lacks a required scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}},"429":{"description":"Rate limit exceeded — see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Coarse class to branch on.","enum":["invalid_request_error","authentication_error","permission_error","not_found_error","conflict_error","rate_limit_error","upstream_error","service_unavailable_error","api_error"]},"code":{"type":"string","description":"Stable machine-readable reason."},"message":{"type":"string"},"param":{"type":"string","description":"Dotted path of the offending field."},"doc_url":{"type":"string"},"request_id":{"type":"string","description":"Quote this in a support request."},"errors":{"type":"array","description":"Per-field problems, when there is more than one.","items":{"type":"object"}}}}}}}}}}}}}}