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

# Parse Intent

> Parse natural language command into transaction parameters

### Authorization

<ParamField header="Authorization" type="string" required>
  Bearer token. Format: `Bearer bookie_live_abc123def456`
</ParamField>

### Body Parameters

<ParamField body="walletAddress" type="string" required>
  Solana wallet address. Format: Base58 encoded public key
</ParamField>

<ParamField body="command" type="string" required>
  Natural language command. Max 500 characters.

  Examples: "Swap 5 SOL for USDC", "Send 10 USDC to alice.sol"
</ParamField>

<ParamField body="slippage" type="number">
  Slippage tolerance in basis points. Default: 50 (0.5%)

  Range: 1-1000 (0.01% - 10%)
</ParamField>

<ParamField body="priorityFee" type="number">
  Priority fee in microlamports. Default: 1000

  Higher values increase transaction priority during congestion
</ParamField>

### Response

<ResponseField name="intentId" type="string">
  Unique intent identifier. Format: `intent_<16 chars>`
</ResponseField>

<ResponseField name="action" type="string">
  Parsed action type. Options: `swap`, `transfer`, `query`
</ResponseField>

<ResponseField name="parameters" type="object">
  Extracted transaction parameters

  Properties:

  * `inputToken` (string): Input token mint address
  * `outputToken` (string): Output token mint address
  * `amount` (number): Amount in base units (lamports)
  * `recipient` (string): Recipient address (for transfers)
</ResponseField>

<ResponseField name="route" type="object">
  Jupiter routing information (for swaps)

  Properties:

  * `inAmount` (string): Input amount
  * `outAmount` (string): Expected output amount
  * `priceImpact` (number): Price impact percentage
  * `marketInfos` (array): DEX routing details
</ResponseField>

<ResponseField name="confidence" type="number">
  Intent parsing confidence score (0-1)
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.bookie.app/v1/intents \
    --header 'Authorization: Bearer bookie_live_abc123def456' \
    --header 'Content-Type: application/json' \
    --data '{
      "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
      "command": "Swap 5 SOL for USDC",
      "slippage": 50
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.bookie.app/v1/intents', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.BOOKIE_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      walletAddress: '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
      command: 'Swap 5 SOL for USDC',
      slippage: 50
    })
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.bookie.app/v1/intents',
      headers={
          'Authorization': f'Bearer {api_key}',
          'Content-Type': 'application/json'
      },
      json={
          'walletAddress': '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU',
          'command': 'Swap 5 SOL for USDC',
          'slippage': 50
      }
  )
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "intentId": "intent_abc123def456",
    "action": "swap",
    "parameters": {
      "inputToken": "So11111111111111111111111111111111111111112",
      "outputToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "amount": 5000000000
    },
    "route": {
      "inAmount": "5000000000",
      "outAmount": "736250000",
      "priceImpact": 0.12,
      "marketInfos": [
        {
          "id": "orca",
          "label": "Orca Whirlpool",
          "inputMint": "So11111111111111111111111111111111111111112",
          "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
          "inAmount": "5000000000",
          "outAmount": "736250000",
          "fee": 0.003
        }
      ]
    },
    "confidence": 0.98
  }
  ```

  ```json 400 - Bad Request theme={null}
  {
    "error": {
      "code": "validation_error",
      "message": "Invalid wallet address format",
      "field": "walletAddress"
    }
  }
  ```

  ```json 422 - Unprocessable Entity theme={null}
  {
    "error": {
      "code": "parsing_error",
      "message": "Could not extract transaction parameters from command",
      "details": {
        "command": "Do something",
        "reason": "Ambiguous intent - please specify tokens and amounts"
      }
    }
  }
  ```
</ResponseExample>
