> For the complete documentation index, see [llms.txt](https://atoma.gitbook.io/atoma-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atoma.gitbook.io/atoma-docs/node-operators/atoma-node/atoma-node-daemon/claim-stacks.md).

# Claim Stacks

## Fund Management

**Claim Stack Funds**

```
POST /claim_funds
```

Submits a transaction to claim funds from completed and settled stacks.

**Request Body**

```json
{
    "stack_small_ids": [123, 456],
    "node_small_id": 789,
    "gas": "0x789",
    "gas_budget": 1000,
    "gas_price": 10
}
```

**Request Fields**

* `stack_small_ids` (array of integers): IDs of the stacks to claim funds from
* `node_small_id` (integer, optional): ID of the node claiming funds (if omitted, claims for all registered nodes)
* `gas` (string): Object ID of the gas object to pay for the transaction
* `gas_budget` (integer): Maximum gas units allowed for the transaction
* `gas_price` (integer): Price per gas unit in MIST

**Response Status Codes**

* `200 OK`: Successfully submitted claim funds transaction
* `500 Internal Server Error`: Failed to submit the transaction

**Response**

```json
{
    "tx_digest": "0xabc"
}
```

**Response Fields**

* `tx_digest` (string): Transaction digest that can be used to track the claim funds transaction

**Notes**

* Prerequisites for claiming funds:
  * Stack must be fully settled
  * All required attestations must be received
  * Settlement period must be complete
  * No unresolved disputes
* The claim process:
  * Transfers earned funds to the node's wallet
  * Marks the stack as claimed
  * Can claim from multiple stacks in one transaction
* Important considerations:
  * Funds can only be claimed once per stack
  * Failed claims must be retried
  * Gas fees apply to the claim transaction

**Example Error Response**

```json
{
    "error": "Failed to submit node claim funds tx"
}
```
