Submit invoice to e-invoice provider

Submits an issued invoice to the e-invoice provider. The invoice must be issued before it can be submitted. Changes the invoice status to sent_to_provider.

POST /api/v1/invoices/{uuid}/submit

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
X-CompanystringYesCompany UUID to scope the request

Path parameters

NameTypeRequiredDescription
uuidstringYesInvoice UUID

Prerequisites

Before submitting an invoice to the e-invoice provider, ensure:

  1. The invoice has been issued
  2. The company has valid provider credentials configured
  3. The invoice XML has been generated
  4. The company has an active connection to the e-invoice provider
ℹ️

After submission, the e-invoice provider will validate the invoice asynchronously. You can check the validation status by polling the invoice details endpoint or by listening to webhook events.

Request

curl -X POST https://api.storno.ro/api/v1/invoices/7c9e6679-7425-40de-944b-e07fc1f90ae7/submit \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "X-Company: 550e8400-e29b-41d4-a716-446655440000"

Response

Returns the updated invoice object with status sent_to_provider and submission details.

{
  "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "number": "FAC-2024-001",
  "status": "sent_to_provider",
  "direction": "outgoing",
  "currency": "RON",
  "issueDate": "2024-02-15",
  "dueDate": "2024-03-15",
  "subtotal": 1000.00,
  "vatTotal": 190.00,
  "total": 1190.00,
  "xmlGenerated": true,
  "xmlPath": "/storage/invoices/2024/02/7c9e6679-xml.xml",
  "anafSubmissionId": "ANAF-2024-123456",
  "anafDownloadId": "DL-987654",
  "anafValidationErrors": null,
  "events": [
    {
      "id": "4d5e6f7a-8b9c-0d1e-2f3a-4b5c6d7e8f9a",
      "type": "status_change",
      "status": "sent_to_provider",
      "timestamp": "2024-02-15T09:15:00Z",
      "details": "Invoice submitted to e-invoice provider successfully",
      "metadata": {
        "submissionId": "ANAF-2024-123456",
        "downloadId": "DL-987654"
      }
    }
  ],
  "updatedAt": "2024-02-15T09:15:00Z"
}

Response fields

FieldTypeDescription
anafSubmissionIdstringANAF submission identifier
anafDownloadIdstringANAF download identifier for the uploaded file
anafValidationErrorsarray|nullValidation errors from ANAF (populated after validation)

Provider validation process

After submission, the e-invoice provider validates the invoice in the background:

  1. Submitted (sent_to_provider) - Invoice uploaded to the provider
  2. Validating - The provider is processing the invoice
  3. Validated (validated) - Invoice passed provider validation
  4. Rejected (rejected) - Invoice failed provider validation

You can monitor the validation status through:

Error codes

CodeDescription
400Missing provider credentials or invalid configuration
401Missing or invalid authentication token
403No access to the specified company
404Invoice not found
409Invoice is not issued yet or already submitted
422XML generation failed or invalid XML format
503E-invoice provider service temporarily unavailable

Common submission errors

ErrorCauseSolution
No provider tokenCompany has not connected to the e-invoice providerComplete provider OAuth flow
Token expiredProvider OAuth token has expiredRefresh provider token
XML not generatedInvoice was not properly issuedRe-issue the invoice
Provider service downE-invoice provider is unavailableRetry later
Invalid XML formatData validation failedCheck invoice data and re-issue