Grant only the scopes you need. Give each bot or client its own key so it can be revoked independently.
API documentation
Generated from the API core so endpoints, scopes and integration examples stay together.
Integrate through one clear flow
Start with an API key, send a Bearer token, read services, then create and track orders. The endpoints below share the same runtime catalog.
Follow 4 steps
The shortest path to connect a client to the contract and keep debugging straightforward.
Use the Authorization: Bearer <API_KEY> header. Do not put the key in the URL.
Call services/stock to obtain service_id and check availability before creating an order.
Use an idempotency key when creating an order, then read the result by order_code.
/api/Recommended: Authorization: Bearer <API_KEY>. Do not pass the key in the URL.
Each endpoint has its own scope; the server still enforces wallet, inventory and actor authorization rules.
Common errors
Every response includes request_id. For 405 errors, allowed_methods contains the endpoint method; for 403 errors, scope contains the missing scope.
Check the HTTP status and error code first; use request_id to trace logs when needed.
{
"success": false,
"error": "invalid_request",
"message": "invalid_request",
"request_id": "req_example_common_error_400_1"
}{
"success": false,
"error": "missing_api_key",
"request_id": "req_example_common_error_401_1"
}{
"success": false,
"error": "scope_required",
"scope": "service.view",
"request_id": "req_example_common_error_403_1"
}{
"success": false,
"error": "method_not_allowed",
"message": "HTTP method không được hỗ trợ cho endpoint này.",
"allowed_methods": [
"GET"
],
"request_id": "req_example_common_error_405_1"
}{
"success": false,
"error": "system_error",
"message": "Lỗi hệ thống khi xử lý API. Vui lòng thử lại hoặc cung cấp request_id cho quản trị viên.",
"request_id": "req_example_common_error_500_1"
}Services & stock
/api/services.phpList services
Returns services visible to the API key. Buyers receive buyable services; suppliers/uploaders receive only owned local inventory services plus operational metadata.
Send the documented method, Bearer token and parameters exactly as defined above.
GET /api/services.php
Authorization: Bearer <API_KEY>These cards are variants of the same endpoint by role or parameter; shared fields keep the same contract.
{
"success": true,
"data": [
{
"id": 12,
"service_code": "FB_ACC_VN",
"slug": "facebook-account-vn",
"name": "Facebook Account Việt Nam",
"description": "Tài khoản định dạng uid|pass|cookie",
"price": 2500,
"currency": "VND",
"min_quantity": 1,
"max_quantity": 100,
"output_format": "uid|password|cookie|2fa",
"parser_type": "facebook_line",
"service_type_id": 1,
"service_type_display": "Phở Bò",
"stock_available": 84,
"stock_total": 120
}
],
"request_id": "req_example_services_1"
}{
"success": true,
"data": [
{
"id": 12,
"service_code": "FB_ACC_VN",
"slug": "facebook-account-vn",
"name": "Facebook Account Việt Nam",
"description": "Tài khoản định dạng uid|pass|cookie",
"price": 2500,
"currency": "VND",
"min_quantity": 1,
"max_quantity": 100,
"output_format": "uid|password|cookie|2fa",
"parser_type": "facebook_line",
"service_type_id": 1,
"service_type_display": "Phở Bò",
"stock_available": 84,
"stock_total": 120,
"delivery_mode": "local_stock",
"service_status": 1,
"lock_source": "",
"lock_reason": "",
"upload_allowed": true
}
],
"request_id": "req_example_services_2"
}/api/stock.phpCheck service stock
Returns sellable/live/unknown stock for a visible service. Does not expose the owner, cost price or internal configuration.
service_idquery · required · int > 0Send the documented method, Bearer token and parameters exactly as defined above.
GET /api/stock.php?service_id=12
Authorization: Bearer <API_KEY>This is the real response shape the client should handle.
{
"success": true,
"data": {
"id": 12,
"service_code": "FB_ACC_VN",
"name": "Facebook Account Việt Nam",
"price": 2500,
"currency": "VND",
"min_quantity": 1,
"max_quantity": 100,
"sellable_items": 84,
"available_items": 84,
"live_items": 90,
"unknown_items": 6,
"updated_ts": 1785128400
},
"request_id": "req_example_stock_1"
}Orders
/api/order_create.phpCreate an order
Creates a purchase order. Idempotency-Key is required so retries do not create duplicate orders or charge twice. include_raw=1 requires order.download and returns delivered data in data.accounts.
Idempotency-Keyheader or JSON idempotency_key/client_order_id · required · string 1-160service_idjson · required · int > 0quantityjson · required · int > 0min_age_secjson · optional · int|nullmax_age_secjson · optional · int|nullinclude_rawJSON or query · optional · 0|1; requires order.downloadvoucher_code / promo_codejson · optional · rejected; vouchers are for top-ups onlySend the documented method, Bearer token and parameters exactly as defined above.
POST /api/order_create.php
Authorization: Bearer <API_KEY>
Idempotency-Key: order-client-000001
Content-Type: application/json
{"service_id":12,"quantity":5,"include_raw":0}These cards are variants of the same endpoint by role or parameter; shared fields keep the same contract.
{
"success": true,
"status": "completed",
"order_code": "ORD20260727000000ABCDEF",
"requested_count": 5,
"delivered_count": 5,
"missing_count": 0,
"processing": false,
"message": "Mua thành công — đã giao 5/5 sản phẩm.",
"idempotent_replay": false,
"order_created": true,
"response_degraded": false,
"retryable": false,
"voucher_policy": "disabled_reject_non_empty",
"purchase_ms": 142,
"request_id": "req_example_order_create_1"
}{
"success": true,
"status": "completed",
"order_code": "ORD20260727000000ABCDEF",
"requested_count": 5,
"delivered_count": 5,
"missing_count": 0,
"processing": false,
"message": "Mua thành công — đã giao 5/5 sản phẩm.",
"idempotent_replay": false,
"order_created": true,
"response_degraded": false,
"retryable": false,
"voucher_policy": "disabled_reject_non_empty",
"purchase_ms": 142,
"data": {
"accounts": [
"61512345678901|pass|cookie"
]
},
"raw_pagination": {
"returned": 1,
"limit": 5000,
"limited": false,
"next_cursor": 0
},
"raw_access_rule": "refund_revokes_user_payload",
"request_id": "req_example_order_create_2"
}{
"success": false,
"error": "purchase_busy",
"message": "purchase_busy",
"retryable": true,
"request_id": "req_example_order_create_3"
}/api/order_result.phpGet order results
Returns public order metadata and items. include_raw=1 requires order.download, supports cursors and is blocked after refund. Internal member, order and item IDs are not returned.
order_codequery · required · stringinclude_rawquery · optional · 0|1; requires order.downloadcursorquery · optional · int >= 0; only when include_raw=1Send the documented method, Bearer token and parameters exactly as defined above.
GET /api/order_result.php?order_code=ORD20260727000000ABCDEF&include_raw=0
Authorization: Bearer <API_KEY>These cards are variants of the same endpoint by role or parameter; shared fields keep the same contract.
{
"success": true,
"order": {
"order_code": "ORD20260727000000ABCDEF",
"service_id": 12,
"service_name": "Facebook Account Việt Nam",
"service_description": "Tài khoản định dạng uid|pass|cookie",
"quantity": 5,
"unit_price": 2500,
"total_amount": 12500,
"currency": "VND",
"status": 1,
"payment_status": 1,
"delivery_line_count": 5,
"download_count": 1,
"created_ts": 1785128280,
"completed_ts": 1785128290
},
"items": [
{
"item_identifier": "61512345678901",
"status": 1,
"delivered_raw_hash": "5d41402abc4b2a76b9719d911017c592",
"delivered_raw_size_bytes": 128
}
],
"raw_access_revoked": false,
"raw_access_rule": "refund_revokes_user_payload",
"request_id": "req_example_order_result_1"
}{
"success": true,
"order": {
"order_code": "ORD20260727000000ABCDEF",
"service_id": 12,
"service_name": "Facebook Account Việt Nam",
"service_description": "Tài khoản định dạng uid|pass|cookie",
"quantity": 5,
"unit_price": 2500,
"total_amount": 12500,
"currency": "VND",
"status": 1,
"payment_status": 1,
"delivery_line_count": 5,
"download_count": 1,
"created_ts": 1785128280,
"completed_ts": 1785128290
},
"data": {
"accounts": [
"61512345678901|pass|cookie"
]
},
"raw_pagination": {
"returned": 1,
"limit": 5000,
"limited": false,
"next_cursor": 0
},
"raw_access_rule": "refund_revokes_user_payload",
"request_id": "req_example_order_result_2"
}Wallet
/api/wallet_balance.phpWallet balance
Returns main balance, promo balance, hold and cumulative totals for the account tied to the API key. Does not expose member_id or internal wallet IDs/versions.
Send the documented method, Bearer token and parameters exactly as defined above.
GET /api/wallet_balance.php
Authorization: Bearer <API_KEY>This is the real response shape the client should handle.
{
"success": true,
"data": {
"currency": "VND",
"status": 1,
"updated_ts": 1785128400,
"balance": 100000,
"promo_balance": 5000,
"hold_balance": 0,
"total_credit": 250000,
"total_debit": 145000,
"total_spent": 140000,
"total_refund": 5000
},
"request_id": "req_example_wallet_balance_1"
}Local inventory
upload_inventory.php only accepts services with delivery_mode=local_stock. remote_api services fetch and synchronize through Provider API instead of uploading raw data into local inventory.
/api/upload_inventory.phpUpload local inventory
Uploads up to 5,000 raw lines into an owned local_stock service. The parser can auto-detect the format; clients cannot set live_status themselves.
service_idjson · required · int > 0parser_typejson · optional · string; defaults to auto_detectlinesjson · required · array|string; maximum 5,000 linessource_refjson · optional · stringSend the documented method, Bearer token and parameters exactly as defined above.
POST /api/upload_inventory.php
Authorization: Bearer <API_KEY>
Content-Type: application/json
{"service_id":12,"parser_type":"auto_detect","lines":["61512345678901|pass|cookie"]}This is the real response shape the client should handle.
{
"success": true,
"batch_code": "API20260727100000ABCDEF",
"inserted": 1,
"duplicate_in_file": 0,
"duplicate_in_db": 0,
"invalid": 0,
"live_status": 0,
"parser_type": "facebook_line",
"parser_detection": {
"parser_type": "facebook_line",
"confidence": 1,
"reason": "Nhận diện UID Facebook hợp lệ.",
"uid_rows": 1,
"checked_rows": 1
},
"checker_type": "fb_uid",
"checker_auto_configured": true,
"request_id": "req_example_upload_inventory_1"
}Other
/api/key_info.phpInspect the current API key
Confirm which username/role owns the key and distinguish stored scopes from scopes currently effective under RBAC. Does not return member_id or the full key.
Send the documented method, Bearer token and parameters exactly as defined above.
GET /api/key_info.php
Authorization: Bearer <API_KEY>This is the real response shape the client should handle.
{
"success": true,
"data": {
"key_name": "Automation buyer",
"key_prefix": "wsm_live_ab12",
"key_format": "wsm_live",
"username": "buyer01",
"account_role": "buyer",
"stored_scopes": [
"api.use",
"service.view",
"order.create",
"order.view"
],
"effective_scopes": [
"api.use",
"service.view",
"order.create",
"order.view"
],
"expires_ts": 0,
"last_used_ts": 1785128400
},
"request_id": "req_example_key_info_1"
}Reseller tip
Order creation can return delivered data immediately when the key has the required scope.
When creating an order, set include_raw=1 to receive delivered data in data.accounts when the API key has order.download.
Use WSMarket as a source for another site
Connect through the Provider API preset instead of rebuilding the contract.
Admins can select the WebBanHang v2 API preset. It uses /api/services.php for services, /api/order_create.php for purchasing and /api/wallet_balance.php for wallet balance.