Validations API
Complete API reference for validation services in the E-Invoice system
Validations API
This section covers all validation-related endpoints for validating invoice codes, TIN numbers, adjustment note codes, and company names in the Malaysian e-invoicing system.
Authentication
All endpoints require authentication via API key:
X-API-Key: your-api-key-hereBase URL
/apiValidate Invoice Code
Validate whether an invoice code already exists in the system.
Endpoint
POST /api/validation/invoice-codeHeaders
X-API-Key: your-api-key-here
Content-Type: application/jsonRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
code | number | Yes | Invoice code to validate |
type | string | No | Invoice type: INVOICE, SELF_BILLED_INVOICE |
Request Example
{
"code": 12345,
"type": "INVOICE"
}Response Examples
Code Available (200)
{
"data": {
"is_valid": true,
"message": "Invoice code is available",
"code": 12345
}
}Code Already Exists (200)
{
"data": {
"is_valid": false,
"message": "Invoice code already exists for current year",
"code": 12345,
"existing_invoice_id": 456
}
}Validation Error (422)
{
"message": "Validation failure",
"errors": [
{
"message": "The code field is required",
"rule": "required",
"field": "code"
}
]
}Validate TIN
Validate a Tax Identification Number (TIN) against the MyInvois system.
Endpoint
POST /api/validation/tinHeaders
X-API-Key: your-api-key-here
Content-Type: application/jsonRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
tin | string | Yes | Tax Identification Number to validate |
registration_type | string | Yes | Registration type: NRIC, BRN, PASSPORT |
registration_number | string | Yes | Registration number |
Request Example
{
"tin": "IG12345678901",
"registration_type": "NRIC",
"registration_number": "991021081111"
}Response Examples
Valid TIN (200)
{
"data": {
"is_valid": true,
"message": "TIN validation successful",
"tin": "IG12345678901",
"entity_name": "John Doe",
"registration_details": {
"type": "NRIC",
"number": "991021081111"
}
}
}Invalid TIN (200)
{
"data": {
"is_valid": false,
"message": "TIN validation failed",
"tin": "IG12345678901",
"error_details": "TIN not found in MyInvois system"
}
}Validation Error (422)
{
"message": "Validation failure",
"errors": [
{
"message": "The tin field is required",
"rule": "required",
"field": "tin"
},
{
"message": "Invalid registration type",
"rule": "enum",
"field": "registration_type"
}
]
}Validate Adjustment Note Code
Validate whether an adjustment note code already exists in the system.
Endpoint
POST /api/validation/adjustment-note-codeHeaders
X-API-Key: your-api-key-here
Content-Type: application/jsonRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
code | number | Yes | Adjustment note code to validate |
type | string | No | Adjustment note type: CREDIT_NOTE, DEBIT_NOTE |
Request Example
{
"code": 789,
"type": "CREDIT_NOTE"
}Response Examples
Code Available (200)
{
"data": {
"is_valid": true,
"message": "Adjustment note code is available",
"code": 789
}
}Code Already Exists (200)
{
"data": {
"is_valid": false,
"message": "Adjustment note code already exists for current year",
"code": 789,
"existing_adjustment_note_id": 123
}
}Validation Error (422)
{
"message": "Validation failure",
"errors": [
{
"message": "The code field is required",
"rule": "required",
"field": "code"
}
]
}Validate Company Name
Validate a company name for uniqueness and compliance.
Endpoint
POST /api/validation/company-nameHeaders
X-API-Key: your-api-key-here
Content-Type: application/jsonRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Company name to validate |
registration_type | string | No | Registration type: BRN, NRIC |
Request Example
{
"name": "ABC Sdn Bhd",
"registration_type": "BRN"
}Response Examples
Name Available (200)
{
"data": {
"is_valid": true,
"message": "Company name is available",
"name": "ABC Sdn Bhd",
"suggestions": []
}
}Name Already Exists (200)
{
"data": {
"is_valid": false,
"message": "Company name already exists",
"name": "ABC Sdn Bhd",
"suggestions": [
"ABC Trading Sdn Bhd",
"ABC Business Sdn Bhd",
"ABC Solutions Sdn Bhd"
]
}
}Invalid Name Format (200)
{
"data": {
"is_valid": false,
"message": "Company name format is invalid",
"name": "ABC Sdn Bhd",
"error_details": "Name must end with proper business entity suffix",
"valid_suffixes": ["Sdn Bhd", "Bhd", "PLT", "LLP"]
}
}Validation Error (422)
{
"message": "Validation failure",
"errors": [
{
"message": "The name field is required",
"rule": "required",
"field": "name"
},
{
"message": "The name must be at least 3 characters",
"rule": "minLength",
"field": "name"
}
]
}Validation Response Structure
Common Response Fields
All validation endpoints return a consistent response structure:
| Field | Type | Description |
|---|---|---|
data.is_valid | boolean | Whether the validation passed |
data.message | string | Human-readable validation result |
data.error_details | string | Additional error information (if validation failed) |
Invoice Code Validation Response
| Field | Type | Description |
|---|---|---|
data.code | number | The validated invoice code |
data.existing_invoice_id | number | ID of existing invoice (if code exists) |
TIN Validation Response
| Field | Type | Description |
|---|---|---|
data.tin | string | The validated TIN |
data.entity_name | string | Name of the entity (if valid) |
data.registration_details | object | Registration information |
Adjustment Note Code Validation Response
| Field | Type | Description |
|---|---|---|
data.code | number | The validated adjustment note code |
data.existing_adjustment_note_id | number | ID of existing note (if code exists) |
Company Name Validation Response
| Field | Type | Description |
|---|---|---|
data.name | string | The validated company name |
data.suggestions | array | Alternative name suggestions (if name exists) |
data.valid_suffixes | array | Valid business entity suffixes |
Validation Rules
Invoice Code Validation
- Uniqueness: Invoice codes must be unique within a company for each calendar year
- Format: Must be a positive integer
- Type-specific: Different prefixes may apply based on invoice type
TIN Validation
- Format: Must follow Malaysian TIN format (e.g., "IG" prefix for individuals)
- MyInvois Check: Validated against the official MyInvois database
- Registration Match: TIN must match the provided registration details
Adjustment Note Code Validation
- Uniqueness: Codes must be unique within a company for each calendar year
- Format: Must be a positive integer
- Type-specific: Different prefixes may apply based on note type
Company Name Validation
- Format: Must include proper business entity suffix
- Length: Minimum 3 characters, maximum 200 characters
- Characters: Only alphanumeric characters, spaces, and specific symbols allowed
- Uniqueness: Name should be unique within the registration jurisdiction
Common Error Codes
| Status Code | Description |
|---|---|
200 | OK - Validation completed (check is_valid field for result) |
400 | Bad Request - Invalid request format |
401 | Unauthorized - Invalid or missing API key |
422 | Unprocessable Entity - Validation errors in request data |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - MyInvois system unavailable |
Important Notes
-
Real-time Validation: All validations are performed in real-time against the MyInvois system when applicable.
-
Rate Limiting: Validation endpoints may have rate limits to prevent abuse. Check response headers for rate limit information.
-
Caching: Some validation results may be cached for a short period to improve performance.
-
Business Rules: Validation rules may change based on Malaysian regulatory requirements and MyInvois system updates.
-
Calendar Year Scope: Code uniqueness validations are scoped to the current calendar year.
-
Registration Types:
NRIC: National Registration Identity Card (Malaysian individuals)BRN: Business Registration Number (Malaysian businesses)PASSPORT: Passport number (foreign individuals/entities)
-
TIN Formats:
- Individual: "IG" prefix (e.g., IG12345678901)
- Business: Various prefixes based on entity type
- Foreign: Special prefixes for foreign entities
-
Async Operations: Some validations may take longer if external systems are involved.
-
Error Handling: Always check the
is_validfield even for 200 responses, as validation failure is not an HTTP error. -
Integration: These endpoints are designed for real-time validation during data entry in forms and applications.