# Retrieve cardContractId
source: https://developer.mastercard.com/mastercard-processing-core/documentation/sandbox-testing/cms-identifiers-search/retrieve-cardcontractid/index.md

## Test case -- Success -- Retrieve cardContractId by the card contract number {#test-case--success--retrieve-cardcontractid-by-the-card-contract-number}

This test case describes retrieving the `cardContractId` assigned to the specified card contract number (PAN) stored in the CMS.

**Sample request**

`POST /cards/searches`

```JSON
{
  "cardContractIdentifier": "1234567890123456",
  "cardContractIdentifierType": "CARD_CONTRACT_NUMBER"
}
```

**Sample response**

`200`

```JSON
{
  "cardContractId": 70001
}
```

## Test case -- Success -- Retrieve cardContractId by the CBS number {#test-case--success--retrieve-cardcontractid-by-the-cbs-number}

This test case describes retrieving the `cardContractId` assigned to the specified CBS number stored in the CMS.

**Sample request**

`POST /cards/searches`

```JSON
{
  "cardContractIdentifier": "CBS83863371812034",
  "cardContractIdentifierType": "CBS_NUMBER"
}
```

**Sample response**

`200`

```JSON
{
  "cardContractId": 70001
}
```

## Test case -- Fail -- No Card Contract found {#test-case--fail--no-card-contract-found}

This test case describes an attempt to retrieve the `cardContractId` stored in the CMS by sending a card contract identifier that is not assigned to any card contract in the CMS.

For this test case, use the following information in the request:

|          Field           | Available value |
|--------------------------|-----------------|
| `cardContractIdentifier` | 10001           |

**Sample request**

`POST /cards/searches`

```JSON
{
  "cardContractIdentifier": " 10001",
  "cardContractIdentifierType": "CBS_NUMBER"
}
```

**Sample response**

`404`

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD PROCESSING",
        "ReasonCode": "CARD_CONTRACT_DOES_NOT_EXIST",
        "Description": "Card contract not found.",
        "Recoverable": false
      }
    ]
  }
}
```

