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.vn
Authentication
Header: Authorization: Bearer <ACCESS_TOKEN> Get token: POST /v1/token
Overview 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 calls
POST v1/tokento obtain anaccess_tokenthat is reused for all eInvoice APIs. -
List provider accounts Call
GET v1/provider-accountsto retrieve configured eInvoice provider accounts and their statuses. -
Get provider account detail Use
GET v1/provider-accounts/{id}to inspect a specific account configuration (allowed templates/series, status, etc.). -
Create invoice Submit invoice data via
POST v1/invoices/create. The API returns atracking_codefor the creation job. -
Check invoice creation status Poll
GET v1/invoices/create/check/{tracking_code}to confirm whether creation succeeded or failed. -
Issue invoice Once creation succeeds, trigger issuance via
POST v1/invoices/issue. Anothertracking_codeis returned for this stage. -
Check invoice issuance status Poll
GET v1/invoices/issue/check/{tracking_code}to see the issuance result. -
Get invoice details After issuance completes, call
GET v1/invoices/{reference_code}to fetch full invoice information plus file URLs (PDF, XML, etc.). -
Check usage quota Call
GET v1/usageto monitor remaining issuance quota and plan future operations. -
List invoices Use
GET 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- List provider accounts
v1/provider-accounts/{id}- Provider account details
v1/invoices/create- Create invoice (draft/issue depending on
is_draft).
v1/invoices/create/check/{tracking_code}- Check invoice creation status.
v1/invoices/issue- Submit issuance request from draft invoice.
v1/invoices/issue/check/{tracking_code}- Track issuance status.
v1/invoices/{reference_code}- Invoice detail.
v1/usage- Check usage quota.
v1/invoices- Invoice list (pagination).
Common Response Structure
{
"success": true,
"data": "object"
}{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Error message"
}
}Next Steps
To start using the eInvoice API, follow these steps in order:
- Create Access Token - Get a Bearer token to authenticate subsequent API calls
- List Provider Accounts - View available eInvoice provider accounts
- Create eInvoice - Start creating your first invoice
If you're just getting started, use the Sandbox environment for testing before switching to Production.