Skip to main content

OTP Verification

2 API calls in this section.

Verify OTP

Express Shipping / Customer / OTP Verification
POST/express-shipping/customer/verify-otp?language=en

Verify the OTP code sent to customer's phone number. Maximum 5 attempts allowed before code expires. Authentication: - Requires valid Bearer token OR X-API-Key - Bearer token: Authorization: Bearer {{access_token}} - API Key: X-API-Key: {{api_key}} (alternative authentication method) Request Body: - phone (required): Phone number in international format - code (required): 6-digit OTP code received via SMS Response: - Note: access_token must be sent as X-EXPRESS-KEY for order APIs. - Token TTL: ~5 minutes. Renew by re-verifying if expired.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/express-shipping/customer/verify-otp?language=en" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "phone": "+919876543210",7  "code": "123456"8}'
Request body
json
1{2  "phone": "+919876543210",3  "code": "123456"4}

Query parameters

languageOptional
query string

en

Preferred language for response messages (en, ar, ku)

Request body fields

phoneExample
string

Example field from the request body.

codeExample
string

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success - OTP Verified200OK
Response body
json
1{2  "success": true,3  "data": {4    "customer_id": "GAL1704067200000",5    "full_name": "John Doe",6    "email": "john.doe@example.com",7    "phone": "+919876543210",8    "is_verified": true,9    "verified_at": "2024-01-01T12:00:00Z"10  },11  "message": "OTP verified successfully. Customer is now verified."12}
Error - Invalid Code400Bad Request
Response body
json
1{2  "success": false,3  "message": "Invalid verification code",4  "attempts_remaining": 35}
Error - Code Expired400Bad Request
Response body
json
1{2  "success": false,3  "message": "Verification code has expired. Please request a new OTP."4}
Success (200 OK)200
Response body
json
1{2  "success": true,3  "data": {4    "user_id": "UUID",5    "customer_id": "GAL1704067200000",6    "full_name": "John Doe",7    "email": "john.doe@example.com",8    "phone": "+919876543210",9    "address_id": "UUID",10    "delivery_address": { /* ... */ },11    "access_token": "<short-lived-jwt>"12  },13  "message": "OTP verified successfully. Customer is now verified."14}
Error - Too Many Attempts (400 Bad Request)400
Response body
json
1{2  "success": false,3  "message": "Too many failed attempts. Please request a new OTP."4}

Resend OTP

Express Shipping / Customer / OTP Verification
POST/express-shipping/customer/resend-otp?language=en

Resend OTP code. One of phone or customer_id is required. If customer_id is provided, the API resolves the customer's phone and sends the OTP. Request Body (one of): - phone: International phone number - customer_id: Customer id (e.g., GAL1704067200000) Response: Errors include rate limiting, already verified, and customer not found.

Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/express-shipping/customer/resend-otp?language=en" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "phone": "+919876543210",7  "customer_id": ""8}'
Request body
json
1{2  "phone": "+919876543210",3  "customer_id": ""4}

Query parameters

languageOptional
query string

en

Preferred language for response messages (en, ar, ku)

Request body fields

phoneExample
string

Example field from the request body.

customer_idExample
string

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success - OTP Sent200OK
Response body
json
1{2  "success": true,3  "message": "OTP sent successfully to your phone."4}
Error - Rate Limited429Too Many Requests
Response body
json
1{2  "success": false,3  "message": "Please wait before requesting another OTP",4  "wait_time": 455}
Error - Already Verified400Bad Request
Response body
json
1{2  "success": false,3  "message": "Customer is already verified"4}