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

# Quickstart

> Get started with Rise B2B API in minutes

Welcome to Rise B2B API! This guide will help you integrate with our blockchain-based global payroll platform in minutes.

<CardGroup cols={2}>
  <Card title="Fast Setup" icon="bolt">
    Configure authentication and execute your first API call in under 5 minutes
  </Card>

  <Card title="Secure by Default" icon="shield">
    Built on blockchain with SIWE authentication and EIP-712 signing
  </Card>

  <Card title="Global Reach" icon="globe">
    Support for 190+ countries and 90+ local currencies
  </Card>

  <Card title="Crypto Ready" icon="bitcoin">
    Process payments in 100+ cryptocurrencies and stablecoins
  </Card>
</CardGroup>

## Prerequisites

<Warning>
  **Request API access first, and do it per environment.** The B2B API is off by default. Contact Rise support to enable your company for the environment you'll call, and note that staging and production are enabled separately, so a request for one does not cover the other. Reach support through your dedicated Slack channel, the in-app chat, or [hello@riseworks.io](mailto:hello@riseworks.io). The full checklist, including authorizing your wallet, is in [Getting API Access](/authentication/api-access).
</Warning>

Before beginning your integration, ensure you have:

* **A Rise account** with a RiseID (get one at [app.riseworks.io](https://app.riseworks.io/))
* **Node.js** installed (version 16 or higher)
* **Basic knowledge** of JavaScript/TypeScript

<Note>
  **New to blockchain?** No concerns! You can use a private key from your wallet to authenticate with Rise, or use a JWT token. A private key functions as a digital signature that verifies wallet ownership, which connects to your Rise account. Learn more about [how wallets work](/concepts/wallets) and [authentication methods](/authentication).
</Note>

## Step 1: Configure Your Environment

First, create a new project and install the Rise SDK:

```bash theme={null}
mkdir rise-b2b-integration
cd rise-b2b-integration
npm init -y
npm install @riseworks/riseworks-sdk dotenv
# Or: yarn add @riseworks/riseworks-sdk dotenv
# Or: pnpm add @riseworks/riseworks-sdk dotenv
```

Create a `.env` file for your configuration:

```bash theme={null}
# Environment (optional - defaults to 'prod')
RISE_ENVIRONMENT=prod  # or 'stg' for staging

# Your personal (user) RiseID — a 42-char 0x address, not a co-/te- nanoid
RISE_ID=0xYourUserRiseIdHere
WALLET_PRIVATE_KEY=0xYourPrivateKeyHere

# Alternative: JWT token (if you have one)
# JWT_TOKEN=your_jwt_token_here
```

<Note>
  **Need help with authentication?** Review our [Private Keys Guide](/authentication/private-keys) for step-by-step instructions on how to retrieve your private key from MetaMask, hardware wallets, or generate a new one. You can also learn about [how wallets work](/concepts/wallets) and [authentication methods](/authentication).
</Note>

<Warning>
  **Security Note**: Never commit your `.env` file to version control. Your private key gives full access to your wallet. Store it securely and use environment variables in production.
</Warning>

## Step 2: Initialize the Rise SDK

Create your first integration script:

```javascript theme={null}
// quickstart.js
require('dotenv').config();
const { RiseApiClient } = require('@riseworks/riseworks-sdk');

// Initialize the Rise API client with your credentials
const client = new RiseApiClient({
  environment: process.env.RISE_ENVIRONMENT || 'prod',
  riseIdAuth: {
    riseId: process.env.RISE_ID,
    privateKey: process.env.WALLET_PRIVATE_KEY
  }
});

// Alternative: Initialize with JWT token
// const client = new RiseApiClient({
//   environment: process.env.RISE_ENVIRONMENT || 'prod',
//   jwtToken: process.env.JWT_TOKEN
// });

async function main() {
  try {
    console.log('🚀 Starting Rise B2B API integration...\n');

    // The SDK automatically handles authentication
    console.log('Authenticating with Rise...');
    
    // Retrieve current user information
    const user = await client.me.get();
    console.log('User authenticated:', user.data.name);
    console.log('User Rise ID:', user.data.riseid);

    // Retrieve user's companies
    console.log('\n📊 Fetching user companies...');
    const companies = await client.user.getCompanies();
    console.log('Companies:', companies.data.companies.length);

    // Retrieve user's teams
    console.log('\n👥 Fetching user teams...');
    const teams = await client.user.getTeams();
    console.log('Teams:', teams.data.teams.length);

    // Get entity balance (replace with actual nanoid)
    if (companies.data.companies.length > 0) {
      const companyNanoid = companies.data.companies[0].nanoid;
      console.log(`\n💰 Fetching balance for company: ${companyNanoid}`);
      
      const balance = await client.entityBalance.get({
        nanoid: companyNanoid
      });
      console.log('Balance:', balance.data);
    }

    console.log('\n🎉 Integration test completed successfully!');

  } catch (error) {
    console.error('\n💥 Integration test failed:', error.message);
    process.exit(1);
  }
}

main();
```

## Step 3: Execute Your Integration

Execute your integration:

```bash theme={null}
node quickstart.js
```

## Step 4: Advanced SDK Usage

Here are additional examples using the Rise SDK:

```javascript theme={null}
// advanced-examples.js
require('dotenv').config();
const { RiseApiClient } = require('@riseworks/riseworks-sdk');

const client = new RiseApiClient({
  riseIdAuth: {
    riseId: process.env.RISE_ID,
    privateKey: process.env.WALLET_PRIVATE_KEY
  }
});

async function advancedExamples() {
  try {
    // 1. Execute a payment using the SDK
    console.log('💳 Processing payment...');
    const payment = await client.payments.sendPayment({
      team_nanoid: 'your_team_nanoid',
      payments: [
        {
          recipient_nanoid: 'recipient_nanoid',
          amount: '100.00',
          currency: 'USD',
          description: 'Test payment via SDK'
        }
      ]
      // SDK automatically handles secure signing
    });
    console.log('Payment sent:', payment.data);

    // 2. Execute team invites
    console.log('\n📧 Sending team invites...');
    const invites = await client.invites.send({
      team_nanoid: 'your_team_nanoid',
      invites: [
        {
          email: 'team@example.com',
          role: 'employee'
        }
      ]
    });
    console.log('Invites sent:', invites.data);

    // 3. Execute manager invite with automatic signing
    console.log('\n👨‍💼 Sending manager invite...');
    const managerInvite = await client.invites.sendManagerInvite({
      team_nanoid: 'your_team_nanoid',
      invites: [
        {
          email: 'manager@example.com',
          role: 'finance'
        }
      ]
      // SDK automatically handles secure signing
    });
    console.log('Manager invite sent:', managerInvite.data);

    // 4. Execute withdrawal
    console.log('\n💸 Processing withdrawal...');
    const withdrawal = await client.withdraw.sendWithdraw(
      { account_nanoid: 'your_account_nanoid' },
      {
        amount: '50.00',
        currency: 'USD',
        destination: 'bank_account'
      }
      // SDK automatically handles secure signing
    );
    console.log('Withdrawal processed:', withdrawal.data);

  } catch (error) {
    console.error('Error in advanced examples:', error.message);
  }
}

advancedExamples();
```

## Step 5: SDK Configuration

The SDK automatically uses production environment by default, but you can specify staging for testing:

```javascript theme={null}
// Production (default)
const prodClient = new RiseApiClient({
  riseIdAuth: {
    riseId: process.env.RISE_ID,
    privateKey: process.env.WALLET_PRIVATE_KEY
  }
});

// Staging (for testing)
const stagingClient = new RiseApiClient({
  environment: 'stg',
  riseIdAuth: {
    riseId: process.env.RISE_ID,
    privateKey: process.env.WALLET_PRIVATE_KEY
  }
});

// With JWT token (if you have one)
const jwtClient = new RiseApiClient({
  jwtToken: process.env.JWT_TOKEN
});

// Staging with JWT token
const stagingJwtClient = new RiseApiClient({
  environment: 'stg',
  jwtToken: process.env.JWT_TOKEN
});
```

## Step 6: Error Handling

The SDK provides comprehensive error handling:

```javascript theme={null}
// error-handling.js
const { RiseApiClient } = require('@riseworks/riseworks-sdk');

const client = new RiseApiClient({
  environment: process.env.RISE_ENVIRONMENT || 'prod',
  riseIdAuth: {
    riseId: process.env.RISE_ID,
    privateKey: process.env.WALLET_PRIVATE_KEY
  }
});

async function handleErrors() {
  try {
    // SDK automatically handles authentication errors
    const user = await client.me.get();
    console.log('User:', user.data);

  } catch (error) {
    if (error.message.includes('401')) {
      console.error('Authentication failed - verify your Rise ID and private key');
    } else if (error.message.includes('403')) {
      console.error('Permission denied - verify your role permissions');
    } else if (error.message.includes('404')) {
      console.error('Resource not found - verify the nanoid');
    } else {
      console.error('API Error:', error.message);
    }
  }
}

handleErrors();
```

## Next Steps

Now that you have basic SDK integration configured, explore these features:

<CardGroup cols={2}>
  <Card title="SDK Setup" icon="download" href="/sdk/installation">
    Install and configure the Rise SDK
  </Card>

  <Card title="Core Concepts" icon="book" href="/concepts/riseid">
    Learn about RiseID, teams, roles, and entity management
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference">
    Complete API documentation with all endpoints
  </Card>

  <Card title="Webhooks" icon="webhook" href="/webhooks/getting-started">
    Set up webhook endpoints for real-time notifications
  </Card>

  <Card title="Payment Processing" icon="credit-card" href="/guides/payment-integration">
    Learn how to process payments securely
  </Card>

  <Card title="Authentication Guide" icon="key" href="/authentication">
    Learn about different authentication methods
  </Card>

  <Card title="Team Management" icon="users" href="/guides/team-management">
    Create teams and manage members with role-based access
  </Card>

  <Card title="Error Handling" icon="triangle-exclamation" href="/guides/error-handling">
    Comprehensive error handling and debugging guide
  </Card>
</CardGroup>

<Note>
  **Production Ready?** The SDK automatically uses production environment by default. For testing, use `environment: 'stg'` to connect to staging. Implement comprehensive error handling before going live. The SDK automatically handles authentication and secure signing for you.
</Note>
