Express
Build a reservation sync API with Express + Repull.
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 express
3
Set up environment variables
Add your credentials to a .env file in your project root:
REPULL_API_KEY=sk_live_YOUR_KEY
There is one key type — sk_live_ — created from /dashboard/keys. It acts on whatever channels your workspace has connected.
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.
const express = require('express')
const { Repull } = require('@repull/sdk')
const app = express()
const repull = new Repull({
apiKey: process.env.REPULL_API_KEY,
})
// List properties
app.get('/properties', async (req, res) => {
const result = await repull.properties.list()
res.json(result.data)
})
// Get Airbnb reservations
app.get('/reservations/airbnb', async (req, res) => {
const result = await repull.reservations.list({ platform: 'airbnb' })
res.json(result.data)
})
// Update availability — body: { dates: [...], available?, price?, minNights?, maxNights? }.
// Writes the Repull calendar and pushes to every connected channel. The SDK
// has no availability method, so call the endpoint directly.
app.put('/availability/:propertyId', express.json(), async (req, res) => {
const response = await fetch(
`https://api.repull.dev/v1/availability/{propertyId}`.replace('{propertyId}', encodeURIComponent(req.params.propertyId)),
{
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.REPULL_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(req.body),
},
)
res.status(response.status).json(await response.json())
})
// Webhook handler — verify X-Repull-Signature first (see /docs/verify-webhook-signatures)
app.post('/webhooks/repull', express.raw({ type: 'application/json' }), (req, res) => {
const { type, data } = JSON.parse(req.body.toString('utf8'))
console.log(`Event: ${type}, Record: ${data.id}`)
res.sendStatus(200)
})
app.listen(3000, () => console.log('Running on :3000'))5
Next steps
You are all set. Explore the rest of the platform:
AI