API & webhooks

Connect Barzaman to your own tools

A versioned REST API, HMAC-signed webhooks with retries, and the Barzaman mini-app inside your messengers.

Full OpenAPI 3.1 specification

The public API and webhooks are in the Pro and Business plans; the mini-app is for everyone.

Authentication

  • In the app: Settings › Bots & integrations › create a personal access token (read, or read + write).
  • Every request: Authorization: Bearer bzp_… — OAuth tokens of connected AI assistants work too.
  • Base URL: https://api.barzaman.ir/api/v1
  • Send an Idempotency-Key header to retry creates safely.
curl https://api.barzaman.ir/api/v1/items \
  -H "Authorization: Bearer bzp_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c…" \
  -d '{"text": "جلسه فردا ساعت ۱۰"}'

Limits

  • 120 requests per minute per token, 60 writes per minute.
  • X-RateLimit-Limit and X-RateLimit-Remaining headers; 429 with Retry-After when exceeded.
  • Up to 10 webhooks per account.

Finance items (cheques, loans, installments, debts, subscriptions) appear in the API and webhooks only if you allowed it; health, medical and private items are never shown in bots or the mini-app.

Main endpoints

Responses are JSON; errors are application/problem+json.

GET /api/v1/me Account, scopes, time zone
GET /api/v1/today Today's agenda and the overdue count
GET /api/v1/items?range=week Items in a range (today, tomorrow, week, overdue, custom)
GET /api/v1/items/search?q=… Search titles
POST /api/v1/items Create from free text or fields
POST /api/v1/items/{id}/complete Done / reopen
POST /api/v1/items/{id}/snooze Snooze the reminder
DELETE /api/v1/items/{id} Delete
GET · POST /api/v1/webhooks List and create webhooks
GET /api/v1/webhooks/{id}/deliveries Delivery log

Webhooks

Each event is a POST with a JSON body to your HTTPS URL: {id, type, createdAt, apiVersion, data}.

  • item.createdAn item was created
  • item.updatedAn item changed
  • item.completedAn item was completed
  • reminder.firedA reminder was sent by a bot or web push
  • booking.requestedA new request on your booking link

Headers

Barzaman-Event: item.completed
Barzaman-Delivery: <uuid>
Barzaman-Webhook-Id: <uuid>
Barzaman-Timestamp: 1763200000
Barzaman-Signature: t=1763200000,v1=<hex>

Verifying the signature

// Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';

function verify(secret, header, rawBody) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
  const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex');
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  return fresh && timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}

Answer 2xx within 10 seconds. Otherwise the delivery is retried after 1 min, 5 min, 30 min, 2 h, 6 h and 12 h (7 attempts). The event id stays the same across retries — use it to ignore duplicates. After 60 failed attempts in a row the webhook is switched off. The delivery log is kept for 30 days and any delivery can be sent again.

Mini-app for Telegram, Bale and Eitaa

Barzaman inside your messenger: today, quick add, list, complete, habits and prayer times.

  • Telegram and Bale: the "Barzaman" button next to the bot's message bar, or the /app command.
  • Eitaa: from the mini-app center or the Barzaman mini-app link.
  • If your bot account is already linked you are signed in automatically; otherwise enter an 8-digit code from the app once.