# Code and Formats
source: https://developer.mastercard.com/transactions-service/documentation/code-and-formats/index.md

## Errors Overview Test {#errors-overview-test}

The 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": "<Source api of the error, e.g. mrs-transactions-api",
         "ReasonCode": "<Unique code>",
         "Description": "<Description of the error>",
         "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 MRS Transactions 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 Transactions Service API Errors structure in the response. |

## MRS Transactions API Error Codes {#mrs-transactions-api-error-codes}

### POST /transactions/searches {#post---transactionssearches}

|         Reason Code          |                                                Description                                                 |
|------------------------------|------------------------------------------------------------------------------------------------------------|
| ERR_GENERIC                  | Generic Error.                                                                                             |
| TRANSACTIONS_SEARCHES_FAILED | Unable to get the transaction details. Please look into the `Details` field and reach to the support team. |
| MISSING_REQUIRED_FIELD       | Returned for an invalid request. See the "Description" element in response for more details.               |
| ACCOUNT_NOT_FOUND            | The account is not found.                                                                                  |
| INTERNAL_SERVER_ERROR        | System error.                                                                                              |
| UNAUTHORIZED                 | A client with its clientId does not have access.                                                           |
| INVALID_INPUT                | Returned for an invalid request. See the "Description" element in response for more details.               |

