{"openapi":"3.0.3","info":{"title":"Equaldex API","version":"1.0.0","description":"Free, non-commercial access to Equaldex's LGBTQ+ rights data, for researchers, journalists, educators, and developers.\n\n**The API is in beta.** If you're planning a larger project, please [reach out](https://www.equaldex.com/about) so we can discuss it.\n\n**Context matters.** LGBTQ+ rights have nuances that don't always fit a structured database. Homosexuality may be legal in a country while LGBTQ+ people are still prosecuted in certain contexts or regions. Editors often provide this context in the `description` field, so please show it where you can.\n\n**Equaldex is community-built.** Some information may be outdated, incorrect, or not yet updated for a new law.\n\n## Policies\n\n- **Attribution is required.** Link to the corresponding Equaldex region page, whose URL is included in the API response. Attribution must be visible, close to the content, and clearly identify Equaldex as the data source.\n- **Rate limiting.** Space out your requests and use cached responses when possible.\n- **Cache responses.** If you display Equaldex content when loading a page or app, cache the API responses.\n- **Refresh cached data within 60 days.** If your website, app, or service stores Equaldex data for ongoing use, refresh it at least every 60 days. This doesn't apply to static publications such as blog posts, reports, PDFs, or one-time visualizations, provided they state when the data was retrieved and include attribution.\n- **Restrictions on paid use.** You may not sell Equaldex data, charge users to access it, or display it in a paid app or subscription-based website. Free websites and apps are fine, including those supported by advertising. If your product combines free and paid features, or you're unsure, please [contact Equaldex](https://www.equaldex.com/about).\n- **Do not replicate the Equaldex service.** You may not use the API to recreate a similar service.\n\nThe Equality Index has additional terms, described on its endpoint.\n","contact":{"name":"Equaldex","url":"https://www.equaldex.com/about"},"license":{"name":"Non-commercial use, see the API policies","url":"https://www.equaldex.com/api"}},"servers":[{"url":"https://www.equaldex.com/api"}],"tags":[{"name":"Regions","description":"LGBTQ+ laws and their history for a country or subdivision."},{"name":"Equality Index","description":"Rankings of countries and subdivisions by Equality Index score."}],"paths":{"/region":{"get":{"operationId":"getRegion","tags":["Regions"],"summary":"Get LGBTQ+ rights by region","description":"Returns a region's details and Equality Index scores, plus the current status and history of each LGBTQ+ issue tracked by Equaldex.\n\nSubdivisions that inherit their parent's laws return the parent's law data. Other subdivisions return their own laws combined with the parent's federal laws.\n\nDisplay the returned `url` as your link back to Equaldex, as required by the attribution policy.\n\n## Issues\n\n`issues` is keyed by issue slug. New issues may be added over time, so don't assume this list is fixed.\n\n| ID | Slug | Name |\n|---|---|---|\n| 1 | `homosexuality` | Homosexuality |\n| 3 | `marriage` | Same-sex marriage |\n| 4 | `adoption` | Same-sex adoption |\n| 5 | `military` | Serving openly in military |\n| 6 | `discrimination` | LGBT discrimination |\n| 7 | `changing-gender` | Right to change legal gender |\n| 8 | `blood` | Blood donations by MSMs |\n| 11 | `age-of-consent` | Equal age of consent |\n| 12 | `employment-discrimination` | LGBT employment discrimination |\n| 13 | `housing-discrimination` | LGBT housing discrimination |\n| 14 | `conversion-therapy` | Conversion therapy |\n| 15 | `censorship` | Censorship of LGBT issues |\n| 16 | `non-binary-gender-recognition` | Legal recognition of non-binary gender |\n| 17 | `gender-affirming-care` | Gender-affirming care |\n| 18 | `intersex-infant-surgery` | Intersex infant surgery |\n| 19 | `hate-crime-protections` | Hate crime protections |\n| 20 | `bathroom-access` | Bathroom access |\n","security":[{"apiKey":[]}],"parameters":[{"name":"regionid","in":"query","required":true,"description":"An [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code, such as `JP`, or an [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) code for a subdivision, such as `US-CA`. Must be uppercase. Lowercase codes return a `404`.\n","schema":{"type":"string"},"example":"CA"},{"name":"callback","in":"query","required":false,"description":"A JavaScript function name for JSONP. The response is wrapped in a call to this function and served as `application/javascript`. Only letters, numbers, `_`, `.`, and `$` are kept.\n","schema":{"type":"string"}}],"responses":{"200":{"description":"The matching region.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegionResponse"},"examples":{"canada":{"summary":"A country (abridged to two issues)","value":{"regions":{"region":{"region_id":"CA","name":"Canada","ei":77.81,"ei_legal":94.37,"ei_po":61.25,"parent_id":null,"type":"Country","continent":"North America","region":"North America","slug":"canada","inherit_parent":0,"url":"https://www.equaldex.com/region/canada","region_parent":[],"issues":{"homosexuality":{"id":"1","label":"Homosexual activity","label_short":"Homosexuality","description":"Consensual sexual activity between individuals of the same sex.","current_status":{"id":1,"value":"Legal","value_formatted":"Legal","start_date_formatted":"Jun 27, 1969","description":"In 1969, Canada enacted the Criminal Law Amendment Act, 1968–69, which decriminalized private and consensual homosexual activities between adults aged 21 and over."},"history":[{"id":37,"value":"Illegal (imprisonment as punishment)","value_formatted":"Illegal (imprisonment as punishment)","start_date_formatted":"Jun 26, 1954","end_date_formatted":"Jun 26, 1969","description":"In the 1953-54 parliamentary session, the Criminal Code was amended to also criminalize homosexuality between women. The amendment took effect in the summer of 1954."}]},"changing-gender":{"id":"7","label":"Right to change legal gender","label_short":"Changing Gender","description":"Legal recognition of a change in gender by permitting a change on an individual's legal documentation.","current_status":{"id":null,"value":"varies","value_formatted":"Varies by Region","start_date_formatted":"Jul 1, 2017","description":"Since 2012, Canada has not required surgery to change gender on documents under federal jurisdiction e.g. passports. However, legal gender recognition was dependent on each province and territory’s laws until July 1, 2017, when the Northwest Territories became the last to remove the requirement for surgery for legal gender recognition.<br />\r\n<br />\r\n However, Saskatchewan, Alberta, Manitoba, Nunavut, Quebec, New Brunswick and PEI still require a letter from a healthcare professional."},"history":[{"id":22,"value":"Illegal","value_formatted":"Illegal","end_date_formatted":"Mar 31, 1978","description":"Until 1978, there was no legal gender recognition provided in Canada."}]}}}}}}}},"application/javascript":{"schema":{"type":"string"},"example":"myCallback({\"regions\": {\"region\": {\"region_id\": \"CA\", \"name\": \"Canada\"}}})"}}},"400":{"description":"The `regionid` parameter is missing, or the unsupported `region` parameter was used.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegionError"},"example":{"error":{"errors":{"message":"regionid parameter is required."}},"message":"regionid parameter is required."}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegionError"},"example":{"error":{"errors":{"message":"Invalid API key. You can access your API key from your Equaldex account settings."}},"message":"Invalid API key. You can access your API key from your Equaldex account settings."}}}},"404":{"description":"No region matches `regionid`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegionError"},"example":{"error":{"errors":{"message":"No region found."}},"message":"No region found."}}}}}}},"/equality-index":{"get":{"operationId":"getEqualityIndex","tags":["Equality Index"],"summary":"Get Equality Index rankings","description":"Returns regions ranked by Equality Index score as JSON or CSV. By default, this returns countries. Use `parent_id` to get the subdivisions of a country instead. No API key is required.\n\n## Equality Index terms\n\n- **You must credit Equaldex.** When displaying an Equality Index value, include a link to Equaldex or the [Equality Index page](https://www.equaldex.com/equality-index).\n- **Do not track the index over time** or publish comparisons of historical scores. The index reflects current laws and the most recently available public opinion data. As more public opinion data is added, scores can shift because their accuracy has improved, not because equality has necessarily progressed or regressed.\n\n## Errors\n\nThis endpoint currently returns HTTP `200` for errors and when there are no results, with a JSON object containing a `message`. Check whether the response is an array before reading it as a list.","security":[],"parameters":[{"name":"format","in":"query","required":true,"description":"The response format.","schema":{"type":"string","enum":["json","csv"]},"example":"json"},{"name":"parent_id","in":"query","required":false,"description":"An [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code, such as `US` or `AU`, to return that country's states, provinces, or other subdivisions. Letters only. Data may be limited for some subdivisions because of limited public opinion data.\n","schema":{"type":"string"},"example":"US"},{"name":"dependent_territories","in":"query","required":false,"description":"Set to `1` to include dependent territories.","schema":{"type":"string","enum":["0","1"],"default":"0"}}],"responses":{"200":{"description":"The ranked regions, or a JSON object with a `message` if the request failed or found nothing.","content":{"application/json":{"schema":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/EqualityIndexEntry"}},{"$ref":"#/components/schemas/MessageResponse"}]},"examples":{"countries":{"summary":"Countries","value":[{"region_id":"IS","name":"Iceland","ei":93,"ei_legal":96,"ei_po":90,"rank":1},{"region_id":"NO","name":"Norway","ei":89,"ei_legal":90,"ei_po":87,"rank":2}]},"subdivisions":{"summary":"Subdivisions (parent_id=US)","value":[{"region_id":"US-MA","name":"Massachusetts","ei":87,"ei_legal":95,"ei_po":78,"rank":1}]},"noResults":{"summary":"No results","value":{"message":"No results found."}},"missingFormat":{"summary":"Missing format","value":{"message":"Format parameter is missing. Please specify either 'json' or 'csv'."}},"invalidParent":{"summary":"Invalid parent_id","value":{"message":"Invalid parent_id. Only alphabetic characters are allowed."}}}},"text/csv":{"schema":{"type":"string"},"example":"\"Region ID\",Name,EI,\"EI Legal\",\"EI PO\",Rank\nIS,Iceland,93,96,90,1\nNO,Norway,89,90,87,2\n"}}}}}}},"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"query","name":"apiKey","description":"Your API key, available from your [Equaldex account settings](https://www.equaldex.com/settings)."}},"schemas":{"RegionResponse":{"type":"object","required":["regions"],"properties":{"regions":{"type":"object","required":["region"],"properties":{"region":{"$ref":"#/components/schemas/Region"}}}}},"RegionSummary":{"type":"object","properties":{"region_id":{"type":"string","description":"The region's ISO 3166-1 alpha-2 or ISO 3166-2 code.","example":"CA"},"name":{"type":"string","example":"Canada"},"ei":{"type":"number","format":"float","nullable":true,"minimum":0,"maximum":100,"description":"Overall Equality Index score, from 0 to 100. `null` if data isn't available.","example":81.74},"ei_legal":{"type":"number","format":"float","nullable":true,"minimum":0,"maximum":100,"description":"Legal Equality Index score, from 0 to 100. `null` if data isn't available.","example":96.4},"ei_po":{"type":"number","format":"float","nullable":true,"minimum":0,"maximum":100,"description":"Public Opinion Equality Index score, from 0 to 100. `null` if data isn't available.","example":67.08},"parent_id":{"type":"string","nullable":true,"description":"The parent region's ID, or `null` for a top-level region."},"type":{"type":"string","description":"The type of region.","example":"Country"},"continent":{"type":"string","nullable":true,"example":"North America"},"region":{"type":"string","nullable":true,"description":"The geographic area the region belongs to.","example":"North America"},"slug":{"type":"string","description":"The URL slug of the region's Equaldex page.","example":"canada"},"url":{"type":"string","format":"uri","description":"The region's Equaldex page. Use this link for attribution.","example":"https://www.equaldex.com/region/canada"}}},"Region":{"allOf":[{"$ref":"#/components/schemas/RegionSummary"},{"type":"object","properties":{"inherit_parent":{"type":"integer","enum":[0,1],"description":"`1` if this subdivision inherits its laws from its parent region."},"region_parent":{"description":"The parent region, or an empty array for a top-level region.","oneOf":[{"$ref":"#/components/schemas/RegionSummary"},{"$ref":"#/components/schemas/EmptyArray"}]},"issues":{"type":"object","description":"The region's issues, keyed by issue slug.","additionalProperties":{"$ref":"#/components/schemas/Issue"}}}}]},"Issue":{"type":"object","properties":{"id":{"type":"string","description":"The issue's ID.","example":"1"},"label":{"type":"string","example":"Homosexual activity"},"label_short":{"type":"string","example":"Homosexuality"},"description":{"type":"string","description":"A description of the issue itself, not of this region's law."},"current_status":{"description":"The law currently in effect, or an empty array if Equaldex has no entry for this issue.","oneOf":[{"$ref":"#/components/schemas/Status"},{"$ref":"#/components/schemas/EmptyArray"}]},"history":{"type":"array","description":"Entries that aren't currently in effect. This is omitted if there are none, and can include laws with a future start date.","items":{"$ref":"#/components/schemas/Status"}}}},"Status":{"type":"object","properties":{"id":{"type":"integer","nullable":true,"description":"The status value's ID. `null` for the special values `na`, `unknown`, `ambiguous`, and `varies`.","example":1},"value":{"type":"string","description":"The status. This can also be one of the special values `na`, `unknown`, `ambiguous`, or `varies`.","example":"Legal"},"value_formatted":{"type":"string","description":"The status for display, including any qualifier in parentheses. Special values appear as `N/A`, `Unknown`, `Ambiguous`, and `Varies by Region`.","example":"Legal"},"qualifier":{"type":"string","description":"Extra detail about the status. Omitted if there is none."},"start_date_formatted":{"type":"string","description":"The start date for display, such as `Jun 27, 1969`, `Jun 1969`, or `1969` depending on how precisely it's known. Omitted if unknown. This isn't an ISO date.","example":"Jun 27, 1969"},"end_date_formatted":{"type":"string","description":"The end date for display, in the same style as `start_date_formatted`. Omitted if the law has no end date or it's unknown."},"description":{"type":"string","description":"Editor-written context about this law. This can contain `<br />` tags followed by line breaks, and HTML entities such as `&#34;`, so handle it as HTML rather than plain text."}}},"EqualityIndexEntry":{"type":"object","properties":{"region_id":{"type":"string","description":"The region's ISO 3166-1 alpha-2 code, or its ISO 3166-2 code when using `parent_id`.","example":"IS"},"name":{"type":"string","example":"Iceland"},"ei":{"type":"integer","nullable":true,"minimum":0,"maximum":100,"description":"Overall Equality Index score, rounded. Calculated by averaging the unrounded `ei_legal` and `ei_po` values.","example":93},"ei_legal":{"type":"integer","nullable":true,"minimum":0,"maximum":100,"description":"Legal Equality Index score, rounded.","example":96},"ei_po":{"type":"integer","nullable":true,"minimum":0,"maximum":100,"description":"Public Opinion Equality Index score, rounded.","example":90},"rank":{"type":"integer","minimum":1,"description":"The region's position, based on its unrounded Equality Index score. Regions without a score are ranked last.","example":1}}},"MessageResponse":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Why no data was returned."}}},"RegionError":{"type":"object","required":["error","message"],"properties":{"error":{"type":"object","properties":{"errors":{"type":"object","properties":{"message":{"type":"string"}}}}},"message":{"type":"string","description":"The error message."}}},"EmptyArray":{"type":"array","maxItems":0,"description":"An empty array.","items":{}}}}}