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

## Test case -- Success -- Retrieve clientId by the client number {#test-case--success--retrieve-clientid-by-the-client-number}

This test case describes retrieving the `clientId` assigned to the specified client number stored in the CMS.

**Sample request**

`POST /clients/searches`

```JSON
{
  "clientIdentifier": "4718181",
  "clientIdentifierType": "CLIENT_NUMBER"
}
```

**Sample response**

`200`

```JSON
{
  "clientId": 40000
}
```

## Test case -- Success -- Retrieve clientId by the identification document number {#test-case--success--retrieve-clientid-by-the-identification-document-number}

This test case describes retrieving the `clientId` assigned to the specified identification document number stored in the CMS.

**Sample request**

`POST /clients/searches`

```JSON
{
  "clientIdentifier": "161235698529328",
  "clientIdentifierType": "IDENTIFICATION_DOCUMENT_NUMBER"
}
```

**Sample response**

`200`

```JSON
{
  "clientId": 40000
}
```

## Test case -- Success -- Retrieve clientId by the social number {#test-case--success--retrieve-clientid-by-the-social-number}

This test case describes retrieving the `clientId` assigned to the specified social number stored in the CMS.

**Sample request**

`POST /clients/searches`

```JSON
{
  "clientIdentifier": "161235698529227",
  "clientIdentifierType": "SOCIAL_NUMBER"
}
```

**Sample response**

`200`

```JSON
{
  "clientId": 40000
}
```

## Test case -- Success -- Retrieve clientId by the taxpayer identifier {#test-case--success--retrieve-clientid-by-the-taxpayer-identifier}

This test case describes retrieving the `clientId` assigned to the specified taxpayer identifier stored in the CMS.

**Sample request**

`POST /clients/searches`

```JSON
{
  "clientIdentifier": "161235698529531",
  "clientIdentifierType": "TAXPAYER_IDENTIFIER"
}
```

**Sample response**

`200`

```JSON
{
  "clientId": 40000
}
```

## Test case -- Fail -- No Client found {#test-case--fail--no-client-found}

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

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

|       Field        | Available value |
|--------------------|-----------------|
| `clientIdentifier` | 20001           |

**Sample request**

`POST /clients/searches`

```JSON
{
  "clientIdentifier": "20001",
  "clientIdentifierType": "CLIENT_NUMBER"
}
```

**Sample response**

`404`

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

