# Stakes

## Get Staking Stakes

Retrieve stakes associated with a specific staking pool, optionally filtered by wallet address.

### Endpoint

```
POST /api/external/v1/staking/stakes
```

### Authentication

This endpoint requires API authentication. Include your API key in the request headers.

### Request Body

| Field           | Type          | Required | Description                               |
| --------------- | ------------- | -------- | ----------------------------------------- |
| `stakingPoolId` | string (UUID) | Yes      | The unique identifier of the staking pool |
| `walletAddress` | string        | No       | Filter stakes by specific wallet address  |

#### Example Request

```json
{
  "stakingPoolId": "123e4567-e89b-12d3-a456-426614174000",
  "walletAddress": "0x1234567890abcdef1234567890abcdef12345678"
}
```

#### Example Request (All Stakes)

```json
{
  "stakingPoolId": "123e4567-e89b-12d3-a456-426614174000"
}
```

### Response

Returns a list of stakes for the specified staking pool.

#### Response Schema

| Field   | Type   | Description            |
| ------- | ------ | ---------------------- |
| `items` | array  | Array of stake objects |
| `total` | number | Total number of stakes |

#### Stake Object

| Field           | Type              | Description                                                                             |
| --------------- | ----------------- | --------------------------------------------------------------------------------------- |
| `id`            | string (UUID)     | Unique identifier of the stake                                                          |
| `amount`        | string (decimal)  | Amount staked                                                                           |
| `unstaked`      | string (decimal)  | Amount that has been unstaked                                                           |
| `claimed`       | string (decimal)  | Amount that has been claimed                                                            |
| `status`        | string            | Current status of the stake. Possible values: `PENDING`, `ACTIVE`, `UNSTAKED`, `FAILED` |
| `createdAt`     | string (ISO 8601) | Stake creation date and time                                                            |
| `walletAddress` | string            | Wallet address associated with the stake                                                |

#### Example Response (Filtered by Wallet)

```json
{
  "items": [
    {
      "id": "456e7890-e89b-12d3-a456-426614174001",
      "amount": "1000.50",
      "unstaked": "0.00",
      "claimed": "25.75",
      "status": "ACTIVE",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "walletAddress": "0x1234567890abcdef1234567890abcdef12345678"
    }
  ],
  "total": 1
}
```

#### Example Response (All Stakes)

```json
{
  "items": [
    {
      "id": "456e7890-e89b-12d3-a456-426614174001",
      "amount": "1000.50",
      "unstaked": "0.00",
      "claimed": "25.75",
      "status": "ACTIVE",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "walletAddress": "0x1234567890abcdef1234567890abcdef12345678"
    },
    {
      "id": "789e1234-e89b-12d3-a456-426614174002",
      "amount": "500.00",
      "unstaked": "500.00",
      "claimed": "50.00",
      "status": "UNSTAKED",
      "createdAt": "2024-01-10T14:20:00.000Z",
      "walletAddress": "0xabcdef1234567890abcdef1234567890abcdef12"
    }
  ],
  "total": 2
}
```

### Error Responses

#### 400 Bad Request

```json
{
  "error": "Invalid request body",
  "message": "stakingPoolId must be a valid UUID"
}
```

#### 401 Unauthorized

```json
{
  "error": "Unauthorized Request",
  "message": "Staking pool does not belong to your project"
}
```

#### 404 Not Found

```json
{
  "error": "Staking pool not found",
  "message": "No staking pool found with the provided ID"
}
```

### Rate Limits

This endpoint is subject to standard API rate limits. Please refer to the Rate Limiting documentation for more details.

### Notes

* When `walletAddress` is provided, only stakes from that specific wallet are returned
* If the wallet address is not found, an empty result set is returned
* All monetary values are returned as decimal strings to maintain precision
* The `createdAt` field is returned as an ISO 8601 formatted date string
* Status values are: `PENDING`, `ACTIVE`, `UNSTAKED`, `FAILED`
* The endpoint validates that the requested staking pool belongs to the authenticated project


---

# 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/staking/stakes.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.
