{"openapi":"3.1.0","paths":{"/proxies":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"spec":{"type":"string"},"name":{"type":"string","minLength":1},"spec_url":{"type":"string"},"upstream":{"type":"string"}},"required":["name"],"type":"object"}}}},"responses":{"400":{"$ref":"#/components/responses/NotFound"},"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Proxy"}}},"description":"created"},"401":{"$ref":"#/components/responses/Denied"}},"tags":["proxies"],"summary":"Create a proxy","operationId":"createProxy"},"get":{"summary":"Every proxy on the account","operationId":"listProxies","tags":["proxies"],"responses":{"401":{"$ref":"#/components/responses/Denied"},"200":{"description":"the proxies","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Proxy"}}}}}}}},"/proxies/{proxy_id}/specs/{version_id}":{"get":{"tags":["specs"],"responses":{"200":{"description":"the bytes that were uploaded","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"$ref":"#/components/responses/NotFound"}},"operationId":"getSpec","summary":"One version's document, verbatim"},"parameters":[{"name":"proxy_id","in":"path","required":true,"schema":{"type":"integer"}},{"in":"path","required":true,"schema":{"type":"integer"},"name":"version_id"}]},"/proxies/{proxy_id}/token":{"parameters":[{"name":"proxy_id","required":true,"schema":{"type":"integer"},"in":"path"}],"post":{"responses":{"404":{"$ref":"#/components/responses/NotFound"},"200":{"content":{"application/json":{"schema":{"required":["report_token"],"type":"object","properties":{"report_token":{"type":"string"}}}}},"description":"the new token"}},"tags":["proxies"],"summary":"Rotate the gateway report token","operationId":"rotateReportToken"}},"/proxies/{proxy_id}/environments/{name}":{"delete":{"responses":{"204":{"description":"gone; gateways fall back to the published version"},"404":{"$ref":"#/components/responses/NotFound"}},"tags":["environments"],"operationId":"deleteEnvironment","summary":"Remove an environment"},"parameters":[{"required":true,"schema":{"type":"integer"},"in":"path","name":"proxy_id"},{"required":true,"schema":{"type":"string"},"in":"path","name":"name"}]},"/proxies/{proxy_id}/alerts":{"parameters":[{"required":true,"schema":{"type":"integer"},"in":"path","name":"proxy_id"}],"get":{"summary":"The alert rules on a proxy","operationId":"listAlerts","responses":{"200":{"description":"the rules","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Alert"},"type":"array"}}}},"404":{"$ref":"#/components/responses/NotFound"}},"tags":["alerts"]},"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["name","threshold","window_min","channel","target"],"type":"object","properties":{"target":{"type":"string"},"operation_id":{"type":"string"},"window_min":{"maximum":1440,"minimum":1,"type":"integer"},"name":{"type":"string","minLength":1},"channel":{"enum":["webhook","slack"],"type":"string"},"threshold":{"type":"integer","minimum":0}}}}}},"summary":"Add an alert rule","operationId":"createAlert","responses":{"400":{"$ref":"#/components/responses/NotFound"},"404":{"$ref":"#/components/responses/NotFound"},"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}},"description":"the rule"}},"tags":["alerts"]}},"/proxies/{proxy_id}/environments":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Environment"},"type":"array"}}},"description":"the environments"},"404":{"$ref":"#/components/responses/NotFound"}},"tags":["environments"],"operationId":"listEnvironments","summary":"Named pointers at versions"},"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"version":{"type":["integer","null"]},"name":{"pattern":"^[a-z0-9][a-z0-9_-]{0,31}$","type":"string"}},"required":["name"],"type":"object"}}},"required":true},"summary":"Point an environment at a version","operationId":"setEnvironment","tags":["environments"],"responses":{"404":{"$ref":"#/components/responses/NotFound"},"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Environment"}}},"description":"where it now points"},"400":{"$ref":"#/components/responses/NotFound"}}},"parameters":[{"in":"path","schema":{"type":"integer"},"required":true,"name":"proxy_id"}]},"/proxies/{proxy_id}/specs":{"parameters":[{"name":"proxy_id","in":"path","required":true,"schema":{"type":"integer"}}],"post":{"responses":{"201":{"description":"the new version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpecVersion"}}}},"404":{"$ref":"#/components/responses/NotFound"},"400":{"$ref":"#/components/responses/NotFound"},"200":{"description":"those bytes were already a version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpecVersion"}}}}},"tags":["specs"],"summary":"Add a spec version, from bytes or from a URL","operationId":"createSpec","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"spec":{"type":"string"}}}}}}},"get":{"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SpecVersion"}}}},"description":"the versions"},"404":{"$ref":"#/components/responses/NotFound"}},"tags":["specs"],"operationId":"listSpecs","summary":"The spec versions of a proxy"}},"/proxies/{proxy_id}/violations":{"get":{"parameters":[{"in":"query","schema":{"enum":["24h","7d","friday"],"type":"string"},"name":"since"},{"name":"operation","in":"query","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Violation"},"type":"array"}}},"description":"the violations"},"404":{"$ref":"#/components/responses/NotFound"}},"tags":["drift"],"operationId":"listViolations","summary":"Drift, one row per shape of disagreement"},"parameters":[{"name":"proxy_id","in":"path","required":true,"schema":{"type":"integer"}}]},"/proxies/{proxy_id}/diff":{"parameters":[{"schema":{"type":"integer"},"required":true,"in":"path","name":"proxy_id"}],"get":{"summary":"What changed between two versions, in contract and in reality","operationId":"getDiff","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Diff"}}},"description":"the difference"},"404":{"$ref":"#/components/responses/NotFound"}},"tags":["specs"],"parameters":[{"name":"from","in":"query","schema":{"type":"integer"}},{"schema":{"type":"integer"},"in":"query","name":"to"}]}},"/proxies/{proxy_id}/coverage":{"get":{"operationId":"getCoverage","summary":"How much of the traffic was actually weighed","tags":["drift"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Coverage"}}}},"description":"coverage per operation"},"404":{"$ref":"#/components/responses/NotFound"}}},"parameters":[{"in":"path","required":true,"schema":{"type":"integer"},"name":"proxy_id"}]},"/proxies/{proxy_id}":{"parameters":[{"in":"path","required":true,"schema":{"type":"integer"},"name":"proxy_id"}],"delete":{"operationId":"deleteProxy","summary":"Delete a proxy","responses":{"404":{"$ref":"#/components/responses/NotFound"},"204":{"description":"gone"}},"tags":["proxies"]},"patch":{"operationId":"updateProxy","summary":"Change a proxy's name, upstream or mode","tags":["proxies"],"responses":{"400":{"$ref":"#/components/responses/NotFound"},"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Proxy"}}},"description":"the proxy as it now stands"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"mode":{"enum":["observe","enforce"],"type":"string"},"upstream":{"type":"string"}}}}}}},"get":{"tags":["proxies"],"responses":{"200":{"description":"the proxy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Proxy"}}}},"404":{"$ref":"#/components/responses/NotFound"}},"summary":"One proxy","operationId":"getProxy"}},"/proxies/{proxy_id}/publish":{"parameters":[{"name":"proxy_id","required":true,"schema":{"type":"integer"},"in":"path"}],"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["version"],"properties":{"version":{"type":"integer"}}}}},"required":true},"responses":{"200":{"description":"the proxy, now serving it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Proxy"}}}},"404":{"$ref":"#/components/responses/NotFound"}},"tags":["specs"],"operationId":"publishSpec","summary":"Publish a version"}},"/proxies/{proxy_id}/alerts/{alert_id}":{"parameters":[{"in":"path","required":true,"schema":{"type":"integer"},"name":"proxy_id"},{"name":"alert_id","in":"path","schema":{"type":"integer"},"required":true}],"delete":{"operationId":"deleteAlert","summary":"Remove a rule","responses":{"404":{"$ref":"#/components/responses/NotFound"},"204":{"description":"gone"}},"tags":["alerts"]},"patch":{"operationId":"updateAlert","summary":"Silence a rule, or wake it up again","tags":["alerts"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}},"description":"the rule"},"404":{"$ref":"#/components/responses/NotFound"}},"requestBody":{"content":{"application/json":{"schema":{"properties":{"enabled":{"type":"boolean"}},"type":"object","required":["enabled"]}}},"required":true}}}},"security":[{"bearerAuth":[]}],"info":{"version":"1.0.0","description":"Everything the console does, as an API. This document is not written about the API - it IS the API: the server dispatches from it, validates every request against it, and a test walks its operations to prove the CLI can reach each one. We sell contract enforcement; our own contract being the implementation is the demo.","title":"openapi-proxy.com management API"},"components":{"responses":{"Denied":{"description":"the token is missing, wrong, or not allowed to do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"no such thing, or not yours"}},"securitySchemes":{"bearerAuth":{"description":"An account API token, issued on the account page.","type":"http","scheme":"bearer"}},"schemas":{"Proxy":{"properties":{"mode":{"type":"string","enum":["observe","enforce","mock"]},"name":{"type":"string"},"upstream":{"type":["string","null"]},"published_version":{"type":["integer","null"]},"slug":{"type":"string"},"host":{"type":"string"},"id":{"type":"integer"}},"required":["id","name","slug","mode"],"type":"object"},"Problem":{"properties":{"title":{"type":"string"},"status":{"type":"integer"},"type":{"type":"string"},"detail":{"type":"string"}},"type":"object","required":["title","status"]},"SpecVersion":{"properties":{"digest":{"type":"string"},"size":{"type":"integer"},"id":{"type":"integer"},"published":{"type":"boolean"},"operations":{"type":["integer","null"]}},"type":"object","required":["id","digest","size"]},"Alert":{"type":"object","required":["id","name","threshold","window_min","channel"],"properties":{"threshold":{"type":"integer"},"last_fired":{"type":"integer"},"name":{"type":"string"},"channel":{"enum":["webhook","slack"],"type":"string"},"window_min":{"type":"integer"},"state":{"type":"string","enum":["ok","firing"]},"operation_id":{"type":["string","null"]},"enabled":{"type":"boolean"},"id":{"type":"integer"},"target":{"type":"string"}}},"Coverage":{"required":["operation_id","total","checked"],"type":"object","properties":{"unsampled":{"type":"integer"},"total":{"type":"integer"},"skip_body":{"type":"integer"},"violations":{"type":"integer"},"skip_size":{"type":"integer"},"operation_id":{"type":"string"},"skip_ctype":{"type":"integer"},"skip_decode":{"type":"integer"},"divisor":{"type":"integer"},"updated":{"type":"integer"},"checked":{"type":"integer"},"skip_schema":{"type":"integer"}}},"Violation":{"properties":{"status":{"type":["integer","null"]},"sample_count":{"type":"integer"},"spec_version":{"type":["string","null"]},"got_type":{"type":["string","null"]},"pointer":{"type":["string","null"]},"expected":{"type":["string","null"]},"operation_id":{"type":["string","null"]},"keyword":{"type":["string","null"]},"last_seen":{"type":"integer"},"fingerprint":{"type":"string"},"count":{"type":"integer"},"first_seen":{"type":"integer"}},"required":["fingerprint","count"],"type":"object"},"Environment":{"required":["name"],"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"version":{"type":["integer","null"]}}},"Diff":{"type":"object","properties":{"removed":{"items":{"type":"string"},"type":"array"},"fixed":{"items":{"type":"string"},"type":"array"},"to":{"type":"integer"},"added":{"items":{"type":"string"},"type":"array"},"arrived":{"items":{"type":"string"},"type":"array"},"changed":{"type":"array","items":{"type":"object","properties":{"operation":{"type":"string"},"notes":{"type":"array","items":{"type":"string"}}}}},"carried":{"items":{"type":"string"},"type":"array"},"from":{"type":"integer"}}}}},"servers":[{"description":"this site","url":"/v1"}]}