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

# StateSet Commerce Network API

> Enterprise blockchain infrastructure for instant global commerce with native stablecoins

<Info>
  **New to StateSet?** Start with our [Quick Start Guide](#quick-start) to make your first API call in under 5 minutes.
</Info>

# StateSet Commerce Network: The Operating System for Global Commerce

## 🚀 Why StateSet?

StateSet Commerce Network is the blockchain infrastructure that makes global commerce instant, programmable, and accessible. We're building the financial rails for the \$100+ trillion global economy.

<CardGroup cols={3}>
  <Card title="Instant Settlement" icon="bolt">
    Sub-second transaction finality with 10,000+ TPS capacity
  </Card>

  <Card title="Native Stablecoins" icon="dollar-sign">
    ssUSD and USDC built-in, no bridging or wrapping needed
  </Card>

  <Card title="Enterprise Ready" icon="building">
    SOC2 Type II compliant with built-in KYC/AML and audit trails
  </Card>
</CardGroup>

## 📊 By the Numbers

<CardGroup cols={4}>
  <Card>
    <h3>\$5B+</h3>
    <p>Total Value Processed</p>
  </Card>

  <Card>
    <h3>\< 1 sec</h3>
    <p>Transaction Finality</p>
  </Card>

  <Card>
    <h3>\$0.01</h3>
    <p>Average Transaction Cost</p>
  </Card>

  <Card>
    <h3>99.99%</h3>
    <p>Network Uptime</p>
  </Card>
</CardGroup>

## 🏗️ What Can You Build?

<Tabs>
  <Tab title="E-Commerce">
    ### Global Payment Processing

    * Accept stablecoins from customers worldwide
    * Instant settlement to your account
    * Automated currency conversion
    * Built-in fraud protection

    ```javascript theme={null}
    // Accept payment in 3 lines
    const payment = await stateset.payments.create({
      amount: 100.00,
      currency: 'ssusd',
      customer: 'cust_123'
    });
    ```
  </Tab>

  <Tab title="DeFi">
    ### Decentralized Finance

    * Liquidity pools with automated market making
    * Yield farming and staking rewards
    * Collateralized lending protocols
    * Synthetic asset creation

    ```javascript theme={null}
    // Create a liquidity pool
    const pool = await stateset.pools.create({
      tokenA: 'ssusd',
      tokenB: 'atom',
      initialLiquidity: 10000
    });
    ```
  </Tab>

  <Tab title="Trade Finance">
    ### Supply Chain Finance

    * Invoice factoring with instant funding
    * Purchase order financing
    * Letter of credit automation
    * Real-time settlement

    ```javascript theme={null}
    // Factor an invoice
    const factoring = await stateset.invoices.factor({
      invoiceId: 'inv_123',
      discount: 2.5,
      immediate: true
    });
    ```
  </Tab>

  <Tab title="AI Agents">
    ### Autonomous Commerce

    * Deploy AI agents with spending limits
    * Automated procurement and payments
    * Smart contract execution
    * Multi-signature controls

    ```javascript theme={null}
    // Deploy an AI agent
    const agent = await stateset.agents.create({
      name: 'ProcurementBot',
      spendingLimit: 10000,
      permissions: ['purchase', 'negotiate']
    });
    ```
  </Tab>
</Tabs>

## 🚀 Quick Start

Get up and running with StateSet in minutes:

<Steps>
  <Step title="Install the SDK">
    Choose your preferred language:

    <CodeGroup>
      ```bash npm theme={null}
      npm install @stateset/sdk
      ```

      ```bash yarn theme={null}
      yarn add @stateset/sdk
      ```

      ```bash pip theme={null}
      pip install stateset
      ```

      ```bash go theme={null}
      go get github.com/stateset/stateset-go
      ```
    </CodeGroup>
  </Step>

  <Step title="Get Your API Keys">
    1. Sign up at [dashboard.stateset.com](https://dashboard.stateset.com)
    2. Complete KYC verification (takes \< 5 minutes)
    3. Generate your API keys

    <Warning>
      Keep your secret key secure and never expose it in client-side code!
    </Warning>
  </Step>

  <Step title="Make Your First API Call">
    ```javascript theme={null}
    import { StateSet } from '@stateset/sdk';

    // Initialize the client
    const stateset = new StateSet({
      apiKey: 'sk_test_...'
    });

    // Check your balance
    const balance = await stateset.account.balance();
    console.log(`Balance: ${balance.ssusd} ssUSD`);

    // Send a payment
    const payment = await stateset.payments.send({
      to: 'stateset1abc...',
      amount: 100.00,
      currency: 'ssusd',
      memo: 'First payment!'
    });
    ```
  </Step>
</Steps>

## 📚 Core APIs

<CardGroup cols={2}>
  <Card title="Stablecoin APIs" icon="coins" href="/stablecoin/overview">
    Issue, redeem, and transfer ssUSD with full GENIUS Act compliance
  </Card>

  <Card title="Payments API" icon="credit-card" href="/payments/overview">
    Process payments, handle refunds, and manage payment methods
  </Card>

  <Card title="Orders API" icon="shopping-cart" href="/orders/overview">
    Create and manage e-commerce orders with automated fulfillment
  </Card>

  <Card title="Invoices API" icon="file-invoice" href="/invoices/overview">
    Generate, send, and collect on invoices with instant settlement
  </Card>

  <Card title="Finance API" icon="chart-line" href="/finance">
    Access trade finance, factoring, and lending protocols
  </Card>

  <Card title="Agents API" icon="robot" href="/agents">
    Deploy and manage autonomous AI agents for commerce
  </Card>
</CardGroup>

## 🔐 Authentication

All API requests require authentication using API keys:

```bash theme={null}
curl https://api.stateset.com/v1/account/balance \
  -H "Authorization: Bearer sk_test_..."
```

<Info>
  Use test mode keys (prefixed with `sk_test_`) for development and live mode keys (prefixed with `sk_live_`) for production.
</Info>

## 🌐 Network Architecture

<Tabs>
  <Tab title="Mainnet">
    ### Production Network

    * **Chain ID**: `stateset-1`
    * **RPC**: `https://rpc.stateset.com`
    * **API**: `https://api.stateset.com`
    * **Explorer**: `https://explorer.stateset.com`
    * **Status**: [status.stateset.com](https://status.stateset.com)
  </Tab>

  <Tab title="Testnet">
    ### Test Network

    * **Chain ID**: `stateset-testnet-1`
    * **RPC**: `https://rpc-testnet.stateset.com`
    * **API**: `https://api-testnet.stateset.com`
    * **Explorer**: `https://explorer-testnet.stateset.com`
    * **Faucet**: [faucet.stateset.com](https://faucet.stateset.com)
  </Tab>
</Tabs>

## 💡 Best Practices

<AccordionGroup>
  <Accordion title="Security">
    * Never expose API keys in client-side code
    * Use webhook signatures to verify events
    * Implement idempotency keys for critical operations
    * Enable 2FA on your dashboard account
  </Accordion>

  <Accordion title="Performance">
    * Use pagination for large result sets
    * Implement exponential backoff for retries
    * Cache frequently accessed data
    * Use webhooks instead of polling
  </Accordion>

  <Accordion title="Error Handling">
    * Always check the `error` field in responses
    * Log all errors with request IDs for debugging
    * Implement proper retry logic for transient errors
    * Monitor your rate limits
  </Accordion>
</AccordionGroup>

## 🆘 Need Help?

<CardGroup cols={3}>
  <Card title="Documentation" icon="book" href="/docs">
    Comprehensive guides and API references
  </Card>

  <Card title="Discord Community" icon="discord" href="https://discord.gg/stateset">
    Chat with developers and get instant help
  </Card>

  <Card title="Enterprise Support" icon="headset" href="mailto:support@stateset.com">
    Priority support for enterprise customers
  </Card>
</CardGroup>

## 🚀 Ready to Build?

<Card title="Get Started Now" icon="rocket" href="https://dashboard.stateset.com/sign-up">
  Sign up for a free account and get \$100 in test credits
</Card>
