{"openapi":"3.1.0","info":{"title":"Content Negotiation API","version":"1.0.0","description":"HTTP content negotiation as an API. The parse endpoint reads an Accept, Accept-Language, Accept-Encoding or Accept-Charset header — with quality (q) values and parameters — into a clean list ranked by the client's preference. The negotiate endpoint takes that header plus the list of values your server can actually serve and returns the single best match, along with the full ranked result and the entry that matched each candidate. It applies the correct rules for each kind: media-type type and subtype wildcards (text/*, */*), RFC 4647 language-range matching (a request for en matches your en-US, and en-US falls back to en), and exact matching with a * wildcard for encodings and charsets — and a q=0 entry correctly rejects a value. Everything runs locally and deterministically, so it is instant and private. Ideal for i18n middleware and locale selection, API versioning by media type, response-format and compression selection, CDNs, proxies and edge functions. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This negotiates HTTP headers; to validate or decompose a single BCP-47 language tag use a BCP-47 API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/negotiate-api","description":"oanor gateway"}],"tags":[{"name":"Negotiate"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/negotiate":{"get":{"operationId":"get_v1_negotiate","tags":["Negotiate"],"summary":"Negotiate the best match","description":"","parameters":[{"name":"header","in":"query","required":true,"description":"The Accept-style header","schema":{"type":"string"},"example":"en-US,en;q=0.9,fr;q=0.5"},{"name":"supported","in":"query","required":true,"description":"Values you can serve (list or comma/space separated)","schema":{"type":"string"},"example":"fr,en,de"},{"name":"type","in":"query","required":false,"description":"language (default), mediatype, encoding, charset or generic","schema":{"type":"string"},"example":"language"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"best":"en","type":"language","matches":[{"value":"en","quality":1,"matched_by":"en-US"},{"value":"fr","quality":0.5,"matched_by":"fr"},{"value":"de","quality":0}],"acceptable":true,"best_quality":1},"meta":{"timestamp":"2026-06-03T09:25:04.239Z","request_id":"eef6fe82-3295-4168-9dae-38e047bb6c56"},"status":"ok","message":"Negotiate the best match","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/parse":{"get":{"operationId":"get_v1_parse","tags":["Negotiate"],"summary":"Parse an Accept header","description":"","parameters":[{"name":"header","in":"query","required":true,"description":"An Accept-style header value","schema":{"type":"string"},"example":"en-US,en;q=0.9,fr;q=0.5"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"count":3,"accepted":[{"value":"en-US","quality":1},{"value":"en","quality":0.9},{"value":"fr","quality":0.5}]},"meta":{"timestamp":"2026-06-03T09:25:04.350Z","request_id":"cd534777-af73-4ad1-8e93-ac660d3946e2"},"status":"ok","message":"Parse an Accept header","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"name":"Content Negotiation API","notes":"Languages use RFC 4647 prefix matching; media types honour type and subtype wildcards. When nothing is acceptable, best is null. This negotiates HTTP headers — to validate or decompose a single BCP-47 language tag use a BCP-47 API. Nothing is stored.","version":"v1","endpoints":[{"path":"/v1/parse","params":{"header":"an Accept-style header value (required)"},"returns":"the accepted values ranked by quality"},{"path":"/v1/negotiate","params":{"type":"language (default), mediatype, encoding, charset or generic","header":"the Accept-style header (required)","supported":"the values you can serve — list or comma/space separated (required)"},"returns":"the best match and the full ranked result"},{"path":"/v1/meta","params":[],"returns":"this document"}],"description":"HTTP content negotiation. The parse endpoint reads an Accept, Accept-Language, Accept-Encoding or Accept-Charset header — with quality (q) values and parameters — into a clean list ranked by preference. The negotiate endpoint takes that header plus the list of values your server can actually serve and returns the single best match (and the full ranked result), using the right rules for each kind: media-type wildcards (text/*, */*), RFC 4647 language-range matching (en matches en-US, and en-US falls back to en), and exact matching with * for encodings and charsets. A q=0 entry correctly rejects a value. Pure local, no key."},"meta":{"timestamp":"2026-06-03T09:25:04.463Z","request_id":"94e5a587-12c3-41bf-b2e2-5c8671f134f5"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":2335,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":385,"monthly_call_quota":11850,"rps_limit":8,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":2375,"monthly_call_quota":169500,"rps_limit":20,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":6175,"monthly_call_quota":890000,"rps_limit":50,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/negotiate-api"}