> For the complete documentation index, see [llms.txt](https://docs.tylt.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tylt.money/tylt-embedded-wallet-service/wallet-management-apis/get-travel-rule-counterparty.md).

# Get Travel Rule Counterparty

Retrieves the Travel Rule counterparty information associated with a transaction.

### Endpoint

```http
GET /whitelabel/compliance/travelRule/getCounterparty
```

### Request Headers

```http
x-tlp-apikey: <api-key>
x-tlp-signature: <hmac-signature>
```

### Query Parameters

Provide at least one of the following user identifiers: `endUserEmail`, `endUserId`, or `externalUserId`.

| Field            | Type   |    Required | Description                         |
| ---------------- | ------ | ----------: | ----------------------------------- |
| `endUserEmail`   | String | Conditional | End user’s registered email address |
| `endUserId`      | Number | Conditional | Tylt end-user ID                    |
| `externalUserId` | String | Conditional | Merchant’s own user identifier      |
| `transactionId`  | Number |         Yes | The transaction's identifier        |

### Example Request

```http
GET /whitelabel/compliance/travelRule/getCounterparty?externalUserId=user-10021&transactionId=98765
```

Signed query object:

```json
{
  "endUserId": 20001, // Optional: Provide one user identifier only
  "endUserEmail": "joe@example.com", // Optional: Alternative to endUserId and externalUserId
  "externalUserId": "user-10021", // Optional: Alternative to endUserId and endUserEmail
  "transactionId": 98765
}
```

### Transaction-Ownership Validation

Before returning counterparty information, Tylt verifies that the supplied `transactionId` belongs to the resolved end user.

The request is rejected where the transaction:

* Belongs to another end user
* Belongs to another merchant
* Does not exist
* Is not eligible for Travel Rule information

### Code Snippet

{% tabs %}
{% tab title="JavaScript (Axios)" %}

```javascript
import crypto from 'crypto';
import axios from 'axios';

const apiKey = 'your-api-key';
const apiSecret = 'your-api-secret';

const queryParams = {
    endUserId: 20001, // Optional: Provide one user identifier only
    endUserEmail: "joe@example.com", // Optional: Alternative to endUserId and externalUserId
    externalUserId: "user-10021", // Optional: Alternative to endUserId and endUserEmail
    transactionId: '2144884'
};

const rawPayload = JSON.stringify(queryParams);
const signature = crypto.createHmac('sha256', apiSecret).update(rawPayload).digest('hex');

const headers = {
    'x-tlp-apikey': apiKey,
    'x-tlp-signature': signature
};

const queryString = new URLSearchParams(queryParams).toString();
axios.get(`https://api.tylt.money/whitelabel/compliance/travelRule/getCounterparty?${queryString}`, { headers })
    .then(response => console.log(response.data))
    .catch(error => console.error('Error:', error.response ? error.response.data : error.message));
```

{% endtab %}
{% endtabs %}

### Example Response

```json
{
  "msg": "",
  "data": {
    "counterparty": {
      "firstName": "Joe",
      "lastName": "Doe",
      "type": "individual"
    }
  }
}
```

The exact counterparty fields depend on the Travel Rule schema and the information submitted for the transaction.

### No Counterparty Record

Where no Travel Rule counterparty information exists, the API may return an empty or `null` counterparty record.

```json
{
  "msg": "",
  "data": {
    "transactionId": 98765,
    "counterparty": null
  }
}
```

***

## Common Errors

| HTTP Status | Message                                                         | Description                                                   |
| ----------- | --------------------------------------------------------------- | ------------------------------------------------------------- |
| `400`       | `One of endUserEmail, endUserId or externalUserId is required.` | No end-user identifier was supplied                           |
| `400`       | `Invalid signature.`                                            | The signature does not match the query object                 |
| `400`       | Validation error                                                | One or more endpoint-specific parameters are invalid          |
| `401`       | `Api Key authentication failed!`                                | API key or signature is missing or unknown                    |
| `403`       | `API key or owner is inactive.`                                 | API access or merchant account is inactive                    |
| `403`       | `Whitelabel IP whitelist is not configured.`                    | No active IP whitelist has been configured                    |
| `403`       | `IP not whitelisted.`                                           | The request originated from an unauthorized IP                |
| `403`       | `End user is suspended.`                                        | The end-user account is suspended                             |
| `403`       | KYC approval required                                           | The end user has not completed the required KYC               |
| `404`       | `End user not found for this owner.`                            | No matching user exists under the merchant                    |
| `404`       | Transaction not found                                           | The transaction does not exist or does not belong to the user |
| `404`       | Wallet address not found                                        | No wallet address exists for the requested asset and network  |
| `503`       | `Unable to verify IP whitelist.`                                | Tylt could not complete the IP-whitelist check                |
