↑↓ navigate open esc close
REST · OpenAPI 3.1

L'API des contrats publics, à parité complète.

Every screen on Sell to State is backed by a documented REST endpoint under /api/v1. Search, drill into a buyer or supplier, export CSV, and keep saved lists — with one API key and the same paywall the MCP server and CLI share.

# Démarrage rapide en 60 secondes

# 1. Create a key in the dashboard
#    Account → API keys
# 2. Verify it
curl -s https://staging-app.selltostate.com/api/v1/whoami \
  -H "x-api-key: sts_xxxxxxxx"

# 3. Search
curl -s "https://staging-app.selltostate.com/api/v1/search\
?scope=tenders&q=cybersecurity" \
  -H "x-api-key: sts_xxxxxxxx"

Same key works for the MCP server and the selltostate CLI.

Authentification et péage 402

Two credential types resolve to one entitlement check. Humans and backends send an API key as x-api-key: sts_…. Autonomous agents self-register over RFC 7591 DCR and present Authorization: Bearer client:<id>.

Until your subject has an active subscription, every data call returns 402 with a payment_link (humans) and a machine_payment affordance (agents can pay off-session via POST /api/v1/pay and continue without a browser). GET /api/v1/whoami is the exception — it returns 200 with active:false so you can decide to pay before doing work.

Plan caps: trial = 20 rows/page, paid = 5,000. Rate limit: 120 data calls/min per credential (faceted search has its own 300/min budget). Saved lists and saved searches are owner-scoped — they require a user x-api-key; an OIDC client token gets 403.

Points de terminaison.

All under /api/v1. Full params, schemas and "Try it" live in the reference.

GET /api/v1/whoami Authentification + droits + périmètres. Renvoie 200 active:false (et non 402) pour une clé valide mais non abonnée — à vérifier avant de consommer.
GET /api/v1/search Recherche Typesense à facettes sur un seul périmètre (tenders | buyers | suppliers | sectors) : résultats + comptages de facettes + pagination.
GET /api/v1/awards Lignes d'attribution paginées et filtrables, triées par montant. CSV disponible sur /api/v1/awards.csv.
GET /api/v1/buyers/{slug} Détail de l'acheteur (organisme) : résumé, tendance de dépenses annuelle, répartition sectorielle, principaux fournisseurs.
GET /api/v1/suppliers/{slug} Détail du fournisseur : résumé, tendance d'attributions annuelle, répartition sectorielle, principaux acheteurs.
GET /api/v1/sectors/{slug} Détail du secteur : résumé, tendance annuelle, partenaires actifs (?kind=buyers|suppliers).
GET /api/v1/tenders/{id} Une attribution unique par id numérique ou id public de l'appel d'offres, avec les attributions associées.
CRUD /api/v1/lists* Listes d'attributions enregistrées. Accès restreint au propriétaire — nécessite une x-api-key utilisateur.
CRUD /api/v1/saved-searches* Recherches enregistrées. Accès restreint au propriétaire — nécessite une x-api-key utilisateur.

Exemples.

Python — recherche d'attributions

import requests

H = {"x-api-key": "sts_xxxxxxxx"}
r = requests.get(
    "https://staging-app.selltostate.com/api/v1/search",
    params={"scope": "tenders", "q": "cybersecurity", "year_min": 2023},
    headers=H,
)
if r.status_code == 402:
    print("subscribe:", r.json()["payment_link"]); raise SystemExit
data = r.json()
print(data["found"], "matches")
for hit in data["hits"]:
    print(hit)

Node — détail acheteur + export CSV

const H = { "x-api-key": process.env.STS_API_KEY };

const buyer = await fetch(
  "https://staging-app.selltostate.com/api/v1/buyers/ministry-of-education",
  { headers: H },
).then((r) => r.json());
console.log(buyer.buyer, buyer.yearly);

// Stream the entitlement-capped CSV
const csv = await fetch(
  "https://staging-app.selltostate.com/api/v1/awards.csv?supplier=ACME",
  { headers: H },
).then((r) => r.text());

Listes enregistrées (clé utilisateur)

# Create a list, add a tender, read it back
LID=$(curl -s -X POST https://staging-app.selltostate.com/api/v1/lists \
  -H "x-api-key: sts_xxxxxxxx" -H "content-type: application/json" \
  -d '{"name":"Cyber FY24"}' | jq -r .id)

curl -s -X POST https://staging-app.selltostate.com/api/v1/lists/$LID/items \
  -H "x-api-key: sts_xxxxxxxx" -H "content-type: application/json" \
  -d '{"tender_no":"MOE000ETT24300001"}'

Obtenir une clé API.

Start a free trial, create a key under Account → API keys, and you're querying in minutes. The full reference — every parameter, response schema, and a live "Try it" — is at docs.selltostate.com.

Start for free →
S'inscrire