Dokumentasi Pembangun & Ejen AI

REST API awam Sewapedia untuk integrasi mudah alih, web, dan ejen AI.

Spesifikasi & penemuan

OpenAPI (penuh) — openapi.yaml

OpenAPI ejen (API) — GET /api/v1/openapi/agent

OpenAPI ejen (statik) — openapi-agent.yaml

Boleh baca mesin — /.well-known/openapi

Peringkat kredensial: Tier 0 = spesifikasi ejen (tanpa auth); Tier 1 = JWT/kunci API untuk REST; Tier 2 = kunci rakan kongsi untuk spesifikasi penuh. Lihat docs/PUBLIC_OPENAPI_GUIDE.md.

Ringkasan platform — llms.txt

Panduan ejen MCP — mcp-agent-guide.md

Inventori tool MCP — mcp-feature-list.md (131 tool)

Panduan MCP pemilik — mcp-owner-guide.md

Panduan operasi REST: docs/API_AGENT_GUIDE.md dalam repositori GitHub.

Pengesahan JWT

Log masuk dengan e-mel/kata laluan; gunakan accessToken sebagai Bearer pada laluan dilindungi.

curl -s -X POST "https://sewapedia.id/api/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{"email":"customer@rentapp.local","password":"password123"}'

Header: Authorization: Bearer {accessToken}. Segar semula melalui POST /api/v1/auth/refresh.

Contoh — senarai aset

curl -s "https://sewapedia.id/api/v1/assets?limit=5"

Carian vs ketersediaan

GET /assets mencari calon tetapi tidak menjamin tarikh. Sentiasa panggil GET /assets/{slug}/availability?from=&to= sebelum tempahan.

curl -s "https://sewapedia.id/api/v1/assets/{slug}/availability?from=2026-09-01&to=2026-09-07"

Aliran tempahan (penyewa)

1. Cari — GET /assets atau GET /catalog/feed

2. Ketersediaan — GET /assets/{slug}/availability setiap calon

2. Cipta rancangan — POST /bookings → PENDING_VERIFICATION

3. Sahkan & promosi — muat naik, GET /verification/status, POST /bookings/{id}/promote

4. Tunggu kelulusan pemilik — poll GET /bookings/{id}/readiness

5. Bayar (human-in-the-loop) — POST /pay → redirectUrl, poll GET /pay/status

Universal Commerce Protocol (UCP)

Fasad serasi UCP untuk perdagangan ejen. Manifest di /.well-known/ucp; endpoint REST di /api/v1/ucp/*. Memetakan aliran katalog, sebut harga & checkout sedia ada — tiada mandat AP2.

Manifest pedagang UCP — /.well-known/ucp

curl -s "https://sewapedia.id/.well-known/ucp"
curl -s "https://sewapedia.id/api/v1/ucp/products?limit=5"
curl -s -X POST "https://sewapedia.id/api/v1/ucp/quotes" \
  -H "Content-Type: application/json" \
  -d '{"productId":"<assetId>","rentalMode":"SELF_OPERATED","startDate":"2026-09-01","endDate":"2026-09-07"}'

MCP Hosted (Model Context Protocol)

Sambung ejen AI terus ke Sewapedia melalui Streamable HTTP — tiada stdio tempatan. Gunakan tool login untuk accessToken, atau Bearer JWT / X-Api-Key pada header MCP.

131 tool MCP keseluruhan (69 consumer + 62 owner). Inventori penuh: mcp-feature-list.md

Manifest MCP — /.well-known/mcp

Panduan ejen MCP — mcp-agent-guide.md

Awam (24): search_assets, check_availability, pricing_quote, catalog_feed, get_asset_detail, list_categories, get_vendor, register_account, login, create_login_link, get_login_status, ucp_discover, ucp_products, ucp_product, ucp_availability, ucp_quote, get_category_requirements, get_trust_profile, refresh_token, logout, manage_asset_inquiry, forgot_password, reset_password, health_check

Auth (45): get_profile, activate_vendor, list_my_bookings, get_booking_detail, booking_readiness, create_booking, promote_booking, initiate_payment, ucp_checkout, ucp_checkout_create, ucp_checkout_status, ucp_checkout_complete, ucp_webhook_register, cancel_booking, apply_credit, request_extension, get_pay_status, get_verification_status, upload_document, list_notifications, mark_notification_read, respond_counter_offer, manage_booking_chat, get_account_credit, list_booking_extensions, list_reviews, submit_review, assess_risk, manage_booking_condition, manage_api_keys, verify_phone_otp, report_offline_payment, manage_booking_incidents, manage_booking_dispute, get_payment_options, get_payment_invoice, update_profile, change_password, list_conversations, manage_inquiry_thread, update_booking_collateral, get_active_booking, manage_push_subscription, list_ucp_webhooks, manage_agent_webhooks

# Hermes / external agent — hosted MCP (Streamable HTTP)
curl -s "https://sewapedia.id/.well-known/mcp"

# Connect MCP client to:
https://sewapedia.id/api/v1/mcp

# 1. login tool (no auth) → store accessToken
# 2. Pass Authorization: Bearer {accessToken} on subsequent tool calls

curl -s -X POST "https://sewapedia.id/api/v1/mcp" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {accessToken}" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

Hosted MCP — Pemilik (VENDOR)

Endpoint MCP berasingan untuk pemilik aset. Memerlukan JWT VENDOR atau kunci API dengan skop read:owner / write:owner. Akaun dan kunci API CUSTOMER disekat.

62 tool MCP pemilik: 5 awam + 57 auth. Lihat docs/MCP_FEATURE_LIST.md §2.

Manifest MCP pemilik — /.well-known/mcp-owner

Panduan MCP pemilik — mcp-owner-guide.md

Pemilik awam (5): register_vendor_account, owner_login, create_login_link, get_login_status, get_vendor_theme_presets

Pemilik auth (57): list_owner_requests, get_owner_calendar, approve_booking, reject_booking, list_owner_bookings, list_my_assets, get_owner_analytics, manage_blackout, create_asset, get_owner_booking_detail, create_counter_offer, review_renter_documents, manage_booking_chat, update_asset, delete_asset, respond_extension, get_finance_summary, list_finance_entries, create_finance_entry, get_finance_entry, get_storefront, update_storefront, upload_asset_image, delete_asset_image, manage_booking_condition, get_finance_pnl, update_finance_entry, delete_finance_entry, list_owner_payouts, manage_payout_bank, confirm_offline_payment, get_renter_snapshot, get_owner_asset_detail, get_pricing_recommendation, manage_owner_commissions, upload_commission_proof, export_finance_csv, manage_finance_tax, get_finance_categories, duplicate_finance_entry, manage_acquisitions, manage_opex_recurring, manage_opex_checklist, opex_quick_add, get_portfolio_pricing, get_asset_finance, manage_repair_expenses, manage_maintenance, manage_duration_rules, manage_storefront_slug, update_vendor_type, get_seo_listings, get_chat_metrics, manage_owner_feedback, manage_booking_incidents, manage_booking_dispute, list_conversations

# Owner MCP — VENDOR role only (separate endpoint)
curl -s "https://sewapedia.id/.well-known/mcp-owner"

# Connect MCP client to:
https://sewapedia.id/api/v1/mcp-owner

# 1. owner_login tool → store vendor accessToken
# 2. Pass Authorization: Bearer {accessToken} on subsequent calls

Sampul respons

{ "success": true, "data": { ... } }
{ "success": false, "error": "message" }