开发者与 AI Agent 文档
Sewapedia 公开 REST API,供移动、Web 与 AI Agent 集成。
规范与发现
代理 OpenAPI(API)— GET /api/v1/openapi/agent
代理 OpenAPI(静态)— openapi-agent.yaml
凭证层级:Tier 0 = 代理规范(无需认证);Tier 1 = JWT/API 密钥用于 REST;Tier 2 = 合作伙伴密钥获取完整规范。见 docs/PUBLIC_OPENAPI_GUIDE.md。
MCP Agent 指南 — mcp-agent-guide.md
MCP 工具清单 — mcp-feature-list.md(131 个工具)
业主 MCP 指南 — mcp-owner-guide.md
REST 操作指南:GitHub 仓库中的 docs/API_AGENT_GUIDE.md。
JWT 认证
使用邮箱/密码登录;在受保护路由上使用 accessToken 作为 Bearer。
curl -s -X POST "https://sewapedia.id/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{"email":"customer@rentapp.local","password":"password123"}'请求头:Authorization: Bearer {accessToken}。通过 POST /api/v1/auth/refresh 刷新。
示例 — 列出资产
curl -s "https://sewapedia.id/api/v1/assets?limit=5"
搜索与可用性
GET /assets 仅发现候选资产,不保证日期可用。预订前务必调用 GET /assets/{slug}/availability?from=&to=。
curl -s "https://sewapedia.id/api/v1/assets/{slug}/availability?from=2026-09-01&to=2026-09-07"预订流程(租户)
1. 发现 — GET /assets 或 GET /catalog/feed
2. 可用性 — 对每个候选调用 GET /assets/{slug}/availability
2. 创建计划 — POST /bookings → PENDING_VERIFICATION
3. 验证与 promote — 上传,GET /verification/status,POST /bookings/{id}/promote
4. 等待业主批准 — 轮询 GET /bookings/{id}/readiness
5. 支付(需人工)— POST /pay → redirectUrl,轮询 GET /pay/status
Universal Commerce Protocol (UCP)
UCP 兼容门面,用于智能体商务。清单位于 /.well-known/ucp;REST 端点位于 /api/v1/ucp/*。映射至现有目录、报价与结账流程 — 无 AP2 授权凭证。
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(Model Context Protocol)
AI 代理可通过 Streamable HTTP 直接连接 Sewapedia,无需本地 stdio。使用 login 工具获取 accessToken,或在 MCP HTTP 头中传递 Bearer JWT / X-Api-Key。
共 131 个 MCP 工具(69 消费者 + 62 店主)。完整清单:mcp-feature-list.md
MCP Agent 指南 — mcp-agent-guide.md
公开(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
认证(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":{}}'托管 MCP — 业主(VENDOR)
资产业主的独立 MCP 端点。需要 VENDOR JWT 或带有 read:owner / write:owner 范围的 API 密钥。CUSTOMER 账户和 API 密钥被阻止。
62 个店主 MCP 工具:5 公开 + 57 认证。见 docs/MCP_FEATURE_LIST.md §2。
业主 MCP 清单 — /.well-known/mcp-owner
业主 MCP 指南 — mcp-owner-guide.md
店主公开(5): register_vendor_account, owner_login, create_login_link, get_login_status, get_vendor_theme_presets
店主认证(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响应封装
{ "success": true, "data": { ... } }
{ "success": false, "error": "message" }