# Code and Formats
source: https://developer.mastercard.com/flight-delay-pass/documentation/code-and-formats/index.md

## HTTP Status Codes {#http-status-codes}

| **HTTP Status Code** | **Response** |                              **Description**                              |
|----------------------|--------------|---------------------------------------------------------------------------|
| 200                  | OK           | Everything worked as expected.                                            |
| 204                  | NO CONTENT   | The server successfully executed the method but returns no response body. |
| 400                  | BAD REQUEST  | The request was unacceptable, often due to missing a required parameter.  |
| 403                  | FORBIDDEN    | The API key doesn't have permissions to perform the request.              |

## Error Codes {#error-codes}

Mastercard returns errors in the following structure.

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "Loyalty Service - Flight Delay Pass",
        "ReasonCode": "NO_FLIGHT_EXISTS",
        "Description": "No flights matching the flight code, departure date, departure and arrival airports can be found",
        "Recoverable": false,
        "Details": ""
      }
    ]
  }
}
```

### Service Error Codes {#service-error-codes}

Error codes specific to Flight Delay Pass Service API are listed below.

|         **Error or Reason Code**          |                                                          **Description**                                                           |                              **How to Resolve**                              |
|-------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| MISSING_PARAMETER                         | Missing required fields                                                                                                            | Provide a missing parameter                                                  |
| MISSING_TITLE_PASSENGER                   | Passenger title must be present.                                                                                                   | Provide passenger title                                                      |
| MISSING_FIRST_NAME_PASSENGER              | Passenger first name must be present..                                                                                             | Provide passenger first name                                                 |
| MISSING_LAST_NAME_PASSENGER               | Passenger last name must be present.                                                                                               | Provide passenger last name                                                  |
| MISSING_EMAIL                             | Email must be present.                                                                                                             | Provide email address                                                        |
| MISSING_PHONE_NUMBER                      | Phone number must be present.                                                                                                      | Provide phone number                                                         |
| MISSING_TITLE_ADTNL_PASSENGER             | Additional passenger title must be present.                                                                                        | Provide additional passenger title                                           |
| MISSING_FIRST_NAME_ADTNL_PASSENGER        | Additional passenger first name must be present.                                                                                   | Provide additional passenger first name                                      |
| MISSING_LAST_NAME_ADTNL_PASSENGER         | Additional passenger last name must be present.                                                                                    | Provide additional passenger last name                                       |
| MISSING_DEPARTURE_CODE                    | Departure airport code must be present.                                                                                            | Provide departure airport code                                               |
| MISSING_ARRIVAL_CODE                      | Arrival airport code must be present.                                                                                              | Provide arrival airport code                                                 |
| MISSING_FLIGHT_CODE                       | Flight code must be present.                                                                                                       | Provide flight code                                                          |
| MISSING_DATE                              | Departure date must be present.                                                                                                    | Provide departure date                                                       |
| INVALID_LENGTH_USER                       | UserId must have 36 characters maximum.                                                                                            | Provide UserId with Max 36 characters                                        |
| INVALID_LENGTH_LOCALE                     | Locale must have 5 characters maximum.                                                                                             | Provide Locale with Max 5 Characters                                         |
| INVALID_LENGTH_PROPOSITION                | Proposition must have 20 characters maximum.                                                                                       | Provide Proposition with Max 20 Characters                                   |
| INVALID_LENGTH_TITLE_PASSENGER            | Passenger title must have 4 characters maximum.                                                                                    | Provide title with Max 4 Characters                                          |
| INVALID_LENGTH_FIRST_NAME_PASSENGER       | Passenger first name must have 50 characters maximum.                                                                              | Provide first name with Max 50 Characters                                    |
| INVALID_LENGTH_LAST_NAME_PASSENGER        | Passenger last name must have 50 characters maximum.                                                                               | Provide last name with Max 50 Characters                                     |
| INVALID_LENGTH_EMAIL                      | Email must have 50 characters maximum.                                                                                             | Provide email with Max 50 Characters                                         |
| INVALID_LENGTH_PHONE_NUMBER               | Phone number must have 20 characters maximum.                                                                                      | Provide phone number with Max 20 Characters                                  |
| INVALID_LENGTH_TITLE_ADTNL_PASSENGER      | Additional passenger title must have 4 characters maximum.                                                                         | Provide Additional passenger title with Max 4 Characters                     |
| INVALID_LENGTH_FIRST_NAME_ADTNL_PASSENGER | Additional passenger first name must have 50 characters maximum.                                                                   | Provide additional passenger first name with Max 50 Characters               |
| INVALID_LENGTH_LAST_NAME_ADTNL_PASSENGER  | Additional passenger last name must have 50 characters maximum.                                                                    | Provide additional passenger last name with Max 50 Characters                |
| INVALID_LENGTH_DEPARTURE_CODE             | Departure airport code must have 3 characters.                                                                                     | Provide departure airport code with Max 3 characters                         |
| INVALID_LENGTH_ARRIVAL_CODE               | Arrival airport code must have 3 characters.                                                                                       | Provide arrival airport code with Max 3 characters                           |
| INVALID_LENGTH_FLIGHT_CODE                | Flight code must be between 4 and 7 characters long.                                                                               | Provide flight code between 4 and 7 characters                               |
| INVALID_LENGTH_FLIGHT_DELAY_PASS_REG_ID   | Invalid Flight Delay Pass Registration ID length.                                                                                  | Provide flight delay pass registration ID with 36 characters                 |
| INVALID_LENGTH_DATE                       | Departure date must have 10 characters.                                                                                            | Provide departure date with 10 characters in YYYY-MM-DD format               |
| INVALID_DEPARTURE_DATE                    | Invalid date format. Only dates in YYYY-MM-DD allowed.                                                                             | Provide valid date format in YYYY-MM-DD format                               |
| DEPARTURE_DATE_IN_PAST                    | Invalid date. Date must not be in the past                                                                                         | Provide valid departure date today or future                                 |
| INVALID_TITLE_PASSENGER                   | Invalid characters in passenger title. Only characters allowed are letters, spaces, and the following symbols: - .                 | Provide valid characters for passenger title                                 |
| INVALID_FIRST_NAME_PASSENGER              | Invalid characters in passenger first name. Only characters allowed are letters, spaces, and the following symbols: - .            | Provide valid characters for passenger first name                            |
| INVALID_LAST_NAME_PASSENGER               | Invalid characters in passenger last name. Only characters allowed are letters, spaces, and the following symbols: - .             | Provide valid characters for passenger last name                             |
| INVALID_EMAIL                             | Invalid email.                                                                                                                     | Provide valid email address                                                  |
| INVALID_PHONE_NUMBER                      | Invalid phone number format. Begin with +, followed by the phone number.                                                           | Provide valid phone number begin with +, followed by the phone number        |
| INVALID_TITLE_ADTNL_PASSENGER             | Invalid characters in additional passenger title. Only characters allowed are letters, spaces, and the following symbols: - .      | Provide valid characters for additional passenger title                      |
| INVALID_FIRST_NAME_ADTNL_PASSENGER        | Invalid characters in additional passenger first name. Only characters allowed are letters, spaces, and the following symbols: - . | Provide valid characters for additional passenger first name                 |
| INVALID_LAST_NAME_ADTNL_PASSENGER         | Invalid characters in additional passenger last name. Only characters allowed are letters, spaces, and the following symbols: - .  | Provide valid characters for additional passenger last name                  |
| INVALID_DEPARTURE_CODE                    | Invalid departure airport code. Only 3 capitalized letters allowed.                                                                | Provide valid departure airport code with only 3 capitalized letters allowed |
| INVALID_ARRIVAL_CODE                      | Invalid arrival airport code. Only 3 capitalized letters allowed.                                                                  | Provide valid arrival airport code with only 3 capitalized letters allowed   |
| INVALID_LOCALE                            | Invalid locale.                                                                                                                    | Provide valid locale                                                         |
| INVALID_USER                              | Invalid userId.                                                                                                                    | Provide valid userId                                                         |
| INVALID_REGISTRATION_ID                   | Registration ID {} does not exist                                                                                                  | Provide valid registrationId                                                 |
| INVALID_PROPOSITION                       | Proposition is not configured for this API Key                                                                                     | Provide proposition associated to ApiKey                                     |
| ACTIVE_REGISTRATION_ID_NOT_FOUND          | No active registration with the given ID was found.                                                                                | Provide registration ID for a successfully registered, non-cancelled flight  |
| API_KEY_NOT_AUTHORIZED                    | Not authorized to request a flight delay pass.                                                                                     | Provide valid ApiKey for Authorization                                       |
| REGISTRATION_UPDATE_NOT_AUTHORIZED        | Not authorized to update the existing registration.                                                                                | Provide valid Apikey for Authorization                                       |
| INVALID_API_KEY                           | Invalid API Key                                                                                                                    | Provide valid ApiKey for the proposition                                     |
| FDP_INVALID_ENCRYPTION_KEY                | Invalid encryption key used. Please re-try with the correct key.                                                                   | Provide valid Encryption Key                                                 |
| ALREADY_CANCELLED                         | Given registration is already cancelled.                                                                                           | Provide valid Registration Id for cancellation                               |
| NOT_AUTHORIZED                            | Not authorized to update or cancel the existing registration.                                                                      | Provide valid ApiKey for Authorization                                       |

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

In addition to service error codes, error codes can also be returned by Mastercard's gateway, which is used to verify your request's signature, and route it to the correct location.

You can find a list of the errors returned by our Gateway, as well as resolutions to each errors, on [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/).
