ذِروة THURWA
Features What you save WhatsApp How it works Pricing Common questions
ع Log in Start free trial
Thurwa

Developers and API

Send leads into Thurwa from any form or tool, and build on the same API the Thurwa mobile app uses.

  1. Overview
  2. Lead webhook
  3. Mobile API: basics
  4. Signing in
  5. Errors and limits
  6. Account and notifications
  7. Dashboard and leads
  8. Stores, products and orders
  9. Marketing
  10. Support tickets
  11. Call center

Thurwa is in beta. These endpoints are stable, but new fields may be added to responses, so ignore fields you don't recognise.

1. Overview

Thurwa has two APIs:

  • The lead webhook: one secret address per company. Your website forms, email parsers, SMS and WhatsApp providers or call tracking send a request to it, and the person appears as a lead in Thurwa.
  • The mobile API: the API the Thurwa mobile app is built on. It signs in with a Thurwa account and reads the same data as the dashboard: leads, stores, products, orders, store tracking, marketing, notifications and support tickets.

Both live at https://thurwa.io, take and return JSON over HTTPS, and send dates in ISO 8601 with a time zone (e.g. 2026-11-08T09:30:00+00:00). Money is in the store's currency, as a number.

2. Lead webhook

POST/webhooks/leads/{token}

Your company's full address is in the dashboard under Leads → Lead sources, with a ready example. Anyone with the address can add leads, so keep it secret, and send from your server where you can. If it leaks, press Regenerate URL in the same window: the old address stops working at once.

Fields

Send JSON (Content-Type: application/json) or an ordinary form post. Either email or phone is required.

FieldDescription
sourceWhere the lead came from: website (default), email, sms, whatsapp, call or campaign.
nameUp to 255 characters.
emailA valid email address. Required when there's no phone.
phoneUp to 30 characters, ideally with the country code (+966501234567). Required when there's no email.
organization, cityUp to 255 characters each.
subject, messageWhat the person wrote (message up to 10,000 characters). Saved on the lead's timeline as an email, SMS, WhatsApp message, call or note, depending on the source.
refAn affiliate link code (the ?ref= the visitor arrived with), so the affiliate gets the credit.

Example

curl -X POST https://thurwa.io/webhooks/leads/YOUR_TOKEN \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "source": "whatsapp",
    "name": "Ahmed Ali",
    "phone": "+966501234567",
    "message": "I would like a quote"
  }'

Responses

People are matched by email or phone. A new person gets a new lead (201); someone you already have keeps the same lead, which gains any details it was missing (200). New leads alert your team and start your "new lead" workflows, like leads added in the dashboard.

HTTP/1.1 201 Created
{ "lead_id": 1834, "created": true }
StatusMeaning
200 / 201Saved to an existing lead / a new lead was created.
404The address is wrong or was regenerated.
422A field is invalid: { "errors": { "phone": ["…"] } }.
429More than 60 requests a minute from the same address. Wait and retry.

3. Mobile API: basics

Every path below starts with https://thurwa.io/api/mobile/v1. Send these headers:

Accept: application/json
Authorization: Bearer YOUR_TOKEN
Accept-Language: ar        # or en: messages and labels come back in this language
X-App-Build: 2             # the app's build number (the number after + in its version)

App updates

When a new version of the app is published, every older app must update before it can be used. Any call from a lower X-App-Build (or none) returns 426 with a message, the new version and a download_url. Two calls stay open to every version, without a token:

GET/app-version

The latest version: { "version": "1.1.0", "build": 2, "download_url": "…/app/download" } (all null until a version is published). Check it when the app opens.

GET/app/download

Downloads the latest Android app (APK).

Company data lives under /companies/{company}, where {company} is an id from the companies list you get at sign-in. You see what you'd see in the dashboard: only companies you belong to, and only the stores your role lets you see.

Lists and pages

Lists of leads, products, notifications, marketing and tickets come 20 at a time. Ask for more with ?page=2, and read meta.last_page to know when to stop:

{
  "data": [ … ],
  "links": { "first": "…?page=1", "last": "…?page=4", "prev": null, "next": "…?page=2" },
  "meta": { "current_page": 1, "last_page": 4, "per_page": 20, "total": 71 }
}

Labels

Statuses, sources and categories come as a label object, ready to show: value is stable for your code, label is in the requested language, and color is one of gray, info, success, warning, danger or primary.

"status": { "value": "qualified", "label": "Qualified", "color": "primary" }

4. Signing in

POST/login

Signs in with the same email and password as the dashboard and returns a token for this device. Allowed 10 times a minute.

// Request
{ "email": "[email protected]", "password": "••••••••", "device_name": "Sara's iPhone" }

// Response 200
{
  "token": "3f9c…",
  "user": {
    "id": 12, "name": "Sara", "email": "[email protected]", "locale": "ar",
    "companies": [ { "id": 4, "name": "Nora Boutique", "has_access": true } ]
  }
}

Wrong credentials return 422 with a message. The token doesn't expire; it lasts until you sign out or the account is removed. Store it securely (Keychain / Keystore).

5. Errors and limits

StatusMeaning
401No token, or it was signed out. Sign in again.
402The company's trial or subscription has ended. The body has a message and a billing_url to open.
404Not found, or it belongs to a company or store you can't see.
426The app is out of date. Update it from download_url (see App updates).
422Invalid input: { "message": "…", "errors": { "field": ["…"] } }.
429Over 240 requests a minute for one token. Wait and retry.

Every error has a message you can show as-is, in the language you asked for.

6. Account and notifications

GET/me

The signed-in user and their companies, in the same shape as at sign-in.

POST/logout

Ends this token. Other devices stay signed in.

POST/push-token

Saves this device's Firebase Cloud Messaging token so it gets push notifications: { "token": "fcm…" }. Send null to stop them.

GET/notifications

The same notifications as the dashboard's bell, newest first, paged, plus unread (the count). Each one:

{
  "id": "9b1e…",
  "category": "order",
  "title": "New order 1001",
  "body": "Sara ordered 2 items",
  "color": "success",
  "target": { "company_id": 4, "order_id": 552 },
  "url": "https://thurwa.io/dashboard/…",
  "read": false,
  "created_at": "2026-11-08T09:30:00+00:00"
}

category is one of lead, order, support, price_drop, store_activity, whatsapp or other. target holds the ids of what the notification is about (lead_id, order_id, product_id, store_id, ticket_id…), so you can open that screen. Push notifications carry category and the same ids in their data payload.

GET/notifications/{id}

One notification. Opening it marks it read.

GET/notifications/unread
POST/notifications/{id}/read
POST/notifications/read-all

The unread count, and marking one or all as read. All three return { "unread": 3 }.

GET/push-preferences
PUT/push-preferences

Which kinds of notification reach this person on the phone (data) and by email (email), as on the dashboard's Notification settings page. To change some, send only those: { "preferences": { "order": false }, "email": { "support": true } }. Both return the full settings.

{
  "data":  { "lead": true, "order": true, "support": true, "price_drop": true, "store_activity": true, "whatsapp": true, "other": true },
  "email": { "lead": true, "order": false, "support": false, "price_drop": true, "store_activity": false, "whatsapp": false, "other": false }
}

7. Dashboard and leads

GET/companies/{company}/dashboard

The dashboard's cards (each with total, today and month, in Saudi time), seven days of revenue, the 5 newest leads and the 5 best-selling products.

{
  "stats": {
    "revenue":  { "total": 182340.5, "today": 1290, "month": 24410 },
    "orders":   { "total": 3120, "today": 14, "month": 402 },
    "products": { "total": 860, "today": 3, "month": 41 },
    "leads":    { "total": 1834, "today": 6, "month": 129 },
    "open_tickets": 1
  },
  "revenue_chart": [ { "date": "2026-11-02", "value": 3010 }, … ],
  "recent_leads": [ /* leads */ ],
  "top_products": [ /* products */ ]
}
GET/companies/{company}/leads

Leads, newest first, paged. Filter with ?search= (name, email or phone) and ?status= (new, contacted, qualified, won or lost).

{
  "id": 1834, "name": "Ahmed Ali", "email": "[email protected]", "phone": "+966501234567",
  "city": "Riyadh", "organization": null,
  "status": { "value": "new", "label": "New", "color": "info" },
  "source": { "value": "whatsapp", "label": "WhatsApp", "color": "success" },
  /* "owner", "referred_by", "notes" and "interactions" are added on a single lead */
  "score": 40, "orders_count": 2, "total_spent": 640,
  "last_activity_at": "2026-11-08T09:30:00+00:00",
  "created_at": "2026-11-01T12:00:00+00:00"
}
GET/companies/{company}/leads/{lead}

One lead, with notes, owner (the salesperson's name), referred_by (the affiliate) and its 30 latest interactions: { id, type, subject, body, occurred_at }.

PATCH/companies/{company}/leads/{lead}/status

Moves the lead along the pipeline, like "Change status" in the dashboard: { "status": "contacted" }. Returns the updated lead.

8. Stores, products and orders

GET/companies/{company}/stores
GET/companies/{company}/stores/{store}

The stores you may see, by name: id, title, url, platform, logo_url, products_count, sales, income, is_connected (a connected Salla or Zid store), last_synced_at and sync_error. The list isn't paged.

GET/companies/{company}/products

Products from every store you see, best-selling first, paged. Narrow with ?store= (a store id) and ?search=; ?sort=newest shows the newest first.

{
  "id": 77, "name": "Oud perfume 100ml", "store": "Nora Boutique",
  "price": 189, "original_price": 230, "sales": 412, "income": 77868,
  "stock": 14, "is_available": true, "is_new": false,
  "thumbnail": "https://…", "url": "https://…"
}
GET/companies/{company}/products/{product}

One product, plus store_id, discovered_at, last_seen_at, sales_series (30 days of { date, orders, revenue }) and its 20 latest price_changes ({ old_price, new_price, is_drop, percent, changed_at }).

GET/companies/{company}/orders/{order}

One order from a connected store: reference, status, total, currency, placed_at, store, customer (the lead), items ({ name, quantity, price, image, product_id }), coupon_code, affiliate, came_from (the workflow or email campaign that brought it), channel and url.

GET/companies/{company}/tracking

Store tracking, like the dashboard's page. ?period= is day, week (default, 7 days) or month (30 days); ?store= narrows it to one store. The response has:

  • totals: orders and revenue, the same for the period before (previous_orders, previous_revenue), products sold, new products, price changes and drops, and products out of stock.
  • series: { label, date, orders, revenue } per hour for day, per day otherwise.
  • stores (each store's share), top_products (with gained_quantity and gained_revenue), new_products and price_changes.

9. Marketing

All three are paged, newest first.

GET/companies/{company}/landing-pages

id, title, status, url (published pages only), views, leads, conversion_rate and updated_at.

GET/companies/{company}/email-campaigns

id, name, subject, status, stats (recipients, sent, failed, opened, clicked, unsubscribed, open_rate, click_rate), scheduled_at, sent_at and created_at.

GET/companies/{company}/social-posts

id, body, status, targets (each account with its platform, status and the post's url), media_count, scheduled_at, published_at and created_at.

10. Support tickets

Your company's conversations with the Thurwa team.

GET/support/categories

The categories to choose from: { "data": [ { "value": "question", "label": "Question" }, … ] }. The values are question, problem, billing and feature_request.

GET/companies/{company}/support-tickets

Tickets, most recently updated first, paged: id, number, subject, status, category, priority, last_reply_at and created_at.

GET/companies/{company}/support-tickets/{ticket}

One ticket with its messages: { id, author, is_staff, is_mine, body, created_at }.

POST/companies/{company}/support-tickets

Opens a ticket: { "subject": "…", "category": "problem", "message": "…" }. Returns the ticket with 201.

POST/companies/{company}/support-tickets/{ticket}/replies

Replies on a ticket: { "message": "…" } (up to 10,000 characters). Returns the ticket with 201.

11. Call center

For companies with a phone line connected under Channels → Call center line. Calls themselves run through Twilio's Voice SDK with the token below; the line's number shows as the caller ID on calls you place.

GET/companies/{company}/call-center

enabled (the company has a connected line), name, phone_number, rings_mobile (calls can wake the app), takes_calls (this person's phone rings for the company's calls), identity (the Twilio client identity) and missed_waiting (missed calls nobody called back).

POST/companies/{company}/call-center/token

A Twilio Voice access token for this person, valid for an hour: { "data": { "token", "identity", "expires_at" } }. Ask for a new one before it expires. 404 when the company has no connected line.

PUT/companies/{company}/call-center/availability

Turns this person's phone on or off for incoming calls: { "takes_calls": true }. Returns { "data": { "takes_calls" } }; 422 when the line cannot ring the app yet.

GET/companies/{company}/calls

Calls, newest first, paged. Optional filter: all, missed (not called back yet), incoming or outgoing. Each call: id, direction (inbound or outbound), status, name, number, lead_id, team_member, menu_choice, duration (seconds), has_recording, recording_url, needs_call_back, called_back_at and started_at.

POST/companies/{company}/calls/{call}/called-back

Marks a missed call as called back. Returns the call.

GET/companies/{company}/calls/{call}/recording

The recording or voicemail as MP3 (audio/mpeg), sent with the same Authorization header.

Questions about the API? Open a support ticket from the dashboard, or write to info@thurwa.io.

ذِروة THURWA

One platform to track your stores, run your ads, talk to customers and publish everywhere.

About Thurwa

Features What you save Pricing WhatsApp How it works

Get started

Start free trial Log in

Help

Common questions Privacy policy Developers and API العربية
© 2026 Thurwa. All rights reserved. Made for stores in Saudi Arabia and the Gulf.