Issue eInvoice from Draft API

Issue an eInvoice from a draft reference code via SePay eInvoice API. Returns a tracking code to monitor the issuance status with the tax authority.

||

API Endpoint

POST
https://einvoice-api.sepay.vn/v1/invoices/issue

API Request

reference_codestringrequired

Reference code of the previously created draft invoice

API Response

Success Response (200)
{
  "success": true,
  "data": {
    "tracking_code": "084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "tracking_url": "https://einvoice-api.sepay.vn/v1/invoices/issue/check/084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "message": "Đã tạo yêu cầu xuất bán hóa đơn điện tử"
  }
}
successboolean
dataobject

Error Handling

When the API returns any of the errors below, the invoice is not issued and is not sent to the tax authority.

400REFERENCE_CODE_REQUIRED

reference_code is missing from the body.

401UNAUTHORIZED

Missing or invalid Bearer token.

500EINVOICE_DRAFT_NOT_FOUND

Draft invoice not found for the given reference_code.

422REGISTRATION_NOT_TAX_APPROVED

Not registered or the declaration is not yet approved.

422INVOICE_DATE_BEFORE_TAX_APPROVAL

Invoice date is before the approval date. See tax_authority_approved_date in GET /v1/provider-accounts.

500REGISTRATION_NOT_COMPLETE

The company has not completed eInvoice package registration.

500BILLING_IS_UNPAID

The company has not paid for the eInvoice package.

500QUOTA_HAS_BEEN_USERD_UP

The eInvoice package quota has been used up - renew to keep issuing.

405METHOD_NOT_ALLOWED

Wrong HTTP method for the endpoint.

500CREATE_INVOICE_DATA_FAIL

System error while processing the issuance request.

Notes

Note
  • Issuance is only allowed for invoices that were previously created as drafts (is_draft=true).
  • reference_code can be retrieved via the Invoice List API or obtained from the reference_code returned after successfully checking the draft invoice creation status.
  • After successfully submitting an invoice issuance request, use the endpoint provided in tracking_url to call the Invoice Issuance Status Tracking API.

Code Examples

>
>
>
>
>
curl --request POST \
--url https://einvoice-api.sepay.vn/v1/invoices/issue \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"reference_code":"084e179d-d95a-11f0-aef4-52c7e9b4f41b"}'

Next Steps

After successfully submitting the issuance request and receiving a tracking_code:

  1. Track Invoice Issuance Status - Use the tracking_code to check the issuance result (required)