> For the complete documentation index, see [llms.txt](https://dev.ada-anvil.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.ada-anvil.io/guides/delegations/delegate-to-a-pool.md).

# Delegate to a Stake Pool

Stake pool delegation allows users to participate in Cardano's consensus protocol by delegating their stake to a pool that produces blocks. By integrating stake pool delegation into your application, you enable users to earn rewards while supporting the network's security and decentralization without requiring technical expertise in running validator nodes.

## API Endpoint

**URL**: `https://preprod.api.ada-anvil.app/v2/services/transactions/build`\
**Method**: POST\
**Headers**: `Content-Type: application/json`, `x-api-key: YOUR_API_KEY`

## Request Format

```json
{
  "changeAddress": "addr_test1...",
  "utxos": ["8282...", "8282..."],
  "delegations": [
    {
      "type": "pool",
      "address": "addr_test1...",
      "keyHash": "pool1z5uq..."
    }
  ]
}
```

## Parameter Details

| Parameter | Description                       | Example                  |
| --------- | --------------------------------- | ------------------------ |
| `type`    | Must be `"pool"`                  | `"pool"`                 |
| `address` | User's full address               | `"addr_test1..."`        |
| `keyHash` | Pool ID to delegate to            | `"pool1z5uq..."`         |
| `utxos`   | Array of UTXOs in CBOR hex format | `["8282...", "8282..."]` |

## Implementation Examples

**Using Fetch API:**

{% content-ref url="/pages/qfEgD3KXAoD2Ew1fpSEa" %}
[Deno & Fetch](/guides/delegations/delegate-to-a-pool/deno-and-fetch.md)
{% endcontent-ref %}

**Using cURL:**

{% content-ref url="/pages/HAfa7mrbIDsZxHgxDIwG" %}
[Bash & cURL](/guides/delegations/delegate-to-a-pool/bash-and-curl.md)
{% endcontent-ref %}

## Transaction Signing

After building the transaction, it must be signed before submission:

{% content-ref url="<https://github.com/Cardano-Forge/anvil-api/blob/main/docs/guides/transaction/signing-transaction.md>" %}
<https://github.com/Cardano-Forge/anvil-api/blob/main/docs/guides/transaction/signing-transaction.md>
{% endcontent-ref %}

## User Interface Examples

<figure><img src="/files/QRdFFC8RGHlcMyqIVlMI" alt="Stake Pool Delegation"><figcaption><p>Eternl's Stake Pool delegation interface provides a good reference</p></figcaption></figure>
