BizCARE MyInvois
API Reference

Error Handling

HTTP status codes and error response formats

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of requests.

HTTP Status Codes

Status CodeMeaningDescription
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request body or parameters
401UnauthorizedMissing or invalid API key
403ForbiddenOperation not allowed (e.g., cancelling after 72 hours)
404Not FoundResource does not exist
409ConflictDuplicate resource (e.g., invoice code already exists)
422Unprocessable EntityValidation errors in request data
500Internal Server ErrorServer-side error

Error Response Format

Standard Error

{
  "success": false,
  "message": "Description of the error"
}

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"
      }
    ]
  }
}

Common Errors

Invoice Operations

ErrorStatusMessage
Duplicate invoice code409"Invoice code already exists for current year"
Not submitted yet403"The invoice has not been submitted."
Awaiting validation403"The invoice has been submitted but not yet being validated by LHDN or latest submission result status is not valid."
No submitted document403"The invoice does not have any submitted document."
Already cancelled403"The latest submitted document of the invoice has already been cancelled/invalid."
72-hour limit403"The latest submitted document of the invoice has been submitted more than 72 hours ago. Submitted documents can only be cancelled within 72 hours."

Retry Guidance

  • 4xx errors: Fix the request before retrying. These indicate client-side issues.
  • 5xx errors: Safe to retry with exponential backoff. These indicate server-side issues.
  • 409 Conflict: Use a different invoice/adjustment note code and retry.