Public API
SoMerch exposes a small set of unauthenticated HTTP endpoints for crawlers, AI agents, and uptime monitors. The machine-readable description is available as an OpenAPI 3.1 document and discoverable through the RFC 9727 API catalog.
Base URL
https://somerch.coAll endpoints accept GET and respond with permissive CORS headers (Access-Control-Allow-Origin: *).
Authentication
Authenticated endpoints accept Supabase-issued JWT access tokens via Authorization: Bearer <token>. Agents can discover how to obtain a token from /.well-known/openid-configuration (OpenID Connect) or /.well-known/oauth-authorization-server (RFC 8414). The supported flow is authorization_code + PKCE. Once a token is obtained, call /api/protected/me to verify it. Resource-server metadata (RFC 9728) is published at /.well-known/oauth-protected-resource and is also advertised via the WWW-Authenticate header on 401 responses from protected endpoints. Agent registration instructions live at /auth.md (auth.md convention), so agents can auto-discover the full chain: catalog → auth.md → protected resource → authorization server → token.
Model Context Protocol (MCP)
SoMerch publishes a read-only MCP server so AI agents can query the public catalog without scraping. Discover it via the server card at /.well-known/mcp/server-card.json (SEP-1649). The server is reachable at /api/mcp using the streamable-HTTP transport (protocol version 2025-06-18) and requires no authentication. Available tools: search_products, get_product, list_categories, list_brands, list_collections, get_header_menu, and get_static_page. All accept an optional lang argument (en, de, fr).
Endpoints
GET
application/json/api/public/healthLiveness probe
Returns a small JSON document indicating the application is reachable. Suitable for uptime monitors.
GET
application/json/api/public/openapi.jsonOpenAPI 3.1 specification
Machine-readable description of the public HTTP surface.
GET
application/linkset+json/.well-known/api-catalogRFC 9727 API catalog
Linkset (RFC 9264) listing each public API surface with service-desc, service-doc and status link relations.
GET
application/json/.well-known/openid-configurationOpenID Connect discovery document
OIDC 1.0 metadata pointing at the Supabase-managed identity provider that issues SoMerch access tokens.
GET
application/json/.well-known/oauth-authorization-serverOAuth 2.0 authorization server metadata
RFC 8414 metadata describing the OAuth 2.0 endpoints exposed by the upstream identity provider.
GET
application/json/.well-known/oauth-protected-resourceOAuth 2.0 protected resource metadata
RFC 9728 metadata identifying this resource server, the authorization servers that issue tokens for it, and the supported scopes and bearer methods.
GET
text/markdown/auth.mdAuth.md — agent registration discovery
Human/agent-readable Markdown document describing supported identity types, credential types, registration URI, and claim/revocation endpoints for AI agents.
GET
application/json/.well-known/mcp/server-card.jsonMCP Server Card (SEP-1649)
Discovery document for SoMerch's Model Context Protocol server. Advertises the streamable-HTTP endpoint, capabilities, and supported protocol version so AI agents can connect automatically.
POST
application/json/api/mcpMCP server endpoint (Streamable HTTP)
Model Context Protocol server. Implements the streamable-HTTP transport. Use the server card at /.well-known/mcp/server-card.json to discover capabilities and tools (search_products, get_product, list_categories, list_brands, list_collections, get_header_menu, get_static_page).
GET
application/json/.well-known/agent-skills/index.jsonAgent Skills discovery index
Agent Skills Discovery RFC v0.2.0 index. Lists the SKILL.md artifacts SoMerch publishes (api-catalog, oauth-discovery, oauth-protected-resource, auth-md, mcp-server-card, webmcp), each with a sha256 digest.
GET
application/json/api/protected/meBearerCurrent token claims
Validates the supplied Supabase access token and returns its claims. Requires `Authorization: Bearer <jwt>`.
GET
application/xml/sitemap.xmlXML sitemap index
Sitemap index of pages, products, catalog and content sitemaps, with locale-aware hreflang alternates.
GET
application/xml/sitemap-index.xmlSitemap index redirect
Permanent redirect to /sitemap.xml, the canonical sitemap index.
GET
text/plain/llms.txtLLM index
Short index of the site curated for large language models.
GET
text/plain/llms-full.txtFull LLM corpus
Concatenated machine-readable copy of the public site content.
GET
application/json/api/public/v1/providersBearerList integration providers
Catalog of provider slugs the platform knows about (hubspot, slack, salesforce, chatgpt-mcp, zapier, generic-webhook, …) with status and supported triggers/actions.
GET
application/json/api/public/v1/connectionsBearerList integration connections for the caller's org
Sanitized view of `integration_connections` for the caller's organization. Never returns credential material.
POST
application/json/api/public/v1/connectionsBearerCreate or update an integration connection
Attach a provider connection to the caller's organization. Use the OAuth flow for hosted providers (see /oauth/{providerSlug}/authorize).
POST
application/json/api/public/v1/oauth/{providerSlug}/authorizeBearerBegin per-tenant OAuth flow
Mints a one-shot state + PKCE verifier and returns the provider's authorization URL. Redirect the user to that URL; the provider will redirect back to /api/public/v1/oauth/{providerSlug}/callback.
GET
text/html/api/public/v1/oauth/{providerSlug}/callbackOAuth callback
Public callback route the provider redirects to. Validates state, exchanges the code, and upserts the connection.
POST
application/json/api/public/v1/actions/{actionKey}BearerInvoke a central action
Central action dispatcher. Supports `Idempotency-Key` header. Built-in actions: system.ping, orders.list, orders.get, quotes.submit, hubspot.contacts.upsert, slack.messages.post, salesforce.leads.create, …
GET
application/json/api/public/v1/eventsBearerList integration events
Normalized event log for the caller's organization. Filter by provider slug, event type, correlation id, resource, or time range.
GET
application/json/api/public/v1/webhooksBearerList outgoing webhook subscriptions
Enumerate the org's outgoing webhook subscriptions.
POST
application/json/api/public/v1/webhooksBearerCreate an outgoing webhook subscription
Register a URL to receive HMAC-SHA256 signed deliveries for the requested event types. The signing secret is returned once at creation time.
GET
application/json/api/public/v1/jobsBearerList queued integration jobs
Inspect background jobs (webhook deliveries, retries, dead-letter).
GET
application/json/api/public/v1/audit-logsBearerSanitized integration audit logs
Cross-provider audit trail. Credentials, tokens, and PII are redacted server-side before writing.
POST
application/json/api/public/webhooks/{providerSlug}/{connectionId}Incoming provider webhook
Verifies the provider signature, normalizes the payload, enqueues a job, and returns 2xx. Configure this URL on the provider side.
POST
application/json/api/public/cron/dispatch-webhooksCron: dispatch pending outgoing webhooks
Secret-gated cron entry point. Called by pg_cron on a fixed schedule to drain `integration_webhook_deliveries` (exponential backoff, dead-letter). Not for direct external use.
Discovery
- /.well-known/api-catalog — RFC 9727 catalog (application/linkset+json)
- /api/public/openapi.json — OpenAPI 3.1 specification
- /sitemap.xml — XML sitemap
- /.well-known/mcp/server-card.json — MCP server card (SEP-1649)
- /.well-known/agent-skills/index.json — Agent Skills discovery index (RFC v0.2.0)
- /.well-known/agent-skills/webmcp/SKILL.md — In-page WebMCP tool surface (navigator.modelContext)