Skip to main content

Gateway Errors

The dis-metrics-manager is a custom The API Gateway: plugin for DIS gateway traffic. It handles various verifications such as client IDs, API keys, IP whitelists, subscription statuses, credit balances, and usage metrics.

When an error occurs during the gateway setup or request validation, the gateway returns a standard error response containing the error code, a message, and a link to this documentation.

Error Response Structure

All gateway errors follow a common JSON response format to help you quickly identify and resolve the issue.

Standard Error Format
{
"error_code": "",
"message": "",
"error_desc": ""
}

Example Response

Here is an example of what a missing API key error response looks like:

Example Error Response
{
"error_code": "DIS-GE-4011",
"message": "Missing API key",
"error_desc": "https://developerportal.dev.digieconcenter.gov.lk/getting-started/gateway-errors#DIS-GE-4011"
}

The error response will also include a custom HTTP header DIS-GATEWAY-ERROR-CODE containing the specific error code. You can use this header in your client application to programmatically handle different gateway issues.

Error Codes

Error CodeHTTP Status CodeMessageDescriptionUser's creditsPublisher Errors
DIS-GE-4001400Missing Client IDX-DIS-CLIENT-ID header is not present in the request.
DIS-GE-4011401Missing API keyX-DIS-API-KEY header is not present in the request.
DIS-GE-4012401Incorrect api keyThe provided API key does not match the stored key.
DIS-GE-4013401Application is not activatedThe client application exists but is marked as inactive.
DIS-GE-4021402Insufficient creditsThe organization credit balance is lower than the endpoint cost.
DIS-GE-4031403Invalid Client IdThe provided client ID is not found.
DIS-GE-4032403Host is not allowedThe caller IP address is not in the application's whitelist.
DIS-GE-4033403Permission not granted for requested api and versionThe client lacks access to the API and version pair.
DIS-GE-4291429Rate limit exceededThe API rate limit has been exceeded.
DIS-GE-5020502Gateway errorInternal gateway-side validation or Redis metadata processing failure.
DIS-GE-5030503Service errorThe upstream service returned a 5xx response.

Error Descriptions


DIS-GE-4001 (400) - Missing Client ID

Reason: The request lacks the required X-DIS-CLIENT-ID header.

Solution: Ensure that your application includes the X-DIS-CLIENT-ID header in every API request.


DIS-GE-4011 (401) - Missing API key

Reason: The request lacks the required X-DIS-API-KEY header.

Solution: Provide a valid API key using the X-DIS-API-KEY header in your request.


DIS-GE-4012 (401) - Incorrect api key

Reason: The provided API key does not match the hashed key stored for the client.

Solution: Verify that you have copied the correct API key from your application credentials and that it hasn't been rotated.


DIS-GE-4013 (401) - Application is not activated

Reason: The client application exists but has been marked as inactive by an administrator or the system.

Solution: Check the application status in the developer portal. If it is inactive, you may need to contact support or re-activate it.


DIS-GE-4021 (402) - Insufficient credits

Reason: Your organization's credit balance is lower than the configured cost for this endpoint.

Solution: Top up your organization's credits or review your API usage to reduce consumption.


DIS-GE-4031 (403) - Invalid Client Id

Reason: The provided X-DIS-CLIENT-ID cannot be found in the system.

Solution: Verify that you are using the correct Client ID. You can find your active Client ID in the developer portal.


DIS-GE-4032 (403) - Host is not allowed

Reason: The IP address from which the request originated is not in your application's configured IP whitelist.

Solution: Add the caller's IP address to the whitelist in the developer portal under the application's security settings.


DIS-GE-4033 (403) - Permission not granted for requested api and version

Reason: Your client application does not have an active subscription or access rights to the specific API and version requested.

Solution: Ensure that your application is subscribed to the correct API and version in the developer portal.


DIS-GE-4291 (429) - Rate limit exceeded

Reason: You have exceeded the permitted number of requests per minute for this API.

Solution: Wait until the next minute for the rate limit window to reset before sending more requests.


DIS-GE-5020 (502) - Gateway error

Reason: An internal issue occurred at the gateway level, such as a Redis connection issue, invalid cached metadata, or cryptographic errors.

Solution: This is generally an issue on our end. Please try again later or contact support if the issue persists.


DIS-GE-5030 (503) - Service error

Reason: The upstream service or backend processing the request returned an error (such as a 502, 503, or 504 status).

Solution: The backend service might be down or temporarily unavailable. Try again later or check our status page.