{"openapi":"3.1.0","info":{"title":"ONIMA Project Radar API","version":"1.1.0","summary":"Swiss construction projects read in official documents, by trade, canton and stage.","description":"Read-only access to the Swiss construction projects of ONIMA Project Radar: 26 cantons and federal tenders, French, German and Italian, last 12 months, from the investment plan to the award. Every project carries an exact excerpt of the official document and its official link. Requests to /v1/projects count in the monthly usage; /v1/reference and /v1/account do not. Authenticate with `Authorization: Bearer onima_...` (API key from your account page) or an OAuth access token.","contact":{"email":"contact@onima.ch"}},"externalDocs":{"url":"https://onima.ch/en/docs/"},"servers":[{"url":"https://api.onima.ch"}],"security":[{"bearer":[]}],"paths":{"/v1/projects":{"get":{"operationId":"searchProjects","summary":"Search projects","description":"Newest first. Default: public projects, all stages except the award.","parameters":[{"name":"keywords","in":"query","required":false,"description":"Up to 5 precise terms describing the works, in the language of the documents (French, German, Italian), e.g. [\"chauffage\", \"Heizung\", \"riscaldamento\"]; a project matches if one term is found. The trade is a separate argument (trades). Comma-separated list.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","minLength":2,"maxLength":80}}},{"name":"trades","in":"query","required":false,"description":"Trade ids (default: all trades): entreprise_generale (general contractor), gros_oeuvre (structural work, masonry, concrete), demolition_desamiantage (demolition, asbestos removal), charpente_bois (carpentry, timber construction), toiture_etancheite (roofing, sheet metal, waterproofing), facades_isolation (facades, insulation), fenetres_portes (windows, doors, sun protection), menuiserie_interieure (interior joinery, fit-out), platrerie_peinture (plastering, painting), sols_carrelage (floor coverings, tiling), serrurerie_metallerie (metalwork, steel construction), chauffage (heating), ventilation_climatisation (ventilation, air conditioning, cooling), sanitaire (plumbing, sanitary), electricite (electrical installations), photovoltaique (photovoltaics), domotique_mcr (building automation, controls), ascenseurs (lifts, elevators), securite_incendie (fire protection), surete_securite (security systems, access control), genie_civil (civil engineering, roads, utility networks), amenagements_exterieurs (outdoor works, landscaping), equipements (operating equipment, furniture). Comma-separated list.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["entreprise_generale","gros_oeuvre","demolition_desamiantage","charpente_bois","toiture_etancheite","facades_isolation","fenetres_portes","menuiserie_interieure","platrerie_peinture","sols_carrelage","serrurerie_metallerie","chauffage","ventilation_climatisation","sanitaire","electricite","photovoltaique","domotique_mcr","ascenseurs","securite_incendie","surete_securite","genie_civil","amenagements_exterieurs","equipements"]}}},{"name":"cantons","in":"query","required":false,"description":"Canton codes (default: all of Switzerland); CH = federal projects. BE, FR and VS are bilingual. The surroundings of a city correspond to the canton or cantons of the area; a border city spans several (Basel: BS and BL, Fricktal: AG; Geneva area: GE and VD). The search has no radius in kilometres. Comma-separated list.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["AG","AI","AR","BE","BL","BS","CH","FR","GE","GL","GR","JU","LU","NE","NW","OW","SG","SH","SO","SZ","TG","TI","UR","VD","VS","ZG","ZH"]}}},{"name":"municipality","in":"query","description":"One municipality, matched exactly (accents and case ignored). The search has no radius in kilometres; a wider area corresponds to cantons.","schema":{"type":"string","minLength":2,"maxLength":80}},{"name":"stages","in":"query","required":false,"description":"Project stages read in the document, earliest first: plan_investissements (investment plan), etude_faisabilite (study), budget_ou_plan / budget_inscrit / budget_vote (budget), preavis_depose (credit requested), credit_construction (credit voted), mise_a_l_enquete (building-permit application), permis_delivre (permit granted), appel_d_offres (call for tenders), adjudication (award). Default: all except adjudication. Comma-separated list.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["plan_investissements","etude_faisabilite","budget_ou_plan","budget_inscrit","budget_vote","preavis_depose","credit_construction","mise_a_l_enquete","permis_delivre","appel_d_offres","adjudication"]}}},{"name":"include_awarded","in":"query","description":"Also returns awarded projects (adjudication). Default: false.","schema":{"type":"boolean","default":false}},{"name":"include_document_matches","in":"query","description":"With keywords: also returns projects whose official document mentions a keyword elsewhere than in the project itself (match \"document\", lower precision). Default: false.","schema":{"type":"boolean","default":false}},{"name":"project_types","in":"query","required":false,"description":"public, private or unknown owner. Default: public only. Comma-separated list.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["public","private","unknown"]}}},{"name":"published_since","in":"query","description":"Published on or after this date (YYYY-MM-DD).","schema":{"type":"string","format":"date"}},{"name":"published_until","in":"query","description":"Published on or before this date (YYYY-MM-DD).","schema":{"type":"string","format":"date"}},{"name":"page","in":"query","description":"Result page, newest first.","schema":{"type":"integer","minimum":1,"maximum":50,"default":1}},{"name":"lang","in":"query","description":"Language of the labels: fr, de or it. Default: the account's language.","schema":{"type":"string","enum":["fr","de","it"]}}],"responses":{"200":{"description":"One page of projects.","headers":{"X-Onima-Usage-Month":{"description":"Requests counted this month.","schema":{"type":"integer"}},"X-Onima-Limit-Month":{"description":"Monthly limit of the account.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResult"}}}},"401":{"description":"Missing or invalid API key or OAuth token (`unauthorized`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Account not active (`account_inactive`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid argument (`invalid_argument`); the message names it and gives the allowed values.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Monthly limit reached (`quota_exceeded`, with `resets_on`) or too many requests in a short time (`rate_limited`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/projects/{id}":{"get":{"operationId":"getProject","summary":"Get one project","description":"The project, its second excerpt (excerpt_2) when there is one, and every published stage of the same project (`stages`, empty below two stages).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^d-[0-9a-f]{16}:[a-z_]{2,40}:[0-9]{1,4}$"}},{"name":"lang","in":"query","description":"Language of the labels: fr, de or it. Default: the account's language.","schema":{"type":"string","enum":["fr","de","it"]}}],"responses":{"200":{"description":"The project.","headers":{"X-Onima-Usage-Month":{"description":"Requests counted this month.","schema":{"type":"integer"}},"X-Onima-Limit-Month":{"description":"Monthly limit of the account.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"},"usage":{"$ref":"#/components/schemas/Usage"},"today":{"type":"string","format":"date","description":"Today (Zurich), to judge deadlines."},"lang":{"type":"string","enum":["fr","de","it"]}}}}}},"401":{"description":"Missing or invalid API key or OAuth token (`unauthorized`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Account not active (`account_inactive`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No project with this id (`not_found`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid argument (`invalid_argument`); the message names it and gives the allowed values.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Monthly limit reached (`quota_exceeded`, with `resets_on`) or too many requests in a short time (`rate_limited`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/reference":{"get":{"operationId":"getReference","summary":"Trades, stages, cantons and project types","description":"The ids accepted by /v1/projects. Does not count in the monthly usage.","parameters":[{"name":"lang","in":"query","description":"Language of the labels: fr, de or it. Default: the account's language.","schema":{"type":"string","enum":["fr","de","it"]}}],"responses":{"200":{"description":"Reference lists.","content":{"application/json":{"schema":{"type":"object","properties":{"trades":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"services":{"type":"array","items":{"$ref":"#/components/schemas/Label"}}}}},"stages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["plan_investissements","etude_faisabilite","budget_ou_plan","budget_inscrit","budget_vote","preavis_depose","credit_construction","mise_a_l_enquete","permis_delivre","appel_d_offres","adjudication"]},"label":{"type":"string"},"rank":{"type":"integer"},"definition":{"type":["string","null"]},"default":{"type":"boolean","description":"Searched when `stages` is not given."}}}},"cantons":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["AG","AI","AR","BE","BL","BS","CH","FR","GE","GL","GR","JU","LU","NE","NW","OW","SG","SH","SO","SZ","TG","TI","UR","VD","VS","ZG","ZH"]},"name":{"type":"string"},"regions":{"type":"array","items":{"type":"string"}}}}},"regions":{"type":"array","description":"Regions of the account preferences.","items":{"$ref":"#/components/schemas/Label"}},"project_types":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["public","private","unknown"]},"label":{"type":"string"},"default":{"type":"boolean"}}}}}}}}},"401":{"description":"Missing or invalid API key or OAuth token (`unauthorized`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid argument (`invalid_argument`); the message names it and gives the allowed values.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/account":{"get":{"operationId":"getAccount","summary":"My plan, usage and preferences","description":"Does not count in the monthly usage.","responses":{"200":{"description":"The account.","headers":{"X-Onima-Usage-Month":{"description":"Requests counted this month.","schema":{"type":"integer"}},"X-Onima-Limit-Month":{"description":"Monthly limit of the account.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string"},"usage":{"$ref":"#/components/schemas/Usage"},"preferences":{"type":"object","properties":{"trades":{"type":"array","items":{"type":"string"}},"regions":{"type":"array","items":{"type":"string"}},"language":{"type":["string","null"]}}}}}}}},"401":{"description":"Missing or invalid API key or OAuth token (`unauthorized`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Account not active (`account_inactive`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"API key `onima_...` or OAuth access token."}},"schemas":{"Label":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"}}},"Usage":{"type":"object","properties":{"plan":{"type":"string","examples":["free"]},"month":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":"integer"},"percent":{"type":"number"},"resets_on":{"type":"string","format":"date"}}}}},"Project":{"type":"object","required":["id"],"properties":{"id":{"type":"string"},"title":{"type":"string"},"trade":{"$ref":"#/components/schemas/Label"},"service":{"$ref":"#/components/schemas/Label"},"stage":{"$ref":"#/components/schemas/Label"},"project_type":{"type":"string","enum":["public","private","unknown"]},"municipality":{"type":"string"},"canton":{"type":"string"},"published_on":{"type":"string","format":"date"},"excerpt":{"type":"string","description":"Exact quotation of the official document."},"excerpt_2":{"type":"string","description":"Second exact quotation (project detail only, when there is one)."},"amount_chf":{"type":"number"},"deadline":{"type":"string","format":"date"},"language":{"type":"string","enum":["fr","de","it"]},"deadline_passed":{"type":"boolean","description":"True when the deadline is before today (present with deadline)."},"other_trades":{"type":"array","items":{"$ref":"#/components/schemas/Label"},"description":"Other trades of the same project (absent if none)."},"match":{"type":"string","enum":["project","project_text","document"],"description":"With keywords only: where a word was found (project, its own text, or elsewhere in the same official document)."},"official_url":{"type":"string","format":"uri"},"source":{"type":"string","description":"Authority that publishes the document."},"stages":{"type":"array","items":{"type":"object","properties":{"stage":{"$ref":"#/components/schemas/Label"},"published_on":{"type":"string","format":"date"},"title":{"type":"string"},"excerpt":{"type":"string"},"official_url":{"type":"string","format":"uri"},"current":{"type":"boolean"}}}}}},"SearchResult":{"type":"object","properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"total":{"type":"integer"},"page":{"type":"integer"},"pages":{"type":"integer"},"today":{"type":"string","format":"date","description":"Today (Zurich), to judge deadlines."},"lang":{"type":"string","enum":["fr","de","it"]},"document_matches":{"type":["integer","null"],"description":"With keywords: projects left out that match only elsewhere in their document (see include_document_matches)."},"usage":{"$ref":"#/components/schemas/Usage"}}},"Error":{"type":"object","properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["unauthorized","account_inactive","not_found","invalid_argument","quota_exceeded","rate_limited","method_not_allowed","payload_too_large","internal"]},"message":{"type":"string"},"resets_on":{"type":"string","format":"date"}}}}}}}}