# Retrieve Consumer Scores
source: https://developer.mastercard.com/consumer-credit-analytics/documentation/testing/scores-req-res/index.md

## Pre-requisites {#pre-requisites}

Refer to the [Score for Consumers](https://developer.mastercard.com/consumer-credit-analytics/documentation/use-cases/consumer-scores/index.md) use case section.

## Request URL for Sandbox Environment {#request-url-for-sandbox-environment}

    POST https://sandbox.api.mastercard.com/consumer/credit-analytics/scores

## Request URL for Production Environment {#request-url-for-production-environment}

    POST https://api.mastercard.com/consumer/credit-analytics/scores

## Test Case for Score for Consumers {#test-case-for-score-for-consumers}

The endpoint allows you to retrieve the delinquency score for the consumer.

### Positive Test Cases {#positive-test-cases}

#### Test case 1: Consumer PAN with prediction score available {#test-case-1-consumer-pan-with-prediction-score-available}

**Request**

```java
{
  "hasEmbedding": true,
  "countryCode": "USA",
  "customerPANs": [
    {
      "customerPAN": "5425233430109903",
      "hasConsent": true
    }
  ],
  "scoreTypes": [
    "DELINQUENCY"
  ],
  "productTypes": [
    "CREDIT_CARD"
  ]
}
```

Response

```java
{
    "predictionDataErrors": [
    ],
    "predictionDataSuccesses": [
        {
            "customerPAN": "5425233430109903",
            "scores": [
                {
                    "decile": 1,
                    "embeddingFeatures": "{f1:0.113484,f2:0.113484,f3:0.070811,f4:0.059630,f5:0.051926,f6:0.044747,f7:0.042843,f8:0.039946,f9:0.039111,f10:0.033302,f11:0.027863,f12:0.025530,f13:0.024628,f14:0.023502,f15:0.020766,f16:0.020333}",
                    "hasScoreChangedFromLastWeek": true,
                    "isNewProspect": false,
                    "modelName": "CCA_CCS_Del_M2_v1.0",
                    "productType": "CREDIT_CARD",
                    "score": 8,
                    "scoreType": "DELINQUENCY"
                }
            ]
        }
    ]
}
```

#### Test case 2: Success response with new prospect {#test-case-2-success-response-with-new-prospect}

Request

```java
{
  "hasEmbedding": true,
  "countryCode": "USA",
  "customerPANs": [
    {
      "customerPAN": "5408577159639842",
      "hasConsent": true
    }
  ],
  "scoreTypes": [
    "DELINQUENCY"
  ],
  "productTypes": [
    "CREDIT_CARD"
  ]
}
```

Response

```java
{
    "predictionDataErrors": [
    ],
    "predictionDataSuccesses": [
        {
            "customerPAN": "5408577159639842",
            "scores": [
                {
                    "decile": 4,
                    "embeddingFeatures": "{f1:0.113484,f2:0.113484,f3:0.070811,f4:0.059630,f5:0.051926,f6:0.044747,f7:0.042843,f8:0.039946,f9:0.039111,f10:0.033302,f11:0.027863,f12:0.025530,f13:0.024628,f14:0.023502,f15:0.020766,f16:0.020335}",
                    "hasScoreChangedFromLastWeek": false,
                    "isNewProspect": true,
                    "modelName": "CCA_CCS_Del_M2_v1.0",
                    "productType": "CREDIT_CARD",
                    "score": 363,
                    "scoreType": "DELINQUENCY"
                }
            ]
        }
    ]
}
```

#### Test case 3: Success response without embedded features {#test-case-3-success-response-without-embedded-features}

Request

```java
{
  "hasEmbedding": false,
  "countryCode": "USA",
  "customerPANs": [
    {
      "customerPAN": "5537502036796908",
      "hasConsent": true
    }
  ],
  "scoreTypes": [
    "DELINQUENCY"
  ],
  "productTypes": [
    "CREDIT_CARD"
  ]
}
```

Response

```java
{
    "predictionDataErrors": [
    ],
    "predictionDataSuccesses": [
        {
            "customerPAN": "5537502036796908",
            "scores": [
                {
                    "decile": 9,
                    "hasScoreChangedFromLastWeek": false,
                    "isNewProspect": true,
                    "modelName": "CCA_CCS_Del_M2_v1.0",
                    "productType": "CREDIT_CARD",
                    "score": 978,
                    "scoreType": "DELINQUENCY"
                }
            ]
        }
    ]
}
```

#### Test case 4: Consumer PAN with prediction score for multiple model evaluations {#test-case-4-consumer-pan-with-prediction-score-for-multiple-model-evaluations}

Request

```java
{
  "hasEmbedding": true,
  "countryCode": "USA",
  "customerPANs": [
    {
      "customerPAN": "5779964451763663",
      "hasConsent": true
    }
  ],
  "scoreTypes": [
    "DELINQUENCY"
  ],
  "productTypes": [
    "CREDIT_CARD"
  ]
}
```

Response

```java
{
    "predictionDataErrors": [
    ],
    "predictionDataSuccesses": [
        {
            "customerPAN": "5779964451763663",
            "scores": [
                {
                    "decile": 5,
                    "embeddingFeatures": "{f1:0.112583,f2:0.112583,f3:0.060701,f4:0.046730,f5:0.042813,f6:0.034621,f7:0.032743,f8:0.028835,f9:0.028121,f10:0.023302,f11:0.028361,f12:0.024410,f13:0.023618,f14:0.022301,f15:0.021516,f16:0.021212}",
                    "hasScoreChangedFromLastWeek": false,
                    "isNewProspect": true,
                    "modelName": "CCA_CCS_Del_M2_v1.0",
                    "productType": "CREDIT_CARD",
                    "score": 570,
                    "scoreType": "DELINQUENCY"
                },
                {
                    "decile": 7,
                    "embeddingFeatures": "{f1:0.113484,f2:0.113484,f3:0.070811,f4:0.059630,f5:0.051926,f6:0.044747,f7:0.042843,f8:0.039946,f9:0.039111,f10:0.033302,f11:0.027863,f12:0.025530,f13:0.024628,f14:0.023502,f15:0.020766,f16:0.020336}",
                    "hasScoreChangedFromLastWeek": false,
                    "isNewProspect": true,
                    "modelName": "CCA_CCS_Del_M1_v1.0",
                    "productType": "CREDIT_CARD",
                    "score": 790,
                    "scoreType": "DELINQUENCY"
                }
            ]
        }
    ]
}
```

### Negative Test Cases {#negative-test-cases}

#### Test case 1 - Not enough transactions to score {#test-case-1---not-enough-transactions-to-score}

Request

```java
{
  "hasEmbedding": true,
  "countryCode": "USA",
  "customerPANs": [
    {
      "customerPAN": "5407502036052150",
      "hasConsent": true
    }
  ],
  "scoreTypes": [
    "DELINQUENCY"
  ],
  "productTypes": [
    "CREDIT_CARD"
  ]
}
```

Response

```java
{
  "predictionDataSuccesses": [],
  "predictionDataErrors": [
    {
      "customerPAN": "5407502036052150",
      "errors": [
        {
          "reasonCode": "NOT_ENOUGH_TRANSACTIONS_TO_SCORE",
          "errorMessage": "Not enough transactions to calculate the score. Check with the consumer for alternate primary Mastercard Debit/Credit Card Number.",
          "modelName": "CCA_CCS_Del_M2_v1.0",
          "scoreType": "DELINQUENCY",
          "productType": "CREDIT_CARD"
        }
      ]
    }
  ]
}
```

#### Test case 2 - Too new to score {#test-case-2---too-new-to-score}

Request

```java
{
  "hasEmbedding": true,
  "countryCode": "USA",
  "customerPANs": [
    {
      "customerPAN": "2222420000001113",
      "hasConsent": true
    }
  ],
  "scoreTypes": [
    "DELINQUENCY"
  ],
  "productTypes": [
    "CREDIT_CARD"
  ]
}
```

Response

```java
{
  "predictionDataSuccesses": [],
  "predictionDataErrors": [
    {
      "customerPAN": "2222420000001113",
      "errors": [
        {
          "reasonCode": "CARD_TOO_NEW_TO_SCORE",
          "errorMessage": "Not enough transactions to calculate the score as either the card is too new or, has not recorded any transactions in the past one year. Check with the consumer for alternate primary Mastercard Debit/Credit Card Number.",
          "modelName": "CCA_CCS_Del_M2_v1.0",
          "scoreType": "DELINQUENCY",
          "productType": "CREDIT_CARD"
        }
      ]
    }
  ]
}
```

#### Test case 3 - Too new to score for multiple model evaluations {#test-case-3---too-new-to-score-for-multiple-model-evaluations}

Request

```java
{
  "hasEmbedding": true,
  "countryCode": "USA",
  "customerPANs": [
    {
      "customerPAN": "5255923576711240",
      "hasConsent": true
    }
  ],
  "scoreTypes": [
    "DELINQUENCY"
  ],
  "productTypes": [
    "CREDIT_CARD"
  ]
}
```

Response

```java
{
  "predictionDataSuccesses": [],
  "predictionDataErrors": [
    {
      "customerPAN": "5255923576711240",
      "errors": [
        {
          "reasonCode": "CARD_TOO_NEW_TO_SCORE",
          "errorMessage": "Not enough transactions to calculate the score as either the card is too new or, has not recorded any transactions in the past one year. Check with the consumer for alternate primary Mastercard Debit/Credit Card Number.",
          "modelName": "CCA_CCS_Del_M2_v1.0",
          "scoreType": "DELINQUENCY",
          "productType": "CREDIT_CARD"
        },
        {
          "reasonCode": "CARD_TOO_NEW_TO_SCORE",
          "errorMessage": "Not enough transactions to calculate the score as either the card is too new or, has not recorded any transactions in the past one year. Check with the consumer for alternate primary Mastercard Debit/Credit Card Number.",
          "modelName": "CCA_CCS_Del_M1_v1.0",
          "scoreType": "DELINQUENCY",
          "productType": "CREDIT_CARD"
        }
      ]
    }
  ]
}
```

