BizCARE MyInvois
API Reference

Invoices API

Complete API reference for managing invoices in the E-Invoice system

Invoices API

This section covers all invoice-related endpoints for creating, updating, retrieving, and managing invoices in the Malaysian e-invoicing system.

Authentication

All endpoints require authentication via API key:

X-API-Key: your-api-key-here

Base URL

/api

Create Invoice

Create a new invoice in the system.

Endpoint

POST /api/invoices

Headers

X-API-Key: your-api-key-here
Content-Type: application/json

Request Body

FieldTypeRequiredDescription
submitImmediatelybooleanNoWhether to submit the invoice immediately after creation
isReadybooleanNoWhether the invoice is ready for submission
typestringYesInvoice type: INVOICE, SELF_BILLED_INVOICE, PENDING_FINALIZE_INVOICE, PENDING_FINALIZE_SELF_BILLED_INVOICE
codenumberYesInvoice code (must be unique for the year)
issueDateTimestringYesInvoice issue date and time (ISO 8601 format)
buyerobjectConditionalBuyer information (required for INVOICE type)
supplierobjectConditionalSupplier information (required for SELF_BILLED_INVOICE type)
lineItemsarrayYesArray of line items

Buyer Object

FieldTypeRequiredDescription
typestringYesParty type: LOCAL_INDIVIDUAL, LOCAL_EXEMPTED_ENTITY, LOCAL_BUSINESS_AGENT_DEALER_DISTRIBUTOR, FOREIGNER_BUSINESS, FOREIGNER_INDIVIDUAL
namestringYesBuyer name
tinstringNoTax identification number
registrationobjectYesRegistration details
registration.typestringYesRegistration type: NRIC, BRN, PASSPORT
registration.numberstringYesRegistration number
contactNumberstringNoContact phone number
addressobjectYesAddress details
address.line1stringYesAddress line 1
address.citystringYesCity name
address.statestringYesState code (Malaysian state codes)
address.zipCodestringYesPostal code
address.countrystringYesCountry code (ISO 3166-1 alpha-3)

Line Item Object

FieldTypeRequiredDescription
idstringYesUnique line item identifier
descriptionstringYesItem description
classificationsarrayYesArray of classification codes
unitobjectYesUnit details
unit.codestringYesUnit code (e.g., "EA" for each)
unit.pricenumberYesUnit price
unit.countnumberYesQuantity
taxDetailsarrayYesArray of tax details
taxDetails[].taxTypestringYesTax type code
taxDetails[].taxRate.percentagenumberYesTax rate percentage
originCountrystringYesCountry of origin (ISO 3166-1 alpha-3)

Request Example

{
  "submitImmediately": false,
  "isReady": true,
  "type": "INVOICE",
  "code": 6,
  "issueDateTime": "2025-07-15T14:41:23.000Z",
  "buyer": {
    "type": "LOCAL_INDIVIDUAL",
    "name": "Sean",
    "registration": {
      "type": "NRIC",
      "number": "abc21234"
    },
    "contactNumber": "016-8985360",
    "address": {
      "line1": "34a, Jalan ABC 123",
      "city": "Bukit Jalil",
      "state": "14",
      "zipCode": "56420",
      "country": "MYS"
    }
  },
  "lineItems": [
    {
      "id": "item-1-id",
      "description": "test",
      "classifications": ["007"],
      "unit": {
        "code": "EA",
        "price": 88.88,
        "count": 1
      },
      "taxDetails": [
        {
          "taxType": "01",
          "taxRate": {
            "percentage": 10
          }
        }
      ],
      "originCountry": "MYS"
    }
  ]
}

Response

Success (200)

{
  "success": true,
  "message": "Created successfully",
  "data": {
    "id": 38
  }
}

Validation Error (422)

{
  "message": "Validation failure",
  "error": {
    "status": 422,
    "code": "E_VALIDATION_ERROR",
    "messages": [
      {
        "message": "When invoice type is INVOICE, buyer is required",
        "rule": "conditional required",
        "field": "buyer"
      }
    ]
  }
}

Duplicate Invoice Code (409)

{
  "success": false,
  "message": "Invoice code already exists for current year"
}

Get All Invoices

Retrieve a paginated list of all invoices.

Endpoint

GET /api/invoices

Headers

X-API-Key: your-api-key-here

Query Parameters

Standard pagination parameters are supported.

Response Example

{
  "meta": {
    "total": 7,
    "per_page": 10,
    "current_page": 1,
    "last_page": 1,
    "first_page": 1,
    "first_page_url": "/?page=1",
    "last_page_url": "/?page=1",
    "next_page_url": null,
    "previous_page_url": null
  },
  "data": [
    {
      "id": 71,
      "company_id": 2,
      "user_id": 1,
      "consolidated_invoice_id": null,
      "is_submitted_to_lhdn": false,
      "is_ready": false,
      "invoice_code": "7",
      "external_id": null,
      "type": "INVOICE",
      "buyer": {
        "tin": "IG40023601100",
        "name": "Ricky 3456",
        "email": "leonheng2000@gmail.com",
        "address": {
          "state": "07",
          "country": "MYS",
          "cityName": "Bukit Mertajam",
          "postalZone": "14000",
          "addressLine0": "123@gmail.com"
        },
        "partyType": "LOCAL_INDIVIDUAL",
        "contactNumber": "0168985360",
        "registrationType": "NRIC",
        "registrationNumber": "930723075219"
      },
      "line_items": [
        {
          "id": "1",
          "unit": {
            "code": "EA",
            "count": 1,
            "price": 10
          },
          "taxAmount": 1,
          "taxDetails": [
            {
              "taxRate": {
                "percentage": 10
              },
              "taxType": "01",
              "taxAmount": 1,
              "taxableAmount": 10
            }
          ],
          "description": "test",
          "originCountry": "MYS",
          "classifications": ["022"]
        }
      ],
      "final_adjusted_amount": 11,
      "status": "Draft",
      "legal_monetary_total": {
        "excludingTax": 10,
        "includingTax": 11,
        "payableAmount": 11,
        "netAmount": 10,
        "discountValue": 0,
        "feeAmount": 0,
        "payableRoundingAmount": 0
      },
      "created_at": "2025-09-22T05:32:19.534+00:00",
      "updated_at": "2025-09-22T05:55:37.798+00:00"
    }
  ]
}

Get Specific Invoice

Retrieve details of a specific invoice.

Endpoint

GET /api/invoices/:id

Headers

X-API-Key: your-api-key-here

Path Parameters

ParameterTypeDescription
idintegerInvoice ID

Response

Returns the same structure as individual invoice objects in the "Get All Invoices" response.


Update Invoice

Update an existing invoice.

Endpoint

PUT /api/invoices/:id

Headers

X-API-Key: your-api-key-here
Content-Type: application/json

Path Parameters

ParameterTypeDescription
idintegerInvoice ID

Request Body

Similar structure to the Create Invoice request body. You can update any of the invoice fields.

Request Example

{
  "isReady": true,
  "type": "INVOICE",
  "buyer": {
    "name": "BizCARE",
    "tin": "IG12345678",
    "registration": {
      "type": "NRIC",
      "number": "12345678"
    },
    "type": "LOCAL_INDIVIDUAL",
    "contactNumber": "+6012345678",
    "address": {
      "line1": "Address Line 0 dummy",
      "state": "14",
      "country": "MYS",
      "city": "George Town",
      "zipCode": "15000"
    }
  },
  "issueDateTime": "2025-07-15T14:41:23.000Z",
  "lineItems": [
    {
      "id": "item-1-id",
      "description": "test",
      "classifications": ["007"],
      "unit": {
        "code": "EA",
        "price": 100,
        "count": 1
      },
      "taxDetails": [
        {
          "taxType": "01",
          "taxRate": {
            "percentage": 10
          }
        }
      ],
      "originCountry": "MYS"
    }
  ]
}

Delete Invoice

Delete a specific invoice.

Endpoint

DELETE /api/invoices/:id

Headers

X-API-Key: your-api-key-here

Path Parameters

ParameterTypeDescription
idintegerInvoice ID

Response Example

{
  "success": true,
  "message": "Invoice deleted successfully"
}

Submit Invoice to MyInvois

Submit an invoice to the MyInvois system for validation and processing.

Endpoint

POST /api/invoices/:id/submit-to-myinvois

Headers

X-API-Key: your-api-key-here

Path Parameters

ParameterTypeDescription
idintegerInvoice ID

Request Body

Empty JSON object: {}

Response Examples

Success (200)

{
  "success": true,
  "message": "Submitted successfully"
}

Error (400)

{
  "success": false,
  "message": "Failed to submit, please try again"
}

Cancel Latest Submitted Document

Cancel the latest submitted document for an invoice (must be within 72 hours of submission).

Endpoint

POST /api/invoices/:id/cancel-latest-invoice-submitted

Headers

X-API-Key: your-api-key-here

Path Parameters

ParameterTypeDescription
idintegerInvoice ID

Response Examples

Success (200)

{
  "success": true,
  "message": "Cancelled submitted document successfully"
}

Error - No Submitted Document (403)

{
  "success": false,
  "message": "The invoice does not have any submitted document."
}

Error - Already Cancelled (403)

{
  "success": false,
  "message": "The latest submitted document of the invoice has already been cancelled/invalid."
}

Error - 72-Hour Limit Exceeded (403)

{
  "success": false,
  "message": "The latest submitted document of the invoice has been submitted more than 72 hours ago. Submitted documents can only be cancelled within 72 hours."
}

Create Adjustment Note

Create an adjustment note (credit note or debit note) for a specific invoice.

Endpoint

POST /api/invoices/:id/adjustment-note

Headers

X-API-Key: your-api-key-here
Content-Type: application/json

Path Parameters

ParameterTypeDescription
idintegerInvoice ID

Request Body

FieldTypeRequiredDescription
targetInvoiceTypestringYesType of target invoice: INVOICE
typestringYesAdjustment note type: CREDIT_NOTE, DEBIT_NOTE
adjustmentNoteCodenumberYesUnique adjustment note code
adjustmentNoteIssueDatestringYesIssue date (ISO 8601 format)
lineItemsarrayYesArray of adjustment line items

Request Example

{
  "targetInvoiceType": "INVOICE",
  "type": "CREDIT_NOTE",
  "adjustmentNoteCode": 123,
  "adjustmentNoteIssueDate": "2023-08-01T00:00:00.000Z",
  "lineItems": [
    {
      "id": "item-1",
      "classifications": ["001"],
      "description": "Adjustment for invoice item",
      "unit": {
        "price": 100,
        "count": 2,
        "code": "EA"
      },
      "taxDetails": [
        {
          "taxType": "06",
          "taxRate": {
            "percentage": 6
          }
        }
      ],
      "taxExemption": {
        "taxableAmount": 50,
        "reason": "Partial tax exemption"
      },
      "allowanceCharges": [
        {
          "amount": 10,
          "reason": "Discount for early payment",
          "isCharge": false
        }
      ],
      "originCountry": "MYS"
    }
  ]
}

Response Examples

Success (200)

{
  "success": true,
  "message": "Successfully created adjustment note"
}

Error - Invoice Waiting Validation (403)

{
  "success": false,
  "message": "The invoice has been submitted but not yet being validated by LHDN or latest submission result status is not valid."
}

Error - Invoice Not Submitted (403)

{
  "success": false,
  "message": "The invoice has not been submitted."
}

Get Submitted Documents

Retrieve all submitted documents associated with an invoice.

Endpoint

GET /api/invoices/:id/submitted-documents

Headers

X-API-Key: your-api-key-here

Path Parameters

ParameterTypeDescription
idintegerInvoice ID

Get Specific Submitted Document

Retrieve details of a specific submitted document.

Endpoint

GET /api/invoices/:id/submitted-documents/:submitted_document_id

Headers

X-API-Key: your-api-key-here

Path Parameters

ParameterTypeDescription
idintegerInvoice ID
submitted_document_idintegerSubmitted document ID

Common Error Codes

Status CodeDescription
400Bad Request - Invalid request data
401Unauthorized - Invalid or missing API key
403Forbidden - Operation not allowed
404Not Found - Resource not found
409Conflict - Duplicate resource
422Unprocessable Entity - Validation errors

Important Notes

  1. Date Format: All dates must be in ISO 8601 format (e.g., "2025-07-15T14:41:23.000Z")
  2. Tax Types: Common Malaysian tax types:
    • 01: SST (Sales and Service Tax)
    • 02: Service Tax
    • 03: Tourism Tax
    • 06: Not Applicable
  3. Registration Types:
    • NRIC: National Registration Identity Card (for Malaysian individuals)
    • BRN: Business Registration Number (for businesses)
    • PASSPORT: Passport number (for foreign individuals)
  4. Country Code: Use "MYS" for Malaysia (ISO 3166-1 alpha-3)
  5. State Codes: Use Malaysian state codes (e.g., "14" for Penang, "07" for Perak)
  6. Invoice Codes: Must be unique within the company for each calendar year
  7. 72-Hour Rule: Submitted documents can only be cancelled within 72 hours of submission