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

# 快速開始

> 你的第一則 AFK Crypto API 請求

## 4 步完成入門

建立帳戶、啟用自動化、建立 API Key，並發起你的第一則請求。

### 步驟 1：登入

<AccordionGroup>
  <Accordion icon="user" title="登入你的帳戶">
    造訪 <a href="https://app.afkcrypto.com">app.afkcrypto.com</a> 登入。
  </Accordion>
</AccordionGroup>

### 步驟 2：啟用自動化（錢包）

<AccordionGroup>
  <Accordion icon="toggle-on" title="允許 AFK 替你簽名（非託管）">
    在 <a href="https://app.afkcrypto.com/wallets">Wallets</a> 頁面，為你的位址開啟 Automation。AFK 會以工作階段為基礎的非託管簽章為自動化流程簽署交易。你可隨時撤銷。
  </Accordion>
</AccordionGroup>

### 步驟 3：建立 API Key（錢包自動化）

<AccordionGroup>
  <Accordion icon="key" title="建立 API Key">
    在主控台 <a href="https://app.afkcrypto.com/api-keys">API Keys</a> 頁面建立錢包自動化的 API Key。

    * 請求標頭：`x-api-key: afk_<prefix>_<random>`
    * 請妥善保管；若外洩請立即輪替

    詳見 <a href="/api-reference/authentication/">身分驗證</a>。
  </Accordion>
</AccordionGroup>

### 步驟 4：發起 API 請求

<AccordionGroup>
  <Accordion icon="list" title="列出錢包">
    將 API Key 設定到環境變數方便複用：

    ```bash theme={null}
    export AFK_API_KEY="afk_abcd_xxx"
    ```

    ```bash theme={null}
    curl -s -H "x-api-key: $AFK_API_KEY" \
      "https://api.afkcrypto.com/v1/wallets?chain=ethereum"
    ```

    ```json theme={null}
    {
      "wallets": [
        {
          "address": "0xabc...",
          "chainType": "ethereum",
          "isDefault": true,
          "automationEnabled": true,
          "providerType": "embedded",
          "clientType": "privy"
        }
      ]
    }
    ```
  </Accordion>

  <Accordion icon="paper-plane" title="發送資產（冪等）">
    在所有寫入端點提供 `Idempotency-Key: <uuid>`。

    ```bash theme={null}
    curl -s -X POST https://api.afkcrypto.com/v1/send \
      -H "x-api-key: $AFK_API_KEY" -H "Idempotency-Key: $(uuidgen)" \
      -H "Content-Type: application/json" \
      -d '{
        "chain":"base-sepolia",
        "asset":"erc20",
        "token":"0xToken",
        "to":"0xRecipient",
        "amount":"1000000000000000000"
      }'
    ```

    ```json theme={null}
    { "id": "tx_...", "status": "SUBMITTED", "hash": "0x...", "explorerUrl": "https://basescan.org/tx/0x...", "chainName": "Base" }
    ```
  </Accordion>

  <Accordion icon="bolt" title="與合約互動（EVM）">
    ```bash theme={null}
    curl -s -X POST https://api.afkcrypto.com/v1/contracts/send \
      -H "x-api-key: $AFK_API_KEY" -H "Idempotency-Key: $(uuidgen)" \
      -H "Content-Type: application/json" \
      -d '{
        "chain":"base-sepolia",
        "to":"0xContract",
        "data":"0xabcdef...",
        "value":"0"
      }'
    ```
  </Accordion>

  <Accordion icon="circle-nodes" title="發送 SPL 代幣（Solana）">
    ```bash theme={null}
    curl -s -X POST https://api.afkcrypto.com/v1/send \
      -H "x-api-key: $AFK_API_KEY" -H "Idempotency-Key: $(uuidgen)" \
      -H "Content-Type: application/json" \
      -d '{
        "chain":"solana-devnet",
        "asset":"spl",
        "token":"MintAddress",
        "to":"RecipientOwnerAddress",
        "amount":"1000000"
      }'
    ```
  </Accordion>

  <Accordion icon="receipt" title="查詢交易">
    ```bash theme={null}
    curl -s -H "x-api-key: $AFK_API_KEY" \
      "https://api.afkcrypto.com/v1/tx/tx_cuid_here"
    ```

    ```json theme={null}
    {
      "id":"tx_cuid_here",
      "status":"PENDING",
      "hash": null,
      "explorerUrl": null,
      "chainName":"Base",
      "chainType":"ethereum",
      "chainId":8453,
      "to":"0xrecipient...",
      "value":"1000000000000000",
      "error": null,
      "createdAt":"2025-08-25T08:00:00.000Z",
      "updatedAt":"2025-08-25T08:00:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## 下一步

繼續瀏覽核心端點：

<CardGroup cols={2}>
  <Card title="發送資產" icon="paper-plane" href="/api-reference/endpoint/send/">
    轉帳原生資產與代幣資產。
  </Card>

  <Card title="授權代幣" icon="key" href="/api-reference/endpoint/token-approve/">
    設定 ERC20 授權額度。
  </Card>

  <Card title="交易/兌換" icon="right-left" href="/api-reference/endpoint/trade-quote/">
    請求報價並執行兌換。
  </Card>

  <Card title="API 文件" icon="code" href="/api-reference/introduction/">
    瀏覽端點與約定。
  </Card>
</CardGroup>

<Note>
  **需要幫助？** 寄送郵件至 <a href="mailto:hello@afkcrypto.com">[hello@afkcrypto.com](mailto:hello@afkcrypto.com)</a>，或在 <a href="https://twitter.com/afkcryptoai">Twitter</a> 聯繫我們。
</Note>
