# Code and Formats
source: https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/code-and-formats/index.md

## Response Status Codes {#response-status-codes}

The client invoking an API expects response status codes consistent with the HTTP1.1 standard as described in RFC 7231 at <https://tools.ietf.org/html/rfc7231>. The following responses have particular relevance or common application to Ethoca's Merchant Transaction API:

| HTTP Code |     Description     |                                                                                                                                                           Relevance                                                                                                                                                            |
|-----------|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 200       | Ok                  | Standard response for successful HTTP requests: Indicates that the merchant has successfully received the request. More information can be found in the [ResponseStatus object](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/code-and-formats/index.md#response-result-status-object). |
| 400       | Bad Request         | Returned for any case where the request cannot be understood by the merchant system due to a malformed URL syntax or URL parameters.                                                                                                                                                                                           |
| 401       | Unauthorized        | The server understood the request but is refusing to fulfill it. Return this code if the HMAC signature does not match.                                                                                                                                                                                                        |
| 403       | Forbidden           | The request is valid, but the caller does not have the necessary permissions, typically because the Authorization header is invalid.                                                                                                                                                                                           |
| 405       | Method Not Allowed  | The server does not implement the request's specified HTTP method, in this case, anything other than POST.                                                                                                                                                                                                                     |
| 500       | Internal Error      | Unexpected error.                                                                                                                                                                                                                                                                                                              |
| 503       | Service Unavailable | The server received the request but is not able to fulfill it.                                                                                                                                                                                                                                                                 |

## Response Result Status Object {#response-result-status-object}

For 200 responses, use the `ResponseStatus` object to provide additional response information as described in this table:

|                                              Scenario                                               | Accepted ResponseStatus Values |                                            Sample ResponseStatus Message                                             |
|-----------------------------------------------------------------------------------------------------|--------------------------------|----------------------------------------------------------------------------------------------------------------------|
| Transaction was identified and some response data provided.                                         | TRANSACTION_FOUND              | OK.                                                                                                                  |
| Transaction was not identified so no response data provided.                                        | TRANSACTION_NOT_FOUND          | The transaction could not be found.                                                                                  |
| Multiple transactions were identified from the request data.                                        | MULTIPLE_TRANSACTIONS_FOUND    | Multiple transactions were found for this request.                                                                   |
| Response details missing. This field is encouraged when the response code is set to `responseCode`. | RESPONSE_DETAILS_MISSING       | Provide context for the related Response Code.                                                                       |
| Metadata value exceeded the maximum allowed character limit.                                        | METADATA_TOO_LONG              | The metadata that you provided has a length that exceeds the limit. Your metadata may be truncated or not displayed. |

## Smart Subscriptions Specific Error Codes {#smart-subscriptions-specific-error-codes}

### 400 Bad Request {#400-bad-request}

This table shows the code and message you might receive for the Smart Subscriptions API and the steps you can take to resolve the error.

|       Reason Code       |                                 Description                                  |                                                                                                                                                     How to resolve                                                                                                                                                     |
|-------------------------|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `RESPONSE_CODE_MISSING` | A response code is required on all responses.                                | Provide a valid response code.                                                                                                                                                                                                                                                                                         |
| `VALIDATION_FAILED`     | One or more required fields are missing.                                     | Provide all required fields.                                                                                                                                                                                                                                                                                           |
| `VALIDATION_FAILED`     | One or more conditional requirements are not met.                            | Make sure all conditional requirements are met. See [Conditional Fields](https://developer.mastercard.com/ethoca-consumer-clarity-for-merchants/documentation/tutorials-and-guides/subscription-control-guide/index.md#conditional-fields) for details about the fields that are required based on certain conditions. |
| `MALFORMATED_FIELD`     | The field was improperly formatted.                                          | Provide a properly formatted field.                                                                                                                                                                                                                                                                                    |
| `OFFER_NOT_ALLOWED`     | In order to send a retention offer, the `offerAllowed` field must be `TRUE`. | Make sure the `offerAllowed` field is set to `TRUE`.                                                                                                                                                                                                                                                                   |

## Gateway Errors {#gateway-errors}

For more 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/).
