Skip to content

Direct API Access

AvailEngine is a REST API. Use any HTTP client to call it.

cURL

bash
# Check availability
curl "https://api.availengine.com/v1/availability/{business_id}?date=2026-06-15" \
  -H "Authorization: Bearer avail_live_YOUR_KEY"

# Create a booking
curl -X POST https://api.availengine.com/v1/bookings/ \
  -H "Authorization: Bearer avail_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "business_id": "...",
    "booking_date": "2026-06-15",
    "start_time": "10:00",
    "capacity": 1,
    "first_name": "Jane",
    "last_name": "Doe",
    "email": "jane@example.com",
    "phone": "+301234567890"
  }'

JavaScript (fetch)

js
const API = 'https://api.availengine.com'
const KEY = 'avail_live_YOUR_KEY'

// Check availability
const slots = await fetch(
  `${API}/v1/availability/${businessId}?date=2026-06-15&capacity=2`,
  { headers: { Authorization: `Bearer ${KEY}` } }
).then(r => r.json())

// Create a booking
const booking = await fetch(`${API}/v1/bookings/`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    business_id: businessId,
    booking_date: '2026-06-15',
    start_time: '10:00',
    capacity: 1,
    first_name: 'Jane',
    last_name: 'Doe',
    email: 'jane@example.com',
    phone: '+301234567890',
  }),
}).then(r => {
  if (!r.ok) throw new Error((await r.json()).error?.message)
  return r.json()
})

Python (httpx)

python
import httpx
from uuid import uuid4

API = "https://api.availengine.com"
KEY = "avail_live_YOUR_KEY"

# Check availability
slots = httpx.get(
    f"{API}/v1/availability/{business_id}",
    params={"date": "2026-06-15", "capacity": 2},
    headers={"Authorization": f"Bearer {KEY}"},
).json()

# Create a booking
booking = httpx.post(
    f"{API}/v1/bookings/",
    json={
        "business_id": business_id,
        "booking_date": "2026-06-15",
        "start_time": "10:00",
        "capacity": 1,
        "first_name": "Jane",
        "last_name": "Doe",
        "email": "jane@example.com",
        "phone": "+301234567890",
    },
    headers={
        "Authorization": f"Bearer {KEY}",
        "Idempotency-Key": str(uuid4()),
    },
).json()

Webhook Verification

Verify that incoming webhooks were sent by AvailEngine:

js
import crypto from 'crypto'

function verify(payload, signature, secret) {
  const hash = crypto.createHmac('sha256', secret).update(payload).digest('hex')
  return crypto.timingSafeEqual(Buffer.from(hash), Buffer.from(signature))
}
python
import hmac, hashlib

def verify(payload: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), payload, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)

Error Handling

All errors return { "error": { "code": "...", "message": "..." } }. Common codes:

HTTPCodeMeaning
401invalid_tokenMissing or invalid auth
402payment_requiredSubscription past due
403insufficient_permissionsWrong role
404not_foundResource doesn't exist
409conflictDuplicate or state conflict
429rate_limit_exceededToo many requests — check Retry-After header

Full API reference →

Released under the MIT License.