Cloudflare Workers
Use Repull from Cloudflare Workers at the edge.
1
Prerequisites
Node.js 18+ installed on your machine.
You also need a Repull API key. Get one from your dashboard.
2
Install
npm install @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'
export default {
async fetch(request, env) {
const repull = new Repull({
apiKey: env.REPULL_API_KEY,
workspaceId: env.REPULL_WORKSPACE_ID,
})
const { data } = await repull.reservations.list({
platform: 'airbnb',
status: 'confirmed',
})
return new Response(JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
})
},
}5
Next steps
You are all set. Explore the rest of the platform:
AI