Sources

Introduction

A source is a database, MCP server, or API you add to swarmvia. Callers reach it at the source's endpoint, with a hard concurrency limit in front of it. Each source has an endpoint (https://‹subdomain›.swarmvia.cloud), allowed origins, caller authentication, and concurrency settings.

A source's backend decides what sits behind that limit:

  • HTTPS API (default): proxies HTTP requests to one or more allowed origins under a method-and-path policy.
  • Database: fronts a PostgreSQL or MySQL database directly and answers read-only SQL over HTTP and MCP.
  • JDBC: fronts any database with a JDBC driver (Snowflake, NetSuite, Databricks, BigQuery, SQL Server, Oracle, Trino, and more) in an isolated Java runtime for your organization.
  • MCP server: fronts a remote MCP server over HTTPS with per-tool read/write filtering.

Everything else — keys, concurrency, credentials, groups, sessions, and logs — works the same way. The backend is chosen when the source is created and cannot be changed afterwards.

Create sources under Sources in the dashboard. Each source has tabs that match this documentation:

Tab What it covers
Overview Live status, connectivity check, and how the source is reached
Connection Origins, custody, upstream credentials, origin verification
Access Access keys, session tokens, groups, policy, JWT, Cloudflare Access, IP policies
Concurrency Limit, queue, RPM, retries, response cache, async
Logs Access logs, statements, refusals, and tags
Metrics Admit, queue, and reject counts
Settings Source identity, archiving, and version history
Database / JDBC / MCP Backend-specific setup, driver or tool controls, and query limits

Hostnames

Host Role
‹source›.swarmvia.cloud Proxy traffic for that source
api.swarmvia.cloud Async job poll

Reserved labels such as api, edge, www, to, and fallback cannot be source subdomains.

Calling the source

Proxy traffic goes to your source's endpoint. The path and query string are forwarded to the selected origin after admission. All inbound X-Swarmvia-* headers are stripped before the upstream request.

curl -sS "https://your-source.swarmvia.cloud/v1/records" \
  -H "X-Swarmvia-Key: $ACCESS_KEY"

Request headers

Header Purpose
X-Swarmvia-Key Access key (required when the source requires a key)
Authorization Managed: may carry Bearer / Swarmvia access key. Pass-through: upstream credential
X-Swarmvia-Origin Exact origin when the source has multiple origins
X-Swarmvia-Cache-TTL Opt-in response cache TTL in seconds (max 300); GET/HEAD only
X-Swarmvia-Tags Access-log tags (max 64 characters)
X-Swarmvia-No-Queue Fail fast instead of queuing when set (not 0 / false)
X-Swarmvia-Queue-Timeout-Ms Per-request queue wait budget in milliseconds

The previous X-Nthpool-* names are still accepted on requests. Responses send both names.

JWT and Cloudflare Access headers are covered in Access.

Response headers

Successful (and many rejected) responses may include:

Header Meaning
x-swarmvia-remaining-slots Free concurrency slots after this admission
x-swarmvia-queue-depth Requests waiting in the source's queue
x-swarmvia-queued-ms Time spent waiting for a concurrency slot (0 if admitted immediately). Does not include network round-trip.
x-swarmvia-total-ms swarmvia + queue wait + upstream
x-swarmvia-effective-limit Current concurrency limit (fixed or learned)
Retry-After Seconds to wait on a source 429 / 504 when applicable
x-swarmvia-error On an error swarmvia answers itself, its error code (forbidden, too_many_requests, queue_timeout, …). Absent on the origin's own responses, so a caller can tell a refusal by swarmvia from one by the origin.

Status codes from the source

These are returned by swarmvia before or instead of the upstream response:

Status Typical cause
400 Invalid or missing origin selection
401 Missing, invalid, expired, or revoked key or session token; rejected JWT
403 IP policy rejection (blocked, or not allowed), custom-hostname lock, or a call the source's policy or the key does not allow
413 Payload too large
429 Queue full, fail-fast (X-Swarmvia-No-Queue), or rate gate overloaded
499 Client cancelled while waiting or in flight
501 Source is not configured yet
502 Upstream error while proxying
503 Source suspended
504 Queue wait timeout or request/lease timeout

Upstream status codes are passed through when the request was admitted and fetched successfully (or failed at the origin).

Next steps