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

## Error Handling {#error-handling}

The Points Activity Service API 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 or system errors.

This section contains information about the response codes and error messages that can be returned by the APIs.

## Gateway Error Codes {#gateway-error-codes}

Apart from the error codes returned by the Points Activity Service APIs, other error codes can be returned by the Mastercard gateway, which verifies your request's signature and routes it to the correct location.

For further information about 4xx/5xx response codes returned by the gateway and their possible resolutions, see [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/).

## 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. rewards-points-api",
         "ReasonCode": "<Unique code>",
         "Description": "<Description of the error>",
         "Recoverable": "true/false",
         "Details": "null"
       }
     ]
   }
 }
```

|      Field      |                                                                                                                                                                          Description                                                                                                                                                                          |
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Source**      | The application (rewards-points-api) 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. For example, the rewards-points-api.                                                    |
| **ReasonCode**  | A unique constant identifying the error case encountered when the Points Activity Service API is called. For example, INVALID_INPUT, ACCOUNT_NOT_FOUND                                                                                                                                                                                                        |
| **Description** | Description of the `ReasonCode` field with additional details.                                                                                                                                                                                                                                                                                                |
| **Recoverable** | Indicates whether this error will always be returned for this request, or retrying could change the outcome. For example, if the request contains an invalid request parameter, retrying will never result in success. However, if the error is related to some unexpected timeout with the service, retrying the call could result in a successful response. |
| **Details**     | Provide detailed error information wherever appropriate to help in resolving errors.                                                                                                                                                                                                                                                                          |

## HTTP Response Codes {#http-response-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)                                                                                                                                                                |
| **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 Rewards Points API Errors structure in the response. |

## Points Activity Service Error Codes {#points-activity-service-error-codes}

### POST /points-adjustments {#post---points-adjustments}

|          Reason Code           |                                           Description                                            |
|--------------------------------|--------------------------------------------------------------------------------------------------|
| INVALID_INPUT                  | Returned for an invalid request. See the "Description" element in the response for more details. |
| ENCRYPTION_ERROR               | The request body is not encrypted.                                                               |
| DECRYPTION_ERROR               | Failed to decrypt the request body.                                                              |
| PROGRAM_MAPPING_ERROR          | Configuration error. The enterprise site is not found.                                           |
| SITE_PROGRAM_MAPPING_ERROR     | Configuration error. The program is not mapped to the enterprise site.                           |
| UNAUTHORIZED                   | A client with a clientId does not have access.                                                   |
| ACCOUNT_NOT_FOUND              | Account is not found.                                                                            |
| USER_NOT_FOUND                 | User is not found.                                                                               |
| MISSING_REQUIRED_FIELD         | Returned for an invalid request. See the "Description" element in the response for more details. |
| ADJUSTED_BY_USER_NOT_FOUND     | The adjustment by the user is not valid. Send a valid user ID.                                   |
| ADJUSTMENT_TYPE_CODE_NOT_VALID | Adjustment type code not found or too many records found for adjustment code.                    |
| ADJUSTMENT_FAILED              | Unable to perform the adjustment. Look into the Details field and reach out to the support team. |

### GET /points-adjustments-details {#get---points-adjustments-details}

|        Reason Code         |                                           Description                                            |
|----------------------------|--------------------------------------------------------------------------------------------------|
| INVALID_INPUT              | Returned for an invalid request. See the "Description" element in the response for more details. |
| PROGRAM_MAPPING_ERROR      | Configuration error. The enterprise site is not found.                                           |
| SITE_PROGRAM_MAPPING_ERROR | Configuration error. The program is not mapped to the enterprise site.                           |
| UNAUTHORIZED               | A client with a clientId does not have access.                                                   |
| ACCOUNT_NOT_FOUND          | An account is not found.                                                                         |
| USER_NOT_FOUND             | User is not found.                                                                               |
| MISSING_REQUIRED_FIELD     | Returned for an invalid request. See the "Description" element in the response for more details. |
| INVALID_LANGUAGE           | Invalid language code.                                                                           |
| INVALID_HOUSEHOLD          | Invalid Household ID.                                                                            |
| ADJUSTMENT_DETAILS_FAILED  | Unable to get adjustment details. Look into the Details field and reach out to the support team. |

### GET /points-details {#get---points-details}

|        Reason Code         |                                           Description                                            |
|----------------------------|--------------------------------------------------------------------------------------------------|
| ACCOUNT_NOT_FOUND          | An account is not found.                                                                         |
| INVALID_INPUT              | Returned for an invalid request. See the "Description" element in the response for more details. |
| MISSING_REQUIRED_FIELD     | Returned for an invalid request. See the "Description" element in the response for more details. |
| PROGRAM_MAPPING_ERROR      | Configuration error. The enterprise site is not found.                                           |
| SITE_PROGRAM_MAPPING_ERROR | Configuration error. The program is not mapped to the enterprise site.                           |
| UNAUTHORIZED               | A client with a clientId does not have access.                                                   |
| USER_NOT_FOUND             | User is not found.                                                                               |

### POST /points-details-searches {#post---points-details-searches}

|        Reason Code         |                                           Description                                            |
|----------------------------|--------------------------------------------------------------------------------------------------|
| INVALID_INPUT              | Returned for an invalid request. See the "Description" element in the response for more details. |
| ENCRYPTION_ERROR           | The request body is not encrypted.                                                               |
| DECRYPTION_ERROR           | Failed to decrypt the request body.                                                              |
| PROGRAM_MAPPING_ERROR      | Configuration error. The enterprise site is not found.                                           |
| SITE_PROGRAM_MAPPING_ERROR | Configuration error. The program is not mapped to the enterprise site.                           |
| UNAUTHORIZED               | A client with a clientId does not have access.                                                   |
| ACCOUNT_NOT_FOUND          | An account is not found.                                                                         |
| USER_NOT_FOUND             | User is not found.                                                                               |
| MISSING_REQUIRED_FIELD     | Returned for an invalid request. See the "Description" element in the response for more details. |

### GET /points-expirations-details {#get---points-expirations-details}

|        Reason Code         |                                           Description                                            |
|----------------------------|--------------------------------------------------------------------------------------------------|
| USER_NOT_FOUND             | User is not found.                                                                               |
| INVALID_INPUT              | Returned for an invalid request. See the "Description" element in the response for more details. |
| MISSING_REQUIRED_FIELD     | Returned for an invalid request. See the "Description" element in the response for more details. |
| SITE_PROGRAM_MAPPING_ERROR | Configuration error. The program is not mapped to the enterprise site.                           |
| PROGRAM_MAPPING_ERROR      | Configuration error. The enterprise site is not found.                                           |
| ACCOUNT_NOT_FOUND          | An account is not found.                                                                         |
| UNAUTHORIZED               | A client with a clientId does not have access.                                                   |

### POST /points-transfers {#post---points-transfers}

|               Reason Code                |                                                                                              Description                                                                                               |
|------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| INVALID_INPUT                            | Returned for an invalid request. See the "Description" element in the response for more details.                                                                                                       |
| PROGRAM_MAPPING_ERROR                    | Configuration error. The enterprise site is not found.                                                                                                                                                 |
| SITE_PROGRAM_MAPPING_ERROR               | Configuration error. The program is not mapped to the enterprise site.                                                                                                                                 |
| UNAUTHORIZED                             | A client with a clientId does not have access.                                                                                                                                                         |
| ENCRYPTION_ERROR                         | The request body is not encrypted.                                                                                                                                                                     |
| DECRYPTION_ERROR                         | Failed to decrypt the request body.                                                                                                                                                                    |
| ACCOUNT_NOT_FOUND                        | An account is not found.                                                                                                                                                                               |
| MISSING_REQUIRED_FIELD                   | Returned for an invalid request. See the "Description" element in the response for more details.                                                                                                       |
| TRANSFER_ACCOUNT_NOT_ENROLLED            | The Transfer account details do not match our records. Make sure the account is enrolled.                                                                                                              |
| TRANSFER_ACCOUNT_NOT_GOOD_STANDING       | The donating account must be in Good Standing to perform point transfers.                                                                                                                              |
| RECEIVE_ACCOUNT_NOT_ENROLLED             | The Receiving account details do not match our records. Make sure the account is enrolled.                                                                                                             |
| RECEIVE_ACCOUNT_INACTIVE                 | The receiving account must be in Good Standing to perform point transfers.                                                                                                                             |
| MISMATCHED_PARENT_ICA                    | Recipient you designate to receive your transferred points must be a customer of the same bank.                                                                                                        |
| SAME_HOUSEHOLD_TRANSFER_RECEIVE_ACCOUNTS | The recipient account is in the originating Account Group. You cannot transfer points to the same account Group.                                                                                       |
| INVALID_TRANSFER_QTY                     | Invalid Transfer Quantity. Transfer Quantity cannot be less than zero.                                                                                                                                 |
| NOT_ENOUGH_PTS_TO_TRANSFER               | Transfer Account has insufficient points to meet the request.                                                                                                                                          |
| SAME_TRANSFER_RECEIVE_ACCOUNTS           | You cannot transfer points to the same account number.                                                                                                                                                 |
| RECEIVE_ACCOUNT_LOST_STOLEN              | Receiving account is Lost or Stolen.                                                                                                                                                                   |
| INCOMPATIBLE_PROGRAMS                    | Transfer and Receiving account programs are not compatible.                                                                                                                                            |
| POINT_TRANSFER_MIN_POINTS_CAP_EXCEEDED   | The points transfer quantity cannot be less than the minimum points available for transfer.                                                                                                            |
| POINT_TRANSFER_MAX_POINTS_CAP_EXCEEDED   | The points transfer quantity cannot be more than the maximum points available for transfer.                                                                                                            |
| POINT_TRANSFER_MONTHLY_CAP_EXCEEDED      | Amount of points exceeds the monthly cap.                                                                                                                                                              |
| POINT_TRANSFER_YEARLY_CAP_EXCEEDED       | Amount of points exceeds the yearly cap.                                                                                                                                                               |
| NO_AVAILABLE_POINTS                      | The transfer card has no available points.                                                                                                                                                             |
| TRANSFER_FAILED                          | Unable to perform points transfer. Look into the Details field and reach out to the [support](https://developer.mastercard.com/points-activity-service/documentation/support/index.md#get-help/) team. |

