# Merkle Proof

Retrieve the merkle proof data for a specific allocation. This endpoint returns the cryptographic proof required to verify an allocation's inclusion in a merkle tree, which is required for claiming tokens in merkle-based distributions.

The merkle proof contains the proof array, decodable arguments, and root index needed to verify and claim the allocation on-chain.

**Route:** `GET /api/external/v1/allocations/{id}/merkle-proof`

### Request example:

```bash
curl -X GET https://app.magna.so/api/external/v1/allocations/{allocation_id}/merkle-proof \
-H 'Content-Type: application/json' \
-H 'x-magna-api-token: magna_project_api_token'
```

**Parameters:**

* `magna_project_api_token` (required) - replace with your actual Magna API token
* `allocation_id` (required) - the UUID of the allocation to get merkle proof for

### Response example:

```json
{
  "isProcessed": true,
  "result": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "decodableArgs": "0x1234567890abcdef1234567890abcdef12345678901234567890abcdef12345678",
    "hash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",
    "walletAddress": "0x742d35Cc6634C0532925a3b8D8c9f82bA2D2BbEc",
    "proof": [
      "0x1111111111111111111111111111111111111111111111111111111111111111",
      "0x2222222222222222222222222222222222222222222222222222222222222222",
      "0x3333333333333333333333333333333333333333333333333333333333333333"
    ],
    "input": null,
    "merkleTreeId": "9876543a-bcde-f012-3456-789abcdef012",
    "distributionId": "fedcba98-7654-3210-fedc-ba9876543210",
    "rootIndex": 42,
    "createdAt": "2024-04-15T21:26:21.000Z",
    "updatedAt": "2024-04-15T21:26:21.000Z"
  }
}
```

### Response Fields:

* `id` - Unique identifier for the merkle leaf
* `decodableArgs` - Encoded arguments needed for on-chain verification
* `hash` - Hash of the merkle leaf (may be null)
* `walletAddress` - Wallet address associated with this allocation
* `proof` - Array of merkle proof hashes required for verification
* `input` - Additional input data (typically null)
* `merkleTreeId` - ID of the merkle tree containing this leaf
* `distributionId` - ID of the distribution this proof belongs to
* `rootIndex` - Index of the merkle tree root for verification
* `createdAt` - Timestamp when the merkle leaf was created
* `updatedAt` - Timestamp when the merkle leaf was last updated

### Error Responses:

* `404` - Allocation not found or merkle leaf doesn't exist for the allocation
* `401` - Invalid or missing API token
* `403` - Insufficient permissions to access this allocation


---

# 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://docs.magna.so/magna-api-documentation/allocations/merkle-proof.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.
