# Validate Transaction

## validateTransaction

<mark style="color:green;">`POST`</mark> `https://api.harpie.io/v2/validateTransaction`

Get insights on the safety of a transaction. Addresses with no relevant data default to a recommended action of "ALLOW."

#### Request Body

| Name                                     | Type   | Description                                                                                                                                                                 |
| ---------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| apiKey<mark style="color:red;">\*</mark> | String | Your API key. You can find this in your dashboard.                                                                                                                          |
| from<mark style="color:red;">\*</mark>   | String | <p>The address that the transaction is originating from. <br>This is the <code>.from</code> parameter of an Ethereum transaction.</p>                                       |
| to<mark style="color:red;">\*</mark>     | String | <p>The address that the transaction is being sent to.</p><p>This is the <code>.to</code> parameter of an Ethereum transaction.</p>                                          |
| data<mark style="color:red;">\*</mark>   | String | <p>The data being passed along with the transaction.</p><p>This is the <code>.data</code> parameter of an Ethereum transaction. If no data exists, use "0x" by default.</p> |
| value<mark style="color:red;">\*</mark>  | Number | <p>The value being sent along with the transaction.</p><p>This is the <code>.value</code> parameter of an Ethereum transaction</p>                                          |

{% tabs %}
{% tab title="200: OK A summary on transaction security" %}

```typescript
{
    summary: string,
    isDangerousOperation: boolean, // Returns `true` if the operation is a transfer or approval
    recommendedAction: "ALLOW" | "BLOCK",
    addressDetails: {
        name: string,
        isMaliciousAddress: boolean,
        isAssociatedWithProtocol: boolean,
        tags: {
            THEFT: boolean,
            CYBERCRIME: boolean,
            SANCTIONED: boolean,
            BOT: boolean,
            WASH_TRADER: boolean,
            MIXER: boolean,
            NO_DATA: boolean,
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Example query:**

```typescript
fetch("https://api.harpie.io/v2/validateTransaction", {
    method: "POST",
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        apiKey: "{YOUR API KEY HERE}",
        to: "0xEea6cEDf9c8a4bD197Ced6F11B254138B388a5f5",
        value: 0,
        from: "0x84F3Cfa1Ecbf333A3e91C0DAF7415ea0F1bcB701",
        data: "0xa9059cbb00000000000000000000000055456cbd1f11298b80a53c896f4b1dc9bc16c731000000000000000000000000000000000000000000000000000de0b6b3a7640000"
    })
})

```

#### Example response:

{% code overflow="wrap" %}

```json
{
  "summary": "This transaction calls a token approval, which sends assets to a known malicious address. We recommend BLOCKING this transaction.",
  "isDangerousOperation": true,
  "recommendedAction": "BLOCK",
  "addressDetails": {
    "name": "Malicious Address",
    "isMaliciousAddress": true,
    "isAssociatedWithProtocol": false,
    "tags": {
      "THEFT": true,
      "CYBERCRIME": false,
      "NO_DATA": false,
      "SANCTIONED": false,
      "MIXER": false,
      "BOT": false,
      "WASH_TRADER": false
    }
  }
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://harpie.gitbook.io/welcome-to-the-harpie-docs/~/changes/T8YMsU3xPtqI6mFgVEdC/harpie-for-developers/background-check-api/validate-transaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
