On this page
Zalo OA OpenAPI v3.0 returns negative integer error codes inside HTTP 200 JSON responses—most commonly -216 (expired or race-invalidated OAuth v4 access token), -213 (non-follower block), -230 (user inactive beyond the 7-day OpenAPI limit after the free 48-hour window), and -201 (invalid request parameter). Stopping outages requires mutex-locked token rotation, immediate dead-letter filtering for malformed payloads, and ZBS fallback routing or managed connectors.
Editorial disclosure: Published by TrolyPage, one of the messaging platforms evaluated in this engineering guide. All Zalo OA OpenAPI v3.0, ZBS/ZNS, Meta Graph API, and TrolyPage specifications and limitations below were verified against live documentation on November 28, 2026.
Why Zalo OA Error Codes Break Meta-Trained Retry Loops
Integration engineers moving from WhatsApp Cloud API or Messenger to Vietnam's primary business channel often assume standard HTTP retry middleware will hold. Under Meta Graph API error handling, failed requests return HTTP 4xx/5xx statuses with structured OAuthException payloads such as error 190 (expired token) or WhatsApp Cloud API error 131047 (24-hour window closed).
Zalo OA OpenAPI v3.0 behaves differently. Endpoints such as POST https://openapi.zalo.me/v3.0/oa/message/cs frequently return HTTP 200 OK with a negative integer inside the JSON body, such as {"error": -216, "message": "Access token is invalid"}. Any client checking only status_code >= 400 logs dropped customer messages as successes unless it parses body.error !== 0.
Three platform constraints turn naive exponential-backoff retries into production outages:
- Single-use rotating OAuth v4 refresh tokens: Per Zalo OAuth v4 documentation, authorization codes are single-use (10-minute TTL), an
access_tokenexpires in 25 hours, and eachrefresh_token(3-month max TTL) is strictly single-use. Calling the refresh endpoint immediately invalidates both prior tokens. When two workers hit-216concurrently and both refresh, the second worker desynchronizes the credential store and triggers cascading-216outages. - Nested 48-hour free vs 7-day OpenAPI gates: Under Zalo OA message guidelines (effective January 1, 2026), Consultation messages (Tin Tư vấn) cost 0 VND within 48 hours of a user's last recognized interaction (message, menu/CTA tap, comment, call, or follow). Beyond 48 hours, OA OpenAPI caps consultation delivery at 7 days (whereas OA Manager UI reaches 365 days), blocking non-followers or expired threads with
-213,-230, or-232. - OA-scoped UIDs and tier paywalls: OA APIs require OA-scoped
user_id(UID) identifiers rather than phone numbers; reaching non-followers by phone requires pre-approved ZBS Template Messages (consolidated from ZNS on January 1, 2026). Meanwhile, Basic and Standard OA tiers return-224on OpenAPI calls.
| Protocol Dimension | Zalo OA OpenAPI v3.0 | Meta Graph API (Messenger & WhatsApp Cloud) |
|---|---|---|
| Transport & Error Signal | Often HTTP 200 with negative integer error field (-216, -213, -230, -201) |
HTTP 4xx/5xx with positive error codes (190, 10, 131047) and fbtrace_id |
| Token Rotation Model | 25-hour access_token; single-use 3-month refresh_token rotates and invalidates prior pair on call |
Long-lived Page tokens and System User tokens remain stable without single-use rotation races |
| Customer Service Window | 48 hours free (0 VND); OpenAPI extends to 7 days (paid quota); OA Manager UI reaches 365 days | Strict 24 hours after user reply; free-form messaging blocked afterward (131047 / 2018278) |
| Recipient Identifier | OA-scoped user_id (UID) for OA APIs; E.164/local phone requires ZBS Template Message |
Page-Scoped ID (PSID) for Messenger; E.164 phone (wa_id) for WhatsApp Cloud API |
| API Tier Paywall | OpenAPI requires OA Growth (100 req/min) or Comprehensive (2,000 req/min); Basic/Standard return -224 |
API endpoints enabled by App Review permissions and WABA tier limits without paid per-tier API unlock |
Zalo OA OpenAPI v3.0 Error Code Reference & Remediation Matrix
The reference table below consolidates official Zalo For Developers OA error definitions and production remediation policies for the eight high-frequency codes that break messaging pipelines. Note four companion runtime codes to monitor in the same parser: -32 (application/OA rate limit exceeded—100 req/min on Growth vs 2,000 req/min on Comprehensive), -211 (out of quota), -234 (Official Account OpenAPI night-time send restriction from 10:00 PM to 7:00 AM, distinct from ZBS error -133's 22h–06h window), and -320/-321 (Zalo Cloud Account not linked or out of balance for paid calls).
| Error Code | Official Message | Root Trigger in Production | Retry Policy | Exact Engineering & Product Fix |
|---|---|---|---|---|
-216 |
Access token is invalid |
25-hour access_token expired, malformed header, or invalidated mid-flight by a concurrent OAuth v4 refresh_token call. |
Retry 1× after mutex lock | Acquire distributed Redis lock, refresh once with latest refresh_token, atomically persist new token pair, replay job. Alert ops if 3-month refresh token expired. |
-213 |
User has not followed OA |
Target user_id has not clicked Follow (Quan tâm) on the OA, or Customer Care API capability is disabled on the app. |
Do NOT retry | Verify app CS capability in Zalo Developers; route non-followers to a pre-approved ZBS Template Message (200–300 VND excl. VAT) via phone/UID instead of OA push. |
-230 |
User has not interacted with the OA in the past 7 days |
Recipient's last recognized interaction exceeded OpenAPI's 7-day ceiling (beyond both the 48h free window and the 48h–7d OpenAPI window). | Do NOT retry CS endpoint | Route to dead-letter queue and trigger ZBS Template Message (Tag 1 Transaction or Tag 2/3 Care) or manual OA Manager outreach (up to 365 days) to reopen a 48h thread. |
-201 |
<data_field> is invalid! |
Malformed JSON body, missing required keys, invalid user_id type, or mismatched schema between /cs, /transaction, and /promotion. |
Zero retries (DLQ) | Enforce JSON schema validation in middleware before HTTP dispatch; log exact invalid payload field and fix serializer/DTO mapping. |
-224 |
The OA needs to upgrade OA Tier Package to use this feature |
OA sits on Basic (0 VND) or Standard (1,000,000 VND/year), both of which carry 0 OpenAPI access and 0 out-of-48h quota. | Pause queue; alert admin | Upgrade OA on Zalo Business Solutions to Growth (2,500,000 VND/year) or Comprehensive (6,000,000 VND/year) before resuming OpenAPI traffic. |
-232 |
User has not interacted with the OA, or the last interaction has expired |
User never initiated a recognized OA interaction, or the interaction session expired for the requested consultation call. | Do NOT retry CS endpoint | Suppress automated /v3.0/oa/message/cs retries; fall back to phone-matched ZBS Template Message or human follow-up via Zalo Personal. |
-233 |
message type is invalid or not support |
Payload specifies an unsupported or unavailable message type/template for the target OA endpoint. | Do NOT retry payload | Verify the message type against the active MessageV3 endpoint spec (/cs, /transaction, or /promotion) and fix the DTO before re-enqueuing. |
-240 |
MessageV2 API has been shut down, please switch to MessageV3 |
Legacy integration still targets deprecated /v2.0/oa/message routes. |
Zero retries; hotfix deploy | Migrate endpoints to /v3.0/oa/message/cs, /transaction, or /promotion and update request/response models per MessageV3 spec. |
Fixing OAuth v4 Token Rotation Races (-216) and Window Blocks (-213, -230, -232)
In production, -216 rarely stems from a single expired string. It almost always surfaces as a multi-worker race condition at hour 25. Because Zalo OAuth v4 invalidates the previous refresh_token the instant a new pair is issued, storing tokens in process memory or running uncoordinated cron jobs guarantees intermittent outages across horizontally scaled containers.
To eliminate -216 race conditions in custom middleware, centralize token ownership behind three safeguards:
- Proactive scheduled refresh with jitter: Refresh the
access_tokenat hour 23 (two hours ahead of the 25-hour expiry) inside a dedicated singleton worker rather than waiting for live customer traffic to hit-216. - Distributed mutex on reactive refresh: Wrap any reactive refresh handler in a short-TTL distributed lock (such as Redis
SET NX EX 15keyed byoa_id). When Worker B encounters-216while Worker A holds the lock, Worker B waits 300–500 ms, reads the newly persistedaccess_tokenfrom Redis/Postgres, and retries once without touching the OAuth endpoint. - Compare-and-swap persistence: Write the new
access_tokenandrefresh_tokentogether in one atomic database/Redis transaction before releasing the lock, and fire a PagerDuty/Slack alert immediately if the refresh endpoint rejects therefresh_token(requiring an OA admin to complete a fresh OAuth grant).
Solving -213, -230, and -232 requires a routing shift rather than token engineering. Once a buyer crosses the 48-hour free consultation mark, OpenAPI messages consume paid out-of-48h quota (500 messages/month on Growth; 2,000 messages/month on Comprehensive; 55 VND incl. VAT overage—see our Zalo OA pricing tiers breakdown) up to day 7. At day 7 plus one second, /v3.0/oa/message/cs hard-fails with -230.
Instead of retrying /v3.0/oa/message/cs, classify -213, -230, and -232 as window-closed signals—identical conceptually to WhatsApp's 131047—and route eligible transactional or post-care updates to a pre-approved ZBS Template Message. Per ZBS pricing (excl. VAT), standard/other templates cost 200 VND (journey templates for eligible industries start from 200 VND) and OTP, transfer, voucher, or bus ticket (Beta) templates cost 300 VND, with lower subsidized rates when sending by UID. Your first CTA button in a category costs 0 VND; when the customer taps that button or replies, Zalo opens a two-way OA thread and resets a fresh 48-hour free consultation window.

15-Minute Incident Triage Runbook for Production Zalo OA Outages
When delivery monitoring flags a sudden drop in Zalo OA outbound volume, run this four-stage triage sequence before restarting workers:
- Minute 00:00–03:00 — Inspect JSON bodies, not HTTP status codes: Sample the last 50 outbound responses from
openapi.zalo.me. Group occurrences bybody.errorinteger. Verify your worker actually parseserror !== 0inside HTTP 200 payloads so silent failures do not inflate delivery SLAs. - Minute 03:00–07:00 — Isolate credential and tier outages (
-216,-224,-211,-320,-321,-240): If-216dominates, inspect your Redis/DB token lock and check whether two pods refreshed the samerefresh_tokenwithin the past 5 minutes. If-224appears, verify OA package status in Zalo Cloud (Growth/Comprehensive active vs downgraded to Standard/Basic). If-211,-320, or-321spikes, verify out-of-48h quota remaining and Zalo Cloud Account linkage/balance. If-240appears, locate any un-migrated/v2.0/oa/messageservice. - Minute 07:00–11:00 — Drain non-retryable queue poison (
-201,-233,-213,-230,-232): Purge these five codes from your retry queue into a dead-letter topic immediately so they stop starving active 48-hour conversations or tripping rate-limit error-32. Validate JSON fields for-201, fix unsupported message types for-233, and defer-234quiet-hours blocks until after 7:00 AM (OA OpenAPI enforces a 10:00 PM – 7:00 AM window, unlike ZBS-133's 22h–06h cutoff). - Minute 11:00–15:00 — Trigger ZBS or OA Manager fallback: For high-priority order, booking, or renewal threads blocked by
-213or-230, dispatch a transaction-pure Tag 1/Tag 2 ZBS template via phone number, or instruct support leads to send a one-off reply inside OA Manager web UI (which remains open up to 365 days) or escalate via managed Zalo Personal.
Architecture Tradeoff: Naive Retries vs Custom Middleware vs Managed TrolyPage
Engineering and CX leaders face three distinct architectural paths for handling Zalo OA errors and multi-day buyer conversations in Vietnam:
| Decision Dimension | Option A: Naive Exponential-Backoff Retries on All Errors | Option B: Custom OAuth v4 + ZBS Fallback Microservice | Option C: Managed Zalo OA + Zalo Personal in TrolyPage |
|---|---|---|---|
| Token & Error-Handling Gate | Retries HTTP failures blindly; ignores HTTP 200 negative integers or triggers concurrent -216 refresh races |
Redis-locked OAuth v4 rotation (25h access / 3-mo single-use refresh) + per-code router separating -213/-230 to ZBS |
Platform-managed Zalo OA & Zalo Personal connectors eliminate in-house OAuth v4 token rotation code and -240 migration maintenance |
| Zalo OA + Zalo Personal Coverage | Zalo OA only; fails silently on non-followers (-213) and >7-day leads (-230) with no personal escalation |
Zalo OA + ZBS only (200–300 VND/msg excl. VAT); high-ticket B2B/clinic Zalo Personal chats stay trapped on unmanaged rep phones | Unified inbox connects both Zalo OA and Zalo Personal (requires eligible plan + active connector) alongside WhatsApp, Messenger, IG, Telegram, Web Chat & Email |
| Integration & Engineering Overhead | Low setup (<1 day), but constant on-call firefighting for dead tokens and blocked queues | High build/upkeep: custom webhook ingestion, Redis locks, ZBS parameter validators, plus OA Growth (2.5M VND/yr) or Comprehensive (6M VND/yr) | No-code channel setup at VAT-inclusive USD tiers ($8–$104/mo) + webhooks, Zapier, Google Sheets, and MCP; no public developer REST API yet |
| Root Technical / Economic Mechanism | Exponential backoff amplifies single-use refresh_token collisions and exhausts 100 req/min Growth quotas on terminal errors |
Separating mutex token rotation from ZBS fallback prevents -216 storms, though you pay full dev sprint cost for inbox UI, AI, and CRM glue |
Managed connectors absorb token/API churn while routing 48h OA replies through bilingual AI, human handoff, and Auto-Stop Follow-up |
| Exact Failure Cost When Choosing Wrong | Cascading -216 auth lockouts requiring manual OA re-login, plus 100% retry waste on terminal -201/-213/-230 drops |
Ongoing backend sprint drag maintaining custom OAuth v4/ZBS glue while losing visibility into rep-owned Zalo Personal closings | Teams needing direct inbound REST endpoints for custom apps hit the no public REST API yet gap (requiring webhooks/Zapier/MCP workarounds) |

Operating Zalo OA & Zalo Personal in TrolyPage (With Honest API Limitations)
For international CX and operations teams that want reliable Vietnam messaging without maintaining custom OAuth v4 mutex locks or MessageV3 parsers, TrolyPage consolidates both Zalo OA and Zalo Personal (requiring an eligible plan and active connector) into one shared inbox alongside WhatsApp Cloud API, Messenger, Instagram DM, Telegram, Website Chat, and Email/TrolyMail (Pro/Scale+).
Inside that workspace, teams layer operational controls built around Zalo's 48-hour consultation window:
- Bilingual knowledge-grounded AI & PII guardrails: Train AI on VI/EN docs, spreadsheets, and crawled URLs (
knowledge_web), enforce configurable Data Safety PII masking, validate replies inevaluationchat, and invoke tools for SKU lookup, bookings, shipping, and payment QR verification. - Human
handoff& shift routing: Escalating high-ticket or out-of-window threads pauses AI replies immediately so reps close via OA or managed Zalo Personal under round-robin andshiftsSLA alerts. - Auto-Stop Follow-up: Outbound sequences halt automatically upon customer reply, payment, opt-out, or human takeover.
- Pricing & honest limitations: VAT-inclusive USD plans cover Free (one-time time-limited trial, not permanent free), Lite ($8.00/mo, 250 MAU, 5 connections), Starter ($16.00/mo, 500 MAU, 10 connections), Pro ($32.00/mo, 1,600 MAU, 20 connections), and Scale ($104.00/mo, 10,000 MAU, 30 connections); add-ons cost $1.00/mo per extra seat, $2.00/mo per extra Page (1 Page using publishing+messaging consumes 2 connections), and $2.00/mo per 1,000 extra subscribers, with base seats confirmed at checkout. Five constraints matter for technical teams: (1) no public developer REST API yet—automation uses trigger webhooks, Zapier Webhooks, Google Sheets OAuth sync, and the MCP gateway (291 tools across unified + 11 domain servers on
/mcpvs legacy 86-tool copy on/pricing); (2) no native two-way HubSpot/Salesforce CRM app; (3) no visual drag-and-drop flow builder; (4) docs.trolypage.com is currently in Vietnamese; and (5) live vendor support runsUTC+7.
Teams still needing programmatic ZBS/ZNS alerts can pair their ZBS sender with TrolyPage webhooks so every customer reply inside the 48-hour OA window or Zalo Personal escalation lands in one audited inbox.
Comments
Your comment will appear after review.
Sign in to commentNo comments to show.