API v1 রেফারেন্স
REST API-র প্রতিটি এন্ডপয়েন্ট তার মেথড, পাথ ও প্রয়োজনীয় স্কোপসহ, API যে OpenAPI ডকুমেন্ট দেয় সেখান থেকেই তৈরি।
GET https://<workspace>.zmle.com/api/v1/me
দ্রুত শুরু
- একটি তাৎক্ষণিক ডেমো খুলুন: নমুনা ডেটাসহ একটি ওয়ার্কস্পেস
- ডেমোতে Admin → Integrations & API-তে গিয়ে একটি কী তৈরি করুন
- কী দিয়ে GET /api/v1/me কল করুন (নিচে) — দেখবেন কী-টি কোন ওয়ার্কস্পেস আর কোন মানুষের
- একটি ওয়েবহুক এন্ডপয়েন্ট যোগ করে ইভেন্ট বেছে নিন; ডেমোতে ডেলিভারি লগে থাকে কিন্তু পাঠানো হয় না
OpenAPI ডকুমেন্ট
পুরো স্পেসিফিকেশন পাবলিক; পড়তে কোনো কী লাগে না: https://zmle.com/api/v1/openapi.json
curl https://<your-demo>.zmle.com/api/v1/me \ -H "Authorization: Bearer $ZMLE_API_KEY"
মূল ঠিকানা
প্রতিটি ওয়ার্কস্পেস নিজের ঠিকানায় উত্তর দেয়: https://<workspace>.zmle.com/api/v1 (বা নিজের ডোমেইন)। API হোস্ট https://api.zmle.com/v1 কী থেকে ওয়ার্কস্পেস খুঁজে নেয়।
অথেন্টিকেশন
কী পাঠান Authorization: Bearer <key> (বা X-Api-Key) হিসেবে। নেটিভ ও সংযুক্ত অ্যাপ PKCE সহ OAuth 2.1 আর স্বল্পমেয়াদি অ্যাপ টোকেন ব্যবহার করে।
তালিকা ও পেজিং
তালিকা page ও per (১–১০০, ডিফল্ট ২৫), খোঁজার জন্য q আর একটি তারিখের পরের পরিবর্তনের জন্য since নেয়। উত্তরে total ও pages থাকে, সাথে Link ও X-Total-Count হেডার।
ত্রুটি
ত্রুটি JSON-এ আসে: { error: { code, message } } HTTP স্ট্যাটাসসহ। প্রতিটি উত্তরে X-Request-Id থাকে। POST অনুরোধ Idempotency-Key হেডার নেয়। প্রতিটি কী-র 300টি অনুরোধের একটি বাকেট আছে, প্রতি সেকেন্ডে 5টি করে ভরে; X-RateLimit-Remaining বাকি দেখায়, আর 429 আসে Retry-After সহ।
ভার্সন ও ডিপ্রিকেশন
v1 শুধু বাড়ে: নতুন রুট ও ফিল্ড যোগ হয়, v1-এর ভেতরে কিছু মুছে ফেলা বা নাম বদলানো হয় না। যে রুট উঠে যাবে, বন্ধ হওয়ার অন্তত 12 মাস আগে সেটিকে deprecated চিহ্নিত করা হয়; ততদিন সেটি আগের মতোই চলে এবং Deprecation ও Sunset হেডার পাঠায়।
TypeScript ক্লায়েন্ট
OpenAPI ডকুমেন্ট থেকে তৈরি একটি অফিশিয়াল TypeScript ক্লায়েন্ট প্রস্তুত হচ্ছে (টাইপড মেথড, Retry-After মেনে রিট্রাই, idempotency key, পেজিং)। প্রকাশিত হওয়া পর্যন্ত যেকোনো OpenAPI জেনারেটর openapi.json দিয়ে কাজ করে।
এরর কোড
| স্ট্যাটাস | কোড | মানে |
|---|---|---|
400 | invalid_json | বডি বৈধ JSON নয় |
401 | unauthenticated | কোনো কী বা টোকেন পাঠানো হয়নি |
401 | invalid_key | কী অজানা, বাতিল বা মেয়াদোত্তীর্ণ, অথবা REST API-তে MCP টোকেন ব্যবহার করা হয়েছে |
401 | token_expired | অ্যাপ টোকেনের মেয়াদ শেষ: রিফ্রেশ করুন |
403 | insufficient_scope | এই রুটের জন্য দরকারি স্কোপ কী-তে নেই |
403 | forbidden | কী-এর মানুষটি এই অংশ বা রেকর্ড খুলতে পারেন না |
403 | origin_not_allowed | এমন সাইট থেকে ব্রাউজার কল, যা ওয়ার্কস্পেসের অনুমোদিত অরিজিনে নেই |
403 | ip_not_allowed | কী-এর অনুমোদিত IP তালিকায় এই ঠিকানা নেই |
403 | test_mode_read_only | একটি টেস্ট কী ডেটা বদলাতে চেয়েছে: টেস্ট কী শুধু পড়তে পারে |
404 | not_found | এই ওয়ার্কস্পেসে এমন রেকর্ড বা রুট নেই |
409 | conflict | রিকোয়েস্ট বর্তমান অবস্থার সাথে সাংঘর্ষিক, যেমন ডুপ্লিকেট |
422 | validation_failed | ফিল্ড যাচাইয়ে ব্যর্থ; উত্তরে প্রতিটি ফিল্ডের সমস্যা লেখা থাকে |
429 | rate_limited | অনেক বেশি রিকোয়েস্ট: Retry-After-এ লেখা সেকেন্ড অপেক্ষা করুন |
500 | internal_error | আমাদের দিকে কিছু ব্যর্থ হয়েছে: পরে আবার চেষ্টা করুন, যোগাযোগ করলে X-Request-Id জানান |
নিচের রেফারেন্স OpenAPI ডকুমেন্টের মতোই ইংরেজিতে।
Customers
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/customers | customers:read | List customers |
GET | /api/v1/customers/{id} | customers:read | Read a customer |
POST | /api/v1/customers | customers:write | Create a customer (an existing e-mail / phone returns that customer) |
PATCH | /api/v1/customers/{id} | customers:write | Update a customer's contact details |
Leads
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/inquiries | inquiries:read | List leads |
GET | /api/v1/inquiries/{id} | inquiries:read | Read a lead |
POST | /api/v1/inquiries | inquiries:write | Create a lead (contact, quote request, booking request, call-back) — notifies the team like the website form |
Quotations
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/quotations | quotations:read | List quotations |
GET | /api/v1/quotations/{id} | quotations:read | Read a quotation with its lines |
POST | /api/v1/quotations | quotations:write | Create a DRAFT quotation (tax computed by the workspace's rules) |
Invoices
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/invoices | invoices:read | List invoices |
GET | /api/v1/invoices/{id} | invoices:read | Read an invoice with lines and payments |
POST | /api/v1/invoices | invoices:write | Create a DRAFT invoice (numbered when issued in the back office) |
GET | /api/v1/payments | payments:read | List invoice payments (invoice=<id> to filter) |
GET | /api/v1/payments/{id} | payments:read | Read a payment |
Orders
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/orders | orders:read | List shop orders |
GET | /api/v1/orders/{id} | orders:read | Read a shop order |
Catalog
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/products | products:read | List products with price and stock (catalog:read also allows it) |
GET | /api/v1/products/{id} | products:read | Read a product |
GET | /api/v1/categories | catalog:read | List categories (type=product|service|post|project, locale=…) (হোস্টেড ওয়ার্কস্পেস) |
GET | /api/v1/services | catalog:read | List published services (হোস্টেড ওয়ার্কস্পেস) |
GET | /api/v1/services/{id} | catalog:read | Read a service (হোস্টেড ওয়ার্কস্পেস) |
GET | /api/v1/products/lookup | products:read | Exact barcode / SKU match (GTIN, SKU or an extra product barcode) — for scanners |
Bookings
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/booking-services | catalog:read | List bookable services (online booking on) (হোস্টেড ওয়ার্কস্পেস) |
GET | /api/v1/booking-services/{id} | catalog:read | Read a bookable service (হোস্টেড ওয়ার্কস্পেস) |
GET | /api/v1/bookings/slots | bookings:read | Free start times of a bookable service on a date (হোস্টেড ওয়ার্কস্পেস) |
GET | /api/v1/bookings | bookings:read | List appointments (হোস্টেড ওয়ার্কস্পেস) |
GET | /api/v1/bookings/{id} | bookings:read | Read an appointment (হোস্টেড ওয়ার্কস্পেস) |
POST | /api/v1/bookings | bookings:write | Book an appointment at a free time (409 when it was taken) (হোস্টেড ওয়ার্কস্পেস) |
Webhooks
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/events | webhooks:read | The webhook event catalog |
GET | /api/v1/deliveries | webhooks:read | Webhook delivery log |
GET | /api/v1/deliveries/{id} | webhooks:read | One delivery with its payload |
GET | /api/v1/webhooks | webhooks:read | List webhook endpoints (no secrets) (হোস্টেড ওয়ার্কস্পেস) |
POST | /api/v1/webhooks | webhooks:write | Create a webhook endpoint — the signing secret is returned once (হোস্টেড ওয়ার্কস্পেস) |
DELETE | /api/v1/webhooks/{id} | webhooks:write | Delete a webhook endpoint (হোস্টেড ওয়ার্কস্পেস) |
Account
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/me | (any) | Who is calling: the API key, or the person signed in to the app, with the workspace and the scopes |
Stock
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/warehouses | stock:read | Active stock locations |
GET | /api/v1/stock | stock:read | Stock levels per location (product=<id> for one product, all its rows) |
POST | /api/v1/stock/adjustments | stock:write | Add or remove stock (same rules as the admin: write-off reasons only remove) |
Appointments
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/appointments | appointments:read | List appointments (from / to filter the start time) |
GET | /api/v1/appointments/{id} | appointments:read | Read an appointment |
Point of sale
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/pos-sales | pos:read | List till sales and refunds (since = created since) |
GET | /api/v1/pos-sales/{id} | pos:read | Read a till sale with its lines and payments |
Tasks
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
GET | /api/v1/tasks | tasks:read | List tasks (app sign-in without tasks.manage: only my tasks) |
GET | /api/v1/tasks/{id} | tasks:read | Read a task |
POST | /api/v1/tasks | tasks:write | Create a task (assigned to the signed-in person by default) |
PATCH | /api/v1/tasks/{id} | tasks:write | Update a task or change its status (DONE closes it; recurring tasks schedule the next one) |
Files
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
POST | /api/v1/attachments | attachments:write | Upload a photo or PDF (multipart: file, taskId?, folder?) — images are re-encoded, metadata such as GPS removed |
GET | /api/v1/attachments/{id} | attachments:write | Read an uploaded file's record |
Apps
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
POST | /api/v1/session/handoff | (app) | One-time URL (60 s) that signs the app's web view in to the workspace and opens `next` (শুধু অ্যাপ টোকেন) |
GET | /api/v1/devices | (app) | My app installations (শুধু অ্যাপ টোকেন) |
POST | /api/v1/devices | (app) | Register an app installation for push (FCM / APNs / Huawei Push Kit token; the same token again returns the same id) (শুধু অ্যাপ টোকেন) |
DELETE | /api/v1/devices/{id} | (app) | Remove an app installation (শুধু অ্যাপ টোকেন) |
GET | /api/v1/devices/{id} | (app) | One app installation with the alert categories it does not get pushes for (শুধু অ্যাপ টোকেন) |
PATCH | /api/v1/devices/{id} | (app) | Alert categories this installation does not get pushes for (tasks, sales, bookings, messages, stock, system) — they still appear in /notifications (শুধু অ্যাপ টোকেন) |
GET | /api/v1/account/deletion | (app) | Delete account (apps): which path applies — workspace owner closes the workspace, staff ask the administrators, customers use the website — with links and a pending request (শুধু অ্যাপ টোকেন) |
POST | /api/v1/account/deletion | (app) | Delete account (apps): mode request = ask the administrators to delete the staff account and remove the app data; mode app-data = only end every app sign-in and web session and remove devices / push tokens (শুধু অ্যাপ টোকেন) |
POST | /api/v1/session/sign-out-all | (app) | Sign out of all devices: ends every app sign-in and web session of the person and removes their app installations (শুধু অ্যাপ টোকেন) |
GET | /api/v1/rider/today | (app) | Rider mode: which duties I may start (rider = parcels.ride, tech = field.work, driver = fleet.drive), my duty, today's runs, delivery stops and pickups (শুধু অ্যাপ টোকেন) |
POST | /api/v1/rider/duty | (app) | Start duty (returns a duty token that can only post positions / end the duty) or end it; the workspace's live-location setting must be on (শুধু অ্যাপ টোকেন) |
POST | /api/v1/rider/positions | (app) | Post a batch of positions while on duty (app token or the duty token fx_dt_…); only the newest valid point is kept (latest position, no trail) and feeds the recipient ETA and the runs map; a driver's batch also moves their vehicle and, when the workspace keeps one, its short trail (শুধু অ্যাপ টোকেন) |
GET | /api/v1/apps | (app) | Home screen of the apps: the app grid I may open (name, area, icon as SVG nodes, waiting count), the workspace brand and unread alerts (শুধু অ্যাপ টোকেন) |
GET | /api/v1/search | (app) | Search records I may open (customers, invoices, orders, products …), grouped like the admin header search; also suggestion (did you mean), quick (prefilled create links such as a new invoice for a customer) and intent (শুধু অ্যাপ টোকেন) |
GET | /api/v1/notifications | (app) | Alerts for me since a time (the desktop app polls this) (শুধু অ্যাপ টোকেন) |
Sensors
| মেথড | পাথ | স্কোপ | কী করে |
|---|---|---|---|
POST | /api/v1/sensors/readings | sensors:write | Upload sensor readings (temperature, humidity, fuel_level, value) — up to 500 per request; the device is the key's own device or the serial in `device`; re-sent readings are skipped; send an Idempotency-Key |
পরের: ওয়েবহুক
ব্যবসায়িক ঘটনা আপনার HTTPS এন্ডপয়েন্টে পাঠানো হয়, সাইন করা, আবার চেষ্টা করা ও লগ করা।