Docs/Getting Started/Quickstart

Bun

Use Repull with Bun — the fast JavaScript runtime.

1

Prerequisites

Bun runtime installed on your machine.

You also need a Repull API key. Get one from your dashboard.

2

Install

bun add @repull/sdk
3

Set up environment variables

Add your credentials to a .env file in your project root:

REPULL_API_KEY=sk_test_YOUR_KEY
REPULL_WORKSPACE_ID=YOUR_WORKSPACE_ID

Start with sk_test_ keys for sandbox data. Switch to sk_live_ when you are ready for production.

4

Make your first API call

Initialize the SDK with your API key, then call any endpoint. The example below lists properties and fetches reservations.

import { Repull } from '@repull/sdk'

const repull = new Repull({
  apiKey: Bun.env.REPULL_API_KEY!,
  workspaceId: Bun.env.REPULL_WORKSPACE_ID!,
})

const server = Bun.serve({
  port: 3000,
  async fetch(req) {
    const url = new URL(req.url)
    if (url.pathname === '/properties') {
      const { data } = await repull.properties.list()
      return Response.json(data)
    }
    if (url.pathname === '/sync') {
      const result = await repull.channels.syncAirbnb()
      return Response.json(result)
    }
    return new Response('Not Found', { status: 404 })
  },
})

console.log(`Listening on ${server.url}`)
AI