# Code and Formats source: https://developer.mastercard.com/transactions-service/documentation/code-and-formats/index.md ## Errors Overview {#errors-overview} The Loyalty Transactions Service uses standard HTTP response codes for success and failure notifications, and our errors are further classified by error type. In general, 200 HTTP codes correspond to success, 40X codes are for the developer or user-related failures, and 50X codes are for runtime/system errors. This section contains information about the response codes and error messages that can be returned by the APIs. ## Application Error Codes {#application-error-codes} ### Error Structure {#error-structure} 4xx/5xx error response messages have the following format (the Error array may contain multiple error items): ```json { "Errors": { "Error": [ { "Source": "", "Description": "", "Recoverable": "true/false", "Details": "null" } ] } } ``` | Field | Description | |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **Source** | The application(mrs-transactions-api) that generates this error. Every error message that is generated and returned by the gateway will have this field equal to Gateway. When the value of the source field is something else, it means the error was generated elsewhere. Example: mrs-transactions-api | | **ReasonCode** | The general cause of the error; see the table below. For example, INVALID_INPUT, ACCOUNT_NOT_FOUND | | **Description** | A textual description of the error. This is optional and will only be displayed if more information is available than is stored in the data identifier and reason code. For example, userId parameter cannot be null | | **Recoverable** | A true/false indicator stating whether your API request might be successful if you re-sent the API request with the same parameters and data. For example, an unsuccessful API request caused by a server error (5xx response code) might be successful when re-sent. Valid values: true, false | | **Details** | Each Open API service has the option to add extra service-specific error information in the Details section. The details are optional and might not be present for every error message. If present, the details are returned in the form of individual detail items, each containing a Name and Value pair. | ## HTTP Response Codes {#http-response-codes} The following is a complete list of the response codes that the application may return for requests. In the event of network or infrastructure issues, other response codes may be returned by the infrastructure. **NOTE:** For further information about 4xx/5xx response codes and possible resolutions, see [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/). | HTTP Response Code | Description | |-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **200 OK** | The request was completed successfully. | | **400 BAD REQUEST** | General error when the request could not be fulfilled due to errors such as validation errors, or missing required data. | | **401 UNAUTHORIZED** | Error code response for missing or invalid authentication token. (for example, a client with a clientId does not have access) | | **403 FORBIDDEN** | The user is not authorized to perform the operation or the resource is unavailable for some reason (for example, time constraints). | | **404 NOT FOUND** | The requested resource is not found. | | **500 INTERNAL SERVER ERROR** | The server encountered an unexpected condition that prevented it from fulfilling the request. It indicates an error that the caller cannot address from their end. Requests resulting in a 500 response code will generally include the Loyalty Transactions Service API Errors structure in the response. | | **5XX SERVER ERROR** | Errors that occur in the network infrastructure between the client and Transactions API server will typically result in a response code in the 500 range. Note that errors returned by the network infrastructure will never contain the Loyalty Transactions Service API Errors structure in the response. | ## MRS Transactions API Error Codes {#mrs-transactions-api-error-codes} ### POST /transactions/searches {#post---transactionssearches} Use the [API Reference](https://developer.mastercard.com/transactions-service/documentation/api-reference/index.md) to check the request schema for `POST /transactions/searches`. Read `Source`, `Description`, `Details`, and `Recoverable` before choosing a recovery action. Recoverability is determined by the returned error, not by the reason code alone. | Reason Code | Description | Resolution Tips | |------------------------------|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ERR_GENERIC | Generic error. | 1. Record the HTTP status and available error fields. 2. Check `Source` and use the gateway reference above for gateway errors. 3. Retry only when `Recoverable` is true, with bounded backoff. Otherwise, or if retries fail, contact [Support](https://developer.mastercard.com/transactions-service/documentation/support/index.md#get-help) with a sanitized request and response. | | TRANSACTIONS_SEARCHES_FAILED | Unable to get the transaction details. | 1. Read `Details` and `Description` for the failed search. 2. Check the account identifier and date criteria against the [API Reference](https://developer.mastercard.com/transactions-service/documentation/api-reference/index.md). 3. Correct any identified input issue; retry unchanged input only if `Recoverable` is true. Contact [Support](https://developer.mastercard.com/transactions-service/documentation/support/index.md#get-help) if the failure persists. | | MISSING_REQUIRED_FIELD | A required request field is missing. | 1. Read `Description` to identify the field. 2. Supply both `userId` and `userIdType` as documented in the [API Reference](https://developer.mastercard.com/transactions-service/documentation/api-reference/index.md); use the account's RANAC and `RANAC` identifier type. 3. Regenerate authentication for the corrected request and resend. Do not retry the unchanged body. | | ACCOUNT_NOT_FOUND | The account is not found. | 1. Check that `userId` is the intended account's RANAC and `userIdType` is `RANAC`. 2. Confirm the account belongs to the selected environment and program. 3. Ask your Product Delivery or CIS Implementation Manager to confirm account availability if the identifier is correct. Resend after correction or confirmation; do not repeatedly retry an unknown account. | | INTERNAL_SERVER_ERROR | System error. | 1. Preserve the timestamp, environment, and sanitized response. 2. If `Recoverable` is true, use bounded retries with backoff. 3. If it is false, absent, or retries are exhausted, contact [Support](https://developer.mastercard.com/transactions-service/documentation/support/index.md#get-help). Do not change valid account data to work around a server error. | | UNAUTHORIZED | The client does not have access. | 1. Verify that the request uses credentials for the selected [environment](https://developer.mastercard.com/transactions-service/documentation/api-basics/index.md#environments). 2. Check the project's [authentication method](https://developer.mastercard.com/transactions-service/documentation/api-basics/index.md#client-authentication), including a fresh signature or DPoP proof. 3. Ask your Product Delivery or CIS Implementation Manager to confirm Client ID enablement. Resend after correcting authentication or access; do not retry unchanged credentials. | | INVALID_INPUT | A request value is invalid. | 1. Read `Description` and `Details` to locate the invalid value. 2. Check `userId`, the supported `RANAC` type, `YYYY-MM-DD` dates, and pagination limits against the [API Reference](https://developer.mastercard.com/transactions-service/documentation/api-reference/index.md). 3. Correct the value, regenerate authentication, and resend. Do not retry the unchanged request. | ## Troubleshooting and Next Steps {#troubleshooting-and-next-steps} For escalation, include the project name, environment, UTC timestamp, HTTP method and path, status, reason code, and any returned request or correlation identifier. Redact account data and never include private keys, keystore passwords, access tokens, or Authorization headers. If the response is not JSON, retain the status and sanitized response headers for Support instead of assuming it has the application error structure. Reproduce an input error using [negative testing](https://developer.mastercard.com/transactions-service/documentation/tutorials-and-guides/api-testing-tutorial/index.md#test-a-missing-required-field), then repeat the [Sandbox First Call](https://developer.mastercard.com/transactions-service/documentation/quick-start-guide/index.md#sandbox-first-call) after correction.