AutoSwap

Some marketplace APIs implement the same service type — the same endpoints with the same request and response shape. AutoSwap lets you call the type instead of one provider: APISwaps picks the best listing for every call and fails over when a provider is down.

Base URL

code
https://apiswaps.com/api/gw/v1/auto/<type-slug>/<path>

Type pages under /marketplace (look for AutoSwap routes) list the contract endpoints and the providers behind each type. Authentication, billing and limits are the same as for the marketplace gateway.

Strategy

Send X-AutoSwap-Strategy to choose how the provider is picked; every type has a default when you do not:

StrategyPicks
cheapestthe lowest price per call for that endpoint
fastestthe lowest typical latency over the last 7 days
reliablethe highest 7-day success rate
bash
curl "https://apiswaps.com/api/gw/v1/auto/geocoding/geocode?q=Berlin" \  -H "Authorization: Bearer sk-as-YOUR_KEY" \  -H "X-AutoSwap-Strategy: fastest"

Failover

If the chosen provider answers with a 5xx or does not answer at all, APISwaps retries the next best provider (up to three per call). Only the call that succeeded is billed. Requests without a body always fail over; bodies up to 1 MB are replayed to the next provider; larger bodies are sent once.

Response headers

HeaderMeaning
X-AutoSwap-Listingslug of the listing that served the call
X-AutoSwap-Strategystrategy that was applied
X-AutoSwap-Attemptshow many providers were tried
X-Request-Idid of the final attempt (matches your usage page)
Providers behind a type are checked against the shared contract, but details can still differ between them. Call a single listing (/api/gw/v1//…) when you need byte-identical behaviour.