Skip to main content

Send an approval OTP

POST 

/approvals/otp

Sends a 6 digit one-time code to one approver. This call takes no Idempotency-Key.

Behaviour​

  • The code is valid for 5 minutes and at most 3 codes can be sent for the same order, user and types.
  • Sending the same body again is a resend; a resend inside the wait answers 409 OTP_RESEND_COOLDOWN with data.resend_after (this API never answers 429).
  • The approver's phone number is never returned.
  • OTP_UNAVAILABLE means no code can be sent now; data.reason is no_reachable_approver, quota_exhausted, provider_error, cashier_cap_reached or resend_exhausted, and data.fallback_authorized is true: a PIN fallback is then open until data.fallback_expires_at, so call POST /approvals/pin instead.

Errors​

StatusCodeWhen
400VALIDATION_FAILEDThe body is not valid.
400USER_ID_REQUIREDX-User-ID is missing.
403PLAN_FEATURE_REQUIREDThe plan has no approval by one-time code.
403OTP_NOT_ENABLEDThe outlet does not use approval by one-time code.
403APPROVER_NOT_ELIGIBLEThe approver is not on the outlet's approval line, or cannot receive a code while another approver can.
403PERMISSION_DENIEDThe acting user may not do this.
403OUTLET_FORBIDDENThe outlet is not allowed.
404NOT_FOUNDThe order_id is not an order of the outlet in X-Outlet-ID.
409PIN_LOCKEDThe PIN check is locked; see data.unlock_at.
409OTP_RESEND_COOLDOWNA resend inside the wait; see data.resend_after.
409OTP_UNAVAILABLENo code can be sent now; see Behaviour.
409SHIFT_NOT_OPENThe acting user has no open shift.
422INVALID_USERThe acting user is not valid.

Request​

Responses​

The sent code