Sepay eInvoice API Overview
Overview, flow, and core endpoints of the eInvoice API.
Introduction
- eInvoice API lets you create, issue, and query e-invoices over HTTP.
- Supports two environments: Sandbox for testing and Production for live use.
Environment & Base URL
Production: https://einvoice-api.sepay.vn
Sandbox: https://einvoice-api-sandbox.sepay.vnAuthentication
Header: Authorization: Bearer <ACCESS_TOKEN>
Get token: POST /v1/tokenOverview Flow
eInvoice Processing Flow Description:
The eInvoice processing flow covers every step from authentication, account/usage checks to invoice creation, issuance, and retrieval:
Obtain access token
The merchant application callsPOST v1/tokento obtain anaccess_tokenthat is reused for all eInvoice APIs.List provider accounts
CallGET v1/provider-accountsto retrieve configured eInvoice provider accounts and their statuses.Get provider account detail
UseGET v1/provider-accounts/{id}to inspect a specific account configuration (allowed templates/series, status, etc.).Create invoice
Submit invoice data viaPOST v1/invoices/create. The API returns atracking_codefor the creation job.Check invoice creation status
PollGET v1/invoices/create/check/{tracking_code}to confirm whether creation succeeded or failed.Issue invoice
Once creation succeeds, trigger issuance viaPOST v1/invoices/issue. Anothertracking_codeis returned for this stage.Check invoice issuance status
PollGET v1/invoices/issue/check/{tracking_code}to see the issuance result.Get invoice details
After issuance completes, callGET v1/invoices/{reference_code}to fetch full invoice information plus file URLs (PDF, XML, etc.).Check usage quota
CallGET v1/usageto monitor remaining issuance quota and plan future operations.List invoices
UseGET v1/invoicesto retrieve paginated invoice lists for monitoring and reconciliation.
The Create and Issue steps are processed asynchronously. Merchants must call the corresponding /check API to confirm the status before proceeding to the next step.
Core Endpoints
/v1/token- Get access token.
v1/provider-accounts- Danh sách tài nguyên
v1/provider-accounts/{id}- Chi tiết tài khoản
/v1/invoices/create- Create invoice (draft/issue depending on
is_draft).
/v1/invoices/create/check/{tracking_code}- Check create status (draft).
/v1/invoices/issue- Submit issuance request from draft.
/v1/invoices/issue/check/{tracking_code}- Track issuance status.
/v1/invoices/{reference_code}- Invoice detail.
v1/usage- Kiểm tra hạn ngạch
/v1/invoices- Invoice list (pagination).
Common Response Structure
{
"success": true,
"data": "object"
}{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Error message"
}
}