Bayatak

Bayatak API بيعتك

One REST API for the classifieds app (browse, sell, boost) and its control panel.

All systems operational Version 0.0.1 · 386618b Base URL https://bayatak-api.dev-moltaqa.cloud

API reference (Swagger)

Every endpoint with its request, responses and errors. Try requests right in the browser.

Open docs

Postman collection

Download and import. Sign-in requests save the token, so the rest are authenticated.

Download

OpenAPI 3 document

For code generators and API clients (Dart, Swift, Kotlin, TypeScript…).

Get JSON

Health

MySQL up 0.9 ms·Redis up 0.5 ms

View JSON

Request logs

Recent requests with their body, response, SQL and timing. Look up a failing call by its X-Request-Id.

Open logs

Background jobs

Queued and scheduled jobs (file cleanup and video posters now; ad expiry and notifications later), with failures and retries.

Open board

Base paths

PathUsed bySigns in withToken
/v1/userMobile app (guests, buyers and sellers: one account)Mobile number + 4-digit SMS codebk_usr_…
/v1/adminControl panelcoming soonEmail + passwordbk_adm_…

Send the token as Authorization: Bearer <token>. A token only works in its own app's path. Guests call public routes without one.

Test servers

Signing in

SMS is simulated on test servers: every number gets the code 1234. With SEED_DEMO_DATA=true, the demo build's two accounts are seeded: the seller 0559876543 and the buyer 0501234567. Or register any 05… number.

Nafath

The fake Nafath answers on its own after a few seconds, by the ID's last digit: 1 is declined, 2 doesn't match, 3 is never answered (it expires after 2 minutes), any other digit is approved, e.g. 1012345678.

Payments coming soon

Packages, boosts and contributions will use a fake gateway that can succeed, fail, cancel or stay pending, so every result screen can be tried.

Uploading files

Photos and videos upload first, one per request, as multipart/form-data to POST /v1/user/files?purpose=…; the ad then sends the returned ids, so the app can show progress and retry one file. The type is read from the file's bytes and each kind has its own limit: ad photos PNG or JPG up to 5 MB (10 per ad), or one ad video MP4 or MOV up to 20 MB, which gets a poster image. Forms without files are JSON.

Conventions

Language

Send Accept-Language: ar or en (or ?lang=). Arabic is the default; a signed-in account's saved language is used when the request names none.

Errors

Always { code, message, details?, requestId }. Branch on code; show message. details lists field problems with their own message.

Request IDs

Every response has an X-Request-Id header. Include it when reporting a problem.

Mobile numbers

Saudi numbers as typed (05…, 5…, +9665…, Arabic digits too); responses use +9665….

Dates

Times are ISO 8601 in UTC, for example 2026-10-07T09:30:00.000Z.

Lists

App lists scroll with { items, nextCursor }; control panel tables page with { items, page, limit, total }.

Error codes

All 37 codes with their HTTP status and English message
CodeStatusMessage
VALIDATION_FAILED400The request data is invalid
INVALID_JSON400The request body could not be read
UNAUTHORIZED401Please log in to complete this action.
FORBIDDEN403You don't have permission to do this
ACCOUNT_DISABLED403This user is disabled, please contact the administration.
NOT_FOUND404The requested item was not found
CONFLICT409The request conflicts with existing data
PAYLOAD_TOO_LARGE413The request is larger than allowed
TOO_MANY_REQUESTS429Too many requests, please try again shortly
MOBILE_NOT_REGISTERED404No account is registered with this number. Please make sure the mobile number is correct.
MOBILE_ALREADY_REGISTERED409The mobile number is already in use, please verify the number.
MOBILE_UNCHANGED400This is already your number
ALREADY_VERIFIED409Your identity is already verified.
IDENTITY_ALREADY_USED409This ID number has already verified another account.
TOO_MANY_ATTEMPTS429Too many attempts. You can try again in {minutes} minutes.
AD_ACTION_NOT_ALLOWED409You can't do this.
AD_UNAVAILABLE410This ad is no longer available.
ADVERTISER_UNAVAILABLE410This advertiser's page isn't available.
ALREADY_REPORTED409You have already reported this ad.
NO_CREDIT402You have used all your free ads for this month. Subscribe to a package to post more, or wait for next month.
PACKAGE_EXPIRED402Your package has ended and this month's free ads are used up. Renew a package to post more, or wait for next month.
REGION_NOT_AVAILABLE400This region is not available. Please choose another.
CITY_NOT_AVAILABLE400This city is not available. Please choose another.
NEIGHBORHOOD_NOT_AVAILABLE400This neighbourhood is not available. Please choose another.
EMAIL_ALREADY_REGISTERED409This email is already in use.
OTP_INVALID400The verification code is incorrect.
OTP_EXPIRED400The verification code is invalid or expired. Please request a new one.
OTP_TOO_MANY_ATTEMPTS429Too many incorrect attempts. Please request a new code.
OTP_RESEND_TOO_SOON429You can request a new code in {seconds} seconds.
VERIFICATION_INVALID400This verification is no longer valid. Please request a new code.
SMS_SEND_FAILED503The verification code could not be sent. Please try again.
EMAIL_SEND_FAILED503The verification code could not be sent to this email. Please try again.
FILE_REQUIRED400No file was attached.
FILE_TOO_LARGE413File size exceeds the allowed limit ({maxMb} MB).
FILE_TYPE_NOT_ALLOWED415Unsupported file type. Allowed: {allowed}
FILE_NOT_AVAILABLE400This file can't be used. Please upload it again.
INTERNAL_ERROR500Something went wrong, please try again