Docs/Documentation/Connect framework

FastAPI

Build a vacation rental API with FastAPI + Repull.

1

Prerequisites

Python 3.8+ installed on your machine.

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

2

Install

pip install repull-sdk fastapi uvicorn
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

Set up the client with your API key, then call any endpoint. The example below lists properties and fetches reservations.

import os, httpx
from fastapi import FastAPI

app = FastAPI()
API_KEY = os.environ['REPULL_API_KEY']
BASE = 'https://api.repull.dev'
HEADERS = {'Authorization': f'Bearer {API_KEY}'}

@app.get('/properties')
async def properties():
    async with httpx.AsyncClient() as client:
        r = await client.get(f'{BASE}/v1/properties', headers=HEADERS)
        return r.json()

@app.get('/reservations')
async def reservations(platform: str = None):
    params = {}
    if platform: params['platform'] = platform
    async with httpx.AsyncClient() as client:
        r = await client.get(f'{BASE}/v1/reservations', headers=HEADERS, params=params)
        return r.json()
AI