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

# Authorize Withdraw

## Overview

Generate a signed authorization to claim scheduled withdrawals from the vault. This is step 2 of the two-phase withdrawal process.

The authorization is valid for 30 seconds and can only be used once. It allows the user to claim up to their total unclaimed withdrawal amount.

<Info>
  To avoid ambiguity, we denote the smallest possible multiple of USDC (0.000001 USDC) as one `uusdc`,
  which stands for µUSDC (micro-USDC), and denote the smallest possible multiple of a contract (0.01 contract)
  as one `ccontract` (centicontract).

  User-facing USDC balances are specified as fixed-point strings (e.g. `"1.2625"` for USDC). Contract quantities
  in the API and SDK are specified as integer `ccontracts` strings (e.g. `"1050"` for 10.50 contracts at precision 2).
</Info>

## Withdrawal Flow

Bison uses a two-phase withdrawal process:

1. **Schedule** (`/schedule-withdraw`): User signs a message to request a withdrawal for a specific amount
2. **Claim** (`/get-withdraw-authorization` + on-chain tx): User gets authorization and executes the withdrawal on-chain

This endpoint handles step 2 - generating the authorization signature for claiming.

## Request Body

<ParamField path="chain" type="string" required>
  Chain to claim withdrawals on. One of `base` or `bsc`.
</ParamField>

<ParamField path="userAddress" type="string" required>
  User's Ethereum wallet address (checksummed or lowercase).
</ParamField>

## Response

<ResponseField name="uuid" type="string">
  Unique authorization identifier used to prevent replay attacks.
</ResponseField>

<ResponseField name="signature" type="string">
  EIP-712 signature for the withdrawal authorization that must be submitted to the vault contract.
</ResponseField>

<ResponseField name="expiresAt" type="number">
  Unix timestamp when the authorization expires (30 seconds from creation).
</ResponseField>

<ResponseField name="maxWithdrawAmount" type="string">
  Total amount available to claim in µUSDC (integer string). This is the sum of all unclaimed scheduled withdrawals.
</ResponseField>

## Error Responses

<ResponseField name="400 - No Withdrawals">
  Returned when the user has no unclaimed withdrawals available.

  ```json theme={null}
  {
    "error": "No unclaimed withdrawals available"
  }
  ```
</ResponseField>

<ResponseField name="400 - Pending Signature">
  Returned when the user already has an unexpired claim authorization.

  ```json theme={null}
  {
    "error": "You already have a pending withdrawal signature. Please use it or wait for expiry."
  }
  ```
</ResponseField>

<ResponseField name="500 - Server Error">
  Returned when authorization generation fails.

  ```json theme={null}
  {
    "error": "Withdraw authorization failed"
  }
  ```
</ResponseField>

## Example Request

```json theme={null}
{
  "chain": "base",
  "userAddress": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
}
```

## Example Response

```json theme={null}
{
  "uuid": "550e8400-e29b-41d4-a716-446655440000",
  "signature": "0x1234567890abcdef...",
  "expiresAt": 1699564830,
  "maxWithdrawAmount": "1000000"
}
```

## Usage Flow

1. **Schedule Withdrawals**: Use `/schedule-withdraw` to request withdrawal(s)
2. **Check Status**: Use `/pending-withdraws/{userAddress}` to see when withdrawals become `unclaimed`
3. **Get Authorization**: Call this endpoint to get claim signature
4. **Execute Claim**: Call `withdrawUSDC` on the vault contract with:
   * `uuid`: Unique authorization ID
   * `usdcAmount`: Amount to withdraw (≤ maxWithdrawAmount)
   * `userAddress`: User's wallet address
   * `expiry`: Expiration timestamp
   * `signature`: EIP-712 signature

## Important Notes

* Authorization expires in 30 seconds
* Each authorization can only be used once (replay protection via claim locks)
* User must have scheduled withdrawals in `unclaimed` status
* Multiple scheduled withdrawals are batched into a single claim
* Partial claims are supported - withdraw any amount up to `maxWithdrawAmount`
* After claiming, the user receives USDC directly to their wallet


## OpenAPI

````yaml POST /get-withdraw-authorization
openapi: 3.0.0
info:
  version: 1.0.0
  title: Bison API
servers: []
security: []
paths:
  /get-withdraw-authorization:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                chain:
                  type: string
                  enum:
                    - base
                    - bsc
                  description: 'Chain to execute the action on; one of: base, bsc'
                  example: base
                userAddress:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                  description: User wallet address
                  example: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
              required:
                - chain
                - userAddress
      responses:
        '200':
          description: Withdraw authorization generated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    type: string
                    description: Unique authorization ID
                  signature:
                    type: string
                    description: EIP-712 signature for the authorization
                  expiresAt:
                    type: number
                    description: Unix timestamp when authorization expires
                  maxWithdrawAmount:
                    type: string
                    description: Total amount available to withdraw in µUSDC
                required:
                  - uuid
                  - signature
                  - expiresAt
                  - maxWithdrawAmount
        '400':
          description: Bad request - no deposited balance to withdraw
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '500':
          description: Failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error

````