Create Adjustment Invoice API

Create increase, decrease, combined or information adjustment invoices for issued e-invoices via the SePay eInvoice API.

||

What is an adjustment invoice?

An adjustment invoice is issued when an e-invoice that has already been issued and accepted by the tax authority turns out to need a correction. An adjustment invoice does not replace or void the original invoice. The original stays in force, and the adjustment records only the difference or the information being corrected.

For example: the original invoice is 10,000,000 VND but the correct amount is 11,000,000 VND. You issue an increase adjustment of 1,000,000 VND - the difference that needs adjusting, not the whole invoice again.

Origin invoice requirements

The origin invoice is identified by original_invoice_reference_code (the reference_code of a previously created invoice, under the same provider_account_id).

The origin invoice must:

  • Have been issued successfully and accepted by the tax authority. Draft or in-progress invoices cannot be adjusted.
  • Be a new invoice or an already-adjusted invoice. A replacement invoice cannot be adjusted.
  • Not have been replaced or cancelled.

An invoice that has already been adjusted can be adjusted again, many times.

The first correction picks the form for every later one. An invoice that has been adjusted can only be adjusted again, never replaced. The other way round, a replacement invoice can only be replaced again, never adjusted.

Supported adjustment kinds

The adjustment_type parameter picks the kind of adjustment invoice:

  • increase - increase adjustment
  • decrease - decrease adjustment
  • combined - increase and decrease on the same invoice
  • info - information adjustment, carries no change in money

How to enter line items for each kind is covered under Adjustment Types (adjustment_type) below.

How it works in the SePay eInvoice API

POST v1/invoices/adjust takes original_invoice_reference_code, the adjustment kind and the lines to adjust.

The API returns a tracking_code as soon as it accepts the request. Signing and filing the invoice with the tax authority are processed asynchronously. Use the tracking_code with the invoice status tracking API to follow the status and get the final result.

An invoice can be adjusted many times.


API Endpoint

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

API Request

provider_account_idstringrequired

Provider account ID (UUID) - must be the account that issued the origin invoice

original_invoice_reference_codestringrequired

Reference code of the issued origin invoice to adjust

adjustment_typeenumrequired

Adjustment type:

  • increase: Increase adjustment
  • decrease: Decrease adjustment
  • combined: Combined adjustment
  • info: Information adjustment
issued_datestring

Invoice issue date (YYYY-MM-DD HH:mm:ss). Optional - defaults to now. If provided, it must be today.

reference_codestring

Reference code of the adjustment invoice, must be unique. Auto-generated as UUID if omitted.

payment_methodenum

Payment method. Optional - when omitted, the origin invoice's payment method is reused (TM/CK when the origin has none either).

  • TM: Cash
  • CK: Bank transfer
  • TM/CK: Cash and bank transfer
  • KHAC: Other
is_draftbooleanrequired

Must be a real boolean (true/false):

  • true: Create as draft (issue later via the issue invoice API)
  • false: Create and issue immediately
buyerobject

Buyer information.

Required when adjustment_type=info.

For increase/decrease/combined, when omitted the origin invoice's full buyer information is used.

itemsarray<object>required

List of adjustment lines.

increase/decrease/combined: at least one adjusted item is required.

info: at least one content line is required.

notesstring

Invoice notes, max 255 characters

total_amountinteger

Final total payable amount of the invoice (tax included). Optional. If provided, it must be an integer (no decimals).

  • Omitted: the system computes it from the line items and rounds to a whole number.
  • Provided: the system uses your value exactly as-is and performs NO validation against the line items.

Warning (when provided): You are solely responsible for this value. If it does not match the goods subtotal + tax, the invoice will display an incorrect total and the tax authority may reject it.

API Response

Success Response (202)
{
  "success": true,
  "data": {
    "tracking_code": "5c2d9e4b-7d96-11f1-aef4-52c7e9b4f41b",
    "tracking_url": "https://einvoice-api.sepay.vn/v1/invoices/adjust/check/5c2d9e4b-7d96-11f1-aef4-52c7e9b4f41b",
    "message": "Đã tạo yêu cầu xuất hóa đơn điều chỉnh"
  }
}
successboolean
dataobject

Error Handling

400Bad Request

Missing or invalid required fields (VALIDATION_ERROR).

401Unauthorized

Missing or invalid Bearer token, or token expired (TOKEN_EXPIRED).

400INVALID_ADJUSTMENT_TYPE

adjustment_type is required and must be one of: increase, decrease, combined, info.

400INVALID_IS_DRAFT_TYPE

is_draft must be a real boolean (true/false), not a string.

400VALIDATION_ERROR

Invalid line data: negative values outside money adjustment types, an info adjustment with non-zero totals, no non-zero difference line...

400ISSUED_DATE_INVALID

issued_date is not today's date.

400INVALID_ISSUED_DATE

issued_date does not match the Y-m-d H:i:s format.

422INVALID_ORIGIN_INVOICE

The origin invoice is not eligible: not issued yet, already replaced/cancelled, or it is a replacement invoice (those can only be replaced again).

422REGISTRATION_NOT_TAX_APPROVED

Business has not registered eInvoicing or the tax authority has not approved the filing (production only).

422INVOICE_DATE_BEFORE_TAX_APPROVAL

Invoice date is before the tax authority approval date (production only).

409EINVOICE_DOCUMENT_EXISTED

An invoice already exists for this reference_code. reference_code must be unique.

500EINVOICE_ACCOUNT_NOT_FOUND

No eInvoice provider account found for the given provider_account_id.

500QUOTA_HAS_BEEN_USERD_UP

The plan's invoice quota is used up. Top up the quota before calling again - do not auto-retry, this error does not clear by itself.

500REGISTRATION_NOT_COMPLETE

The company has not completed its eInvoice plan registration.

500BILLING_IS_UNPAID

The company has not paid for its eInvoice plan.

500Internal Server Error

System error while processing the request.

Adjustment Types (adjustment_type)

adjustment_typeInvoice typeHow to enter line values
increaseIncrease adjustment invoiceEnter the INCREASE difference as positive values
decreaseDecrease adjustment invoiceEnter the DECREASE difference - values may be negative or positive
combinedCombined increase/decrease adjustmentEach line carries its own sign: positive = increase, negative = decrease
infoInformation adjustment invoiceCarries no money value, totals must equal 0. Describe the correction in a note line (line_type=4)

Buyer Information (buyer)

  • For increase/decrease/combined: buyer is optional. When omitted, the origin invoice's full buyer info is reused.
  • For info: buyer is required - it is the corrected information itself (e.g. the new address, the correct tax code).

Usage Notes

  • payment_method is optional - when omitted, the origin invoice's payment method is reused.
  • issued_date is optional and must always be today (defaults to the API call time).
  • For increase/decrease/combined: at least one line with a non-zero value is required. All-zero goods lines are skipped automatically.
  • For decrease: line values may be sent as negative or positive numbers - the system keeps exactly what you send, the decrease nature is already carried by adjustment_type=decrease.
  • For info: at least one content line describing the corrected information is required (typically a note line, line_type=4), and totals must equal 0.
  • discount_tax (discount %) is never negative - adjust a discount through discount_amount directly, using the same sign convention as the item lines.
  • When the origin is a sales invoice (template_code = 2): it carries no tax - any tax_rate/tax_amount you send is ignored and the tax is always 0.
  • tax_amount on each line: when provided, it must be an integer (a value with decimals is rejected with a 400 error) and the system uses exactly the value you send without recomputing it from tax_rate.
  • is_draft=true creates a draft - issue it later via the issue invoice API using the draft's reference_code. is_draft=false creates and issues immediately.
  • After a successful request, use tracking_url to call the invoice status tracking API - always poll until a terminal result (success or failure).

Sample Code

>
>
>
>
>
curl --request POST \
--url https://einvoice-api.sepay.vn/v1/invoices/adjust \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"provider_account_id":"0aea3134-da40-11f0-aef4-52c7e9b4f41b","original_invoice_reference_code":"084e179d-d95a-11f0-aef4-52c7e9b4f41b","adjustment_type":"increase","issued_date":"2026-07-30 00:00:00","reference_code":"5c2d9e4b-7d96-11f1-aef4-52c7e9b4f41b","payment_method":"TM/CK","is_draft":false,"buyer":{"type":"personal","name":"Công ty TNHH ABC","legal_name":"CÔNG TY CỔ PHẦN ABC","tax_code":"0123456789","address":"123 Đường ABC, Quận 1, TP.HCM","email":"contact@abc.com","phone":"0901234567","buyer_code":"KH-001","national_id":"001234567890"},"items":[{"line_number":1,"line_type":1,"item_code":"SP001","item_name":"Điều chỉnh tăng mặt hàng Sản phẩm A","unit":"cái","quantity":1,"unit_price":500000,"tax_rate":10,"discount_tax":10,"discount_amount":100000,"before_discount_and_tax_amount":500000,"sub_amount":400000,"tax_amount":40000,"amount":440000}],"notes":"Điều chỉnh tăng đơn giá cho hóa đơn ký hiệu C26TSE số 589 ngày 26/01/2026","total_amount":4950000}'

Sample Parameters per Adjustment Type

The JSON below are illustrative request examples only - the figures and content are fictitious.

Increase adjustment (increase)

json
{
    "provider_account_id": "{{your-provider-account-id}}",
    "original_invoice_reference_code": "084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "adjustment_type": "increase",
    "items": [
        {
            "line_number": 1,
            "line_type": 1,
            "item_code": "SP001",
            "item_name": "Điều chỉnh tăng mặt hàng Sản phẩm A",
            "unit": "cái",
            "quantity": 1,
            "unit_price": 500000,
            "tax_rate": 10
        }
    ],
    "notes": "Điều chỉnh tăng đơn giá cho hóa đơn ký hiệu C26TSE số 589 ngày 26/01/2026",
    "is_draft": false
}

Decrease adjustment (decrease)

The example below uses negative values - for decrease you may also send positive values, the system keeps what you send.

json
{
    "provider_account_id": "{{your-provider-account-id}}",
    "original_invoice_reference_code": "084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "adjustment_type": "decrease",
    "items": [
        {
            "line_number": 1,
            "line_type": 1,
            "item_code": "SP001",
            "item_name": "Điều chỉnh giảm mặt hàng Sản phẩm A",
            "unit": "cái",
            "quantity": 1,
            "unit_price": -500000,
            "tax_rate": 10
        }
    ],
    "notes": "Điều chỉnh giảm đơn giá cho hóa đơn ký hiệu C26TSE số 589 ngày 26/01/2026",
    "is_draft": false
}

Combined adjustment (combined - per-line signs)

json
{
    "provider_account_id": "{{your-provider-account-id}}",
    "original_invoice_reference_code": "084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "adjustment_type": "combined",
    "items": [
        {
            "line_number": 1,
            "line_type": 1,
            "item_code": "SP001",
            "item_name": "Điều chỉnh tăng mặt hàng Sản phẩm A",
            "unit": "cái",
            "quantity": 1,
            "unit_price": 300000,
            "tax_rate": 10
        },
        {
            "line_number": 2,
            "line_type": 1,
            "item_code": "SP002",
            "item_name": "Điều chỉnh giảm mặt hàng Sản phẩm B",
            "unit": "cái",
            "quantity": 1,
            "unit_price": -200000,
            "tax_rate": 10
        }
    ],
    "notes": "Điều chỉnh tăng/giảm cho hóa đơn ký hiệu C26TSE số 589 ngày 26/01/2026",
    "is_draft": false
}

Information adjustment (info - zero totals, buyer required)

json
{
    "provider_account_id": "{{your-provider-account-id}}",
    "original_invoice_reference_code": "084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "adjustment_type": "info",
    "buyer": {
        "type": "company",
        "name": "Công ty ABC",
        "legal_name": "CÔNG TY TNHH ABC",
        "tax_code": "0101234567",
        "address": "456 Đường B, Quận C, Hà Nội",
        "email": "buyer@example.com"
    },
    "items": [
        {
            "line_number": 1,
            "line_type": 4,
            "item_name": "Điều chỉnh địa chỉ người mua từ 123 Đường A thành 456 Đường B"
        }
    ],
    "notes": "Điều chỉnh thông tin cho hóa đơn ký hiệu C26TSE số 589 ngày 26/01/2026",
    "is_draft": false
}

Adjusting only the line total after tax

json
{
    "provider_account_id": "{{your-provider-account-id}}",
    "original_invoice_reference_code": "084e179d-d95a-11f0-aef4-52c7e9b4f41b",
    "adjustment_type": "decrease",
    "items": [
        {
            "line_number": 1,
            "line_type": 1,
            "item_code": "SP001",
            "item_name": "Điều chỉnh giảm mặt hàng Sản phẩm A",
            "unit": "cái",
            "tax_rate": 10,
            "amount": -550000
        }
    ],
    "notes": "Điều chỉnh giảm thành tiền cho hóa đơn ký hiệu C26TSE số 589 ngày 26/01/2026",
    "is_draft": false
}

Next Steps

After a successful request returning a tracking_code:

  1. Track invoice status - Use the tracking_code to check the processing result (required)
After a successful status
  • If created as a draft (is_draft=true): continue with the issue invoice API to issue officially
  • If created officially (is_draft=false): you can download the invoice or view its details - the adjustment invoice has document_type 6/7/8/9 by type, and the origin becomes document_type=10 (adjusted)