Fanbeam
Fanbeam
Documentation
API Reference
Getting Started
User Guides
TypeScript SDK
AuthenticationError HandlingInstallationQuick StartTypeScript Types
TypeScript SDK

Quick Start

Get started with the Fanbeam SDK in 5 minutes

Get started with the Fanbeam SDK in just a few minutes.

Step 1: Install the SDK

npm install fanbeam

Step 2: Configure the Client

import { client } from 'fanbeam';

client.setConfig({
  baseUrl: 'https://fanbeam.app/api',
  headers: {
    'X-API-Key': 'your-api-key-here'
  }
});

Step 3: Make Your First API Call

import { posts } from 'fanbeam';

// List posts
const response = await posts.list();

if (response.error) {
  console.error('Error:', response.error);
} else {
  console.log('Posts:', response.data);
}

Complete Example

import { posts, media, channels, client } from 'fanbeam';

// Configure client
client.setConfig({
  baseUrl: 'https://fanbeam.app/api',
  headers: {
    'X-API-Key': process.env.FANBEAM_API_KEY!
  }
});

async function main() {
  // List channels
  const channelsResponse = await channels.list();
  console.log('Channels:', channelsResponse.data);
  
  // List posts
  const postsResponse = await posts.list({
    query: { page: 1, limit: 10 }
  });
  console.log('Posts:', postsResponse.data);
  
  // Create a post
  const createResponse = await posts.create({
    body: {
      title: 'My First Post',
      body: 'Hello from the SDK!',
      channelIds: ['channel-id-1']
    }
  });
  console.log('Created post:', createResponse.data);
}

main().catch(console.error);

Next Steps

  • Authentication
  • Posts Examples
  • Media Examples
  • Error Handling

Installation

Install the Fanbeam TypeScript SDK

TypeScript Types

Understanding TypeScript types in the SDK

On this page

Step 1: Install the SDKStep 2: Configure the ClientStep 3: Make Your First API CallComplete ExampleNext Steps