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

# Quickstart Guide

> Make your first API call to XentFi and understand the core concepts

This guide will help you make your first API call to XentFi and understand the core concepts.

## Prerequisites

* A XentFi account ([Sign up](https://dashboard.xentfi.com))
* Basic understanding of REST APIs
* curl or a REST client (Postman, Insomnia, etc.)

## Step 1: Get Your API Credentials

<Steps>
  <Step title="Log into Dashboard">
    Navigate to [dashboard.xentfi.com](https://dashboard.xentfi.com) and log in with your credentials.
  </Step>

  <Step title="Navigate to API Keys">
    Go to **Settings** → **API Keys** from the left sidebar.
  </Step>

  <Step title="Generate New Key">
    Click **Generate New API Key**, give it a name like "Development", and select the environment.
  </Step>

  <Step title="Copy Credentials">
    Copy your `apiKey` and `orgId`. Store them securely - you won't see the API key again!
  </Step>
</Steps>

## Step 2: Set Up Environment Variables

Create a `.env` file or set environment variables:

```bash theme={null}
export XENTFI_API_KEY="your-api-key"
export XENTFI_ORG_ID="your-org-Id"
export XENTFI_BASE_URL="https://api.xentfi.com/v1"
```

## Step 3: Make Your First API Call

Let's list all your master wallets:

<CodeGroup>
  ```bash theme={null}
  curl -X GET https://api.xentfi.com/v1/master-wallets \
    -H "apiKey: $XENTFI_API_KEY" \
    -H "orgId: $XENTFI_ORG_ID"
  ```

  ```javascript theme={null}
  const response = await fetch('https://api.xentfi.com/v1/master-wallets', {
    headers: {
      'apiKey': process.env.XENTFI_API_KEY,
      'orgId': process.env.XENTFI_ORG_ID
    }
  });
  const data = await response.json();
  console.log(data);
  ```

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

  headers = {
      'apiKey': os.environ['XENTFI_API_KEY'],
      'orgId': os.environ['XENTFI_ORG_ID']
  }

  response = requests.get('https://api.xentfi.com/v1/master-wallets', headers=headers)
  print(response.json())
  ```
</CodeGroup>

<CodeGroup>
  ```json theme={null}
  {
      "data": {
          "items": [],
          "total": 0,
          "hasMore": false
      }
  }
  ```
</CodeGroup>

*If you haven't created any wallets yet, you'll get an empty list.*

## Step 4: Create Your First Master Wallet

<CodeGroup>
  ```bash theme={null}
  curl -X POST https://api.xentfi.com/v1/master-wallets \
    -H "apiKey: $XENTFI_API_KEY" \
    -H "orgId: $XENTFI_ORG_ID" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "My First Wallet",
      "blockchainId": "eth-sepolia",
      "description": "Development wallet on Sepolia testnet"
    }'
  ```

  ```javascript theme={null}
  const wallet = await fetch('https://api.xentfi.com/v1/master-wallets', {
    method: 'POST',
    headers: {
      'apiKey': process.env.XENTFI_API_KEY,
      'orgId': process.env.XENTFI_ORG_ID,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'My First Wallet',
      blockchainId: 'eth-sepolia',
      description: 'Development wallet on Sepolia testnet'
    })
  }).then(res => res.json());
  ```
</CodeGroup>

<CodeGroup>
  ```json theme={null}
  {
      =
      "data": {
          "id": "wallet_123e4567-e89b-12d3-a456-426614174000",
          "name": "My First Wallet",
          "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0",
          "blockchain": {
              "id": "eth-sepolia",
              "name": "Ethereum Sepolia",
              "chainId": 11155111
          },
          "description": "Development wallet on Sepolia testnet",
          "isActive": true,
          "createdAt": "2024-01-15T10:30:00.000Z"
      }
  }
  ```
</CodeGroup>

## Step 5: Create a Deposit Address

Now let's create a deposit address that customers can use to pay you:

<CodeGroup>
  ```bash theme={null}
  curl -X POST https://api.xentfi.com/v1/addresses \
    -H "apiKey: $XENTFI_API_KEY" \
    -H "orgId: $XENTFI_ORG_ID" \
    -H "Content-Type: application/json" \
    -d '{
      "masterId": "your-master-wallet-id",
      "name": "Customer Payment Address"
    }'
  ```
</CodeGroup>

<CodeGroup>
  ```json theme={null}
  {
      "data": {
          "id": "addr_123e4567-e89b-12d3-a456-426614174000",
          "name": "Customer Payment Address",
          "walletAddress": "0x8aBc123...",
          "masterWalletId": "your-master-wallet-id"
      }
  }
  ```
</CodeGroup>

## Step 6: Create a Payment Link

Generate a hosted payment page:

<CodeGroup>
  ```bash theme={null}
  curl -X POST https://api.xentfi.com/v1/payment/links \
    -H "apiKey: $XENTFI_API_KEY" \
    -H "orgId: $XENTFI_ORG_ID" \
    -H "Content-Type: application/json" \
    -d '{
      "masterId": "your-master-wallet-id",
      "name": "Product Purchase",
      "amount": "100",
      "currency": "USD",
      "redirectUrl": "https://yourapp.com/success"
    }'
  ```
</CodeGroup>

<CodeGroup>
  ```json theme={null}
  {
      "data": {
          "id": "link_123e4567-e89b-12d3-a456-426614174000",
          "name": "Product Purchase",
          "amount": "100",
          "currency": "USD",
          "url": "https://pay.xentfi.com/link_123e4567",
          "redirectUrl": "https://yourapp.com/success"
      }
  }
  ```
</CodeGroup>

## Step 7: Set Up a Webhook (Optional)

Receive real-time payment notifications:

<CodeGroup>
  ```bash theme={null}
  curl -X POST https://api.xentfi.com/v1/webhooks \
    -H "apiKey: $XENTFI_API_KEY" \
    -H "orgId: $XENTFI_ORG_ID" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://yourapp.com/webhooks/xentfi",
      "events": ["payment.completed", "payment.failed"],
      "secret": "your-webhook-secret"
    }'
  ```
</CodeGroup>

## Success! 🎉

You've successfully:

* ✅ Made your first API call
* ✅ Created a master wallet
* ✅ Generated a deposit address
* ✅ Created a payment link
* ✅ (Optional) Set up a webhook

## Common Error Handling

<AccordionGroup>
  <Accordion title="Invalid API Key (401)">
    ```json theme={null}
    {
        "error": {
            "code": "UNAUTHORIZED",
            "message": "Invalid API key"
        }
    }
    ```

    **Solution:** Verify your API key and App ID are correct.
  </Accordion>

  <Accordion title="Rate Limit Exceeded (429)">
    ```json theme={null}
    {
        "error": {
            "code": "RATE_LIMIT_EXCEEDED",
            "message": "Too many requests"
        }
    }
    ```

    **Solution:** Implement exponential backoff or upgrade your plan.
  </Accordion>

  <Accordion title="Validation Error (400)">
    ```json theme={null}
    {
        "error": {
            "code": "VALIDATION_ERROR",
            "message": "Missing required field: name"
        }
    }
    ```

    **Solution:** Check your request body for required fields.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Development Environment" icon="code" href="/development">
    Set up local development with testnets
  </Card>

  <Card title="Authentication Deep Dive" icon="key" href="/authentication">
    Learn about API security best practices
  </Card>

  <Card title="Explore Products" icon="package" href="/essentials/master-wallets">
    Discover all XentFi products
  </Card>

  <Card title="API Reference" icon="book-open" href="/api-reference">
    Browse complete API documentation
  </Card>
</CardGroup>
