Sarvex V1 API
Control-plane API for Sarvex V1 — the authenticated surface behind the merchant console, the operator tooling, and the store-connector ingest endpoint.
Scope of this document
This specification covers the control plane and the sync-plane ingest edge
(/connector/*). It deliberately does not specify the serving plane
(the UCP edge: profile, discovery, pricing, availability, shipping, and the three
checkout-session operations). Those endpoints conform to the published UCP / Google
UCP-checkout schemas — they are governed by an external specification, not by
Sarvex’s own contract, and are versioned against the UCP spec version recorded per
merchant in conformance_record. See the backend architecture document, Domains 4–5.
Conventions (true for every operation)
- Tenant scoping:
merchant_idis never a path or query parameter. It is read from the authenticated principal’s token claim server-side, so a token can only ever reach its own tenant’s data. Operators select a merchant via theX-Operate-Asheader (see security schemes), which is audit-logged. - Wire format: all request and response bodies are JSON with snake_case field names.
- List envelope: all collection responses are
{ "data": [...], "page": { "cursor": string|null, "has_more": boolean } }. - Error envelope: all non-2xx responses are
{ "error": { "code": string, "message": string, "details": object|null } }. - Pagination: cursor-based via the
cursorquery parameter;limitcaps page size. - Idempotency: all mutating operations accept an
Idempotency-Keyheader; replays return the original result. - Money: integer minor units (cents) plus an ISO-4217
currencyfield; never floats. - Timestamps: RFC 3339 / ISO 8601 UTC strings.
https://api.sarvex.example.com/v1https://api.staging.sarvex.example.com/v1Contact
Marketing-site contact-form ingest (sarvex.example.com). Not merchant/operator-authenticated — gated by a shared bearer token issued to the website only, scoped to this one endpoint.
Auth
Resolving the principal from the externally-issued, Sarvex-verified JWT. No login/logout — authentication is handled by the IdP (OAuth 2.0 authorization-code flow).
Account
Merchant profile and Google-required business facts.
- GETGet the merchant account
/account - PATCHUpdate account profile or business facts
/account - GETList team members
/account/members - POSTInvite a team member (owner self-serve)
/account/members
Stores
The stores a merchant operates (merchant → store → connector). One in V1, modelled for many.
- GETList the merchant's stores
/stores - POSTCreate a store under the merchant
/stores - GETGet a store
/stores/{store_id} - GETGet a store's business profile
/stores/{store_id}/profile - PUTSet a store's business profile
/stores/{store_id}/profile
Payment
Per-store payment-handler configuration (instruments vs handlers model).
- GETGet a store's payment-handler configuration
/stores/{store_id}/payment-config - PUTSet a store's payment-handler configuration
/stores/{store_id}/payment-config
Connectors
Store connection, pairing, health. A connector belongs to a store.
- GETList connected stores
/connectors - POSTBegin connecting a store
/stores/{store_id}/connectors/pairing - GETGet a connector
/connectors/{connector_id} - DELETEDisconnect a store
/connectors/{connector_id} - POSTTrigger a full reconciliation pull
/connectors/{connector_id}/resync
Connector Ingest
Sync-plane-served endpoints bundled here by convention. These /connector/* paths
are actually served by the sync plane (not the control plane); they are included in this
spec for operational convenience (a single auth token reaches both control and sync).
Covered operations: plugin-facing ingest (HMAC-signed). Covers both plugin roles: change
signals (push) and the profile fetch the plugin serves at the merchant origin (Role 2).
The plugin does not proxy the UCP API — the profile’s endpoint points directly at Sarvex.
- POSTComplete pairing and provision store credentials
/connectors/pairing/complete - POSTReceive a change signal from the store plugin
/connector/signals - POSTPlugin heartbeat
/connector/heartbeat - GETFetch the merchant's current UCP profile (for the plugin to serve at /.well-known/ucp)
/connector/profile
Catalog
Readiness score, products, attribute mappings.
- GETGet the current Agent Readiness Score
/stores/{store_id}/catalog/readiness - GETList products with per-product readiness
/stores/{store_id}/catalog/products - GETGet product detail with issues and attribute mappings
/stores/{store_id}/catalog/products/{sku} - POSTTrigger a catalog audit
/stores/{store_id}/catalog/audits
Tasks
The task spine — every actionable item, by owner.
- GETList tasks (the task spine)
/tasks - GETGet a task with its typed drill-in payload
/tasks/{task_id} - POSTResolve a task
/tasks/{task_id}/resolve
Remediation
Rule-based fixes and reversible write-backs.
- GETList available remediations
/stores/{store_id}/catalog/remediations - POSTApply rule-based remediations in a batch
/stores/{store_id}/catalog/remediations/apply - POSTRevert a write-back to its prior value
/stores/{store_id}/catalog/write-backs/{write_back_id}/revert
Validation
Pre-validation, sandbox, and production validation status.
- GETGet the merchant's validation status
/stores/{store_id}/validation/status - GETList validation runs (conformance records)
/stores/{store_id}/validation/runs - POSTTrigger a pre-validation run
/stores/{store_id}/validation/runs
UCP Presence
Read-only view of the hosted profile and manifest.
- GETGet the hosted UCP presence summary
/stores/{store_id}/presence - GETGet the raw served manifest
/stores/{store_id}/presence/manifest - POSTForce a serving-cache rebuild
/stores/{store_id}/presence/rebuild
Orders
Orders created via Google checkout and their status sync.
- GETList orders created via Google checkout
/stores/{store_id}/orders - GETGet an order with its sync state
/stores/{store_id}/orders/{order_id}
Health
Post-go-live integration health and consistency.
- GETGet a store's overall health
/stores/{store_id}/health - GETList consistency findings across sources
/stores/{store_id}/health/consistency - GETEndpoint-health timeline — probe outcomes and status-check transitions
/stores/{store_id}/health/history - GETList this merchant's endpoint-health alerts
/alerts - PATCHAcknowledge or resolve an alert
/alerts/{alert_id}
Checkout Sessions
Checkout Escalation Console — session projection, event timeline, and diagnosis for stalled or escalated checkouts.
- GETList checkout sessions
/checkout-sessions - GETList sessions currently in progress
/checkout-sessions/live - GETGet a checkout session, including its diagnosis
/checkout-sessions/{checkout_session_id} - GETGet a checkout session's event timeline
/checkout-sessions/{checkout_session_id}/timeline
Ledger
Lost Revenue Ledger — classified, priced, per-store visibility into checkouts that didn’t convert.
- GETMonthly rollup, one entry per currency
/ledger/summary - GETList lost-checkout entries
/ledger/entries - PATCHChange an entry's triage status
/ledger/entries/{entry_id}
Channel Dashboard
Agent sessionization, discovery→checkout funnel, and web-baseline comparison for the merchant’s UCP-powered checkout channel — what it’s earning and how it compares to the web channel.
- GETKPI summary, per surface and combined, with prior-period deltas
/channel/summary - GETDiscovery-to-checkout funnel stage counts and derived rates
/channel/funnel - GETDaily time series of funnel/revenue counts
/channel/daily - GETAgentic revenue vs. the merchant's web-channel baseline
/channel/comparison
Agent Behavior Insights
- GETCapabilities agents requested that the merchant doesn't declare
/insights/capability_gaps - GETTop products by agent request count
/insights/product_demand - GETNegotiation outcomes, failure breakdown, and payment-handler mismatch detail
/insights/negotiation
Billing
Plan, usage, and Stripe-hosted management links.
- GETGet plan, status, and usage
/billing - POSTCreate a Stripe Customer Portal link
/billing/portal-link - POSTStripe webhook receiver
/billing/webhooks/stripe
Notifications
Channel preferences for the fixed V1 alert set.
- GETGet notification channel preferences
/notifications/preferences - PUTReplace notification channel preferences
/notifications/preferences
Activation
The store’s own UCP activation lifecycle — profile served, capabilities declared,
signatures verifying, checkout working. Sarvex and the merchant only: nothing in
this lifecycle references feeds or any other agent surface. active is the terminal success state and is complete on its own; a
store may sit there with zero surfaces enrolled indefinitely.
- GETGet the store's UCP activation state
/stores/{store_id}/activation - POSTRun conformance verification against the store's own endpoints
/stores/{store_id}/activation/verify
Surfaces
Agent-surface enrollment — per-store, zero-to-many, registry-driven. A surface is
declared as a descriptor (requirements, prerequisite checks, artifacts, external
steps, verification signal); adding one is a descriptor plus its adapters, never a
change to these endpoints. The only dependency on activation runs one way:
enrollment cannot progress past available unless the store is active. Surfaces
never gate each other.
- GETList the surface registry
/surfaces - GETList the store's enrollment state on every registered surface
/stores/{store_id}/surfaces - POSTBegin enrollment on a surface
/stores/{store_id}/surfaces/{surface_id}/enroll - POSTRe-evaluate a surface's prerequisites on demand
/stores/{store_id}/surfaces/{surface_id}/prerequisites/evaluate - POSTRecord that the merchant completed the surface's external steps
/stores/{store_id}/surfaces/{surface_id}/submit - PUTReplace the merchant-supplied configuration for a surface
/stores/{store_id}/surfaces/{surface_id}/config - DELETEWithdraw enrollment from a surface
/stores/{store_id}/surfaces/{surface_id}
Journey
The per-store onboarding state machine.
- GETGet the store's current journey state
/stores/{store_id}/journey - GETSubscribe to live journey updates for the store
/stores/{store_id}/journey/stream
Operator
Operator-only provisioning (create merchant, invite member, create store), board, enter-as-merchant, audit, manual-step capture.
- GETList merchants
/operator/merchants - POSTProvision a new merchant (tenant)
/operator/merchants - POSTInvite a member to a merchant (authorize an email)
/operator/merchants/{merchant_id}/members - POSTCreate a store under a merchant
/operator/merchants/{merchant_id}/stores - GETList all merchants by journey state (the board)
/operator/board - GETList captured manual steps
/operator/manual-steps - POSTCapture a manual step (the Phase B automation backlog)
/operator/manual-steps - GETRead the operator audit log
/operator/audit-log - PUTReclassify a manual step
/operator/manual-steps/{step_id}/retag - POSTReclassify many manual steps at once
/operator/manual-steps/bulk-retag - GETMerchants per engagement stage over time
/operator/timeline-metrics - POSTRun an operator action as a merchant (audit-logged)
/operator/act-on-behalf