> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shakesco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Stake

> Lock a portion of a customer's balance for a fixed period in return for rewards

<span style={{display:"none"}}>For the complete documentation index, see [llms.txt](/llms.txt).</span>

Locks tokens from the customer's available balance into a new stake position. Rewards accrue proportionally to the lock duration (see [`/set-staking-rate`](/api-reference/tokens/staking/set-staking-rate)). Each customer can have at most 50 active stakes; use [`/prune-inactive-stakes`](/api-reference/tokens/staking/prune-inactive-stakes) to clear unlocked ones.

<Info>
  Treat this as a transaction. If you don't get a response, fetch [`/stake-count`](/api-reference/tokens/staking/stake-count) before retrying.
</Info>

### Request Body

<ParamField body="customer_ref" type="string" required>
  Your unique identifier for this customer
</ParamField>

<ParamField body="amount" type="number" required>
  Number of tokens to lock. Decimals allowed.
</ParamField>

<ParamField body="lock_duration" type="string" required>
  Lock period in seconds (e.g. `"2592000"` = 30 days)
</ParamField>

### Response

<ResponseField name="tx_hash" type="string">
  Reference identifier for the stake
</ResponseField>

```javascript theme={null}
await fetch("https://tokens.shakesco.com/create-stake", {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    customer_ref: "customer-123",
    amount: 100,
    lock_duration: "2592000",
  }),
});
```

<ResponseExample>
  ```json 200 OK theme={null}
  { "tx_hash": "0xabc..." }
  ```

  ```json 400 Insufficient Balance theme={null}
  { "error": "Insufficient token balance" }
  ```

  ```json 400 Max Stakes Reached theme={null}
  { "error": "Maximum of 50 stakes reached" }
  ```
</ResponseExample>
