{
 "openapi": "3.1.0",
 "info": {
  "title": "Prostitution Laws data API",
  "version": "1.0.0",
  "summary": "Prostitution and sex-work law in 196 countries, as JSON, CSV and Markdown.",
  "description": "Static, read-only files: no key, no sign-up, no rate plan; `Access-Control-Allow-Origin: *`. Regenerated on every release of the site.\n\nEvery fact cites an official source and carries the date it was checked. This describes the law; it is not legal advice. Laws change and local rules vary: check the linked official sources, and consult a lawyer before relying on it.\n\nLicence: CC BY 4.0. Source: Prostitution Laws (prostitutionlaws.org), CC BY 4.0. Credit it with a link when you reuse it.\n\nFor AI agents the same data is a remote MCP server (https://prostitutionlaws.org/mcp) and an A2A agent (https://prostitutionlaws.org/a2a); see https://prostitutionlaws.org/developers/.",
  "license": {
   "name": "CC BY 4.0",
   "url": "https://creativecommons.org/licenses/by/4.0/"
  },
  "contact": {
   "name": "Prostitution Laws",
   "url": "https://prostitutionlaws.org/about/",
   "email": "corrections@prostitutionlaws.org"
  }
 },
 "externalDocs": {
  "description": "Developer documentation",
  "url": "https://prostitutionlaws.org/developers/"
 },
 "servers": [
  {
   "url": "https://prostitutionlaws.org"
  }
 ],
 "security": [],
 "tags": [
  {
   "name": "data",
   "description": "The dataset"
  },
  {
   "name": "text",
   "description": "The same content as text"
  }
 ],
 "paths": {
  "/data/index.json": {
   "get": {
    "operationId": "getIndex",
    "tags": [
     "data"
    ],
    "summary": "All countries, one small entry each",
    "description": "Legal model, the status of each question, pending reforms, region and links for every country.",
    "responses": {
     "200": {
      "description": "The index",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/IndexDocument"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/data/countries/{iso2}.json": {
   "get": {
    "operationId": "getCountry",
    "tags": [
     "data"
    ],
    "summary": "One country's full profile",
    "description": "The legal model, every question with its summary, provisions, details and sources, legislation, pending reforms, timeline and statistics.",
    "parameters": [
     {
      "name": "iso2",
      "in": "path",
      "required": true,
      "description": "ISO 3166-1 alpha-2 code, lower case",
      "schema": {
       "type": "string",
       "pattern": "^[a-z]{2}$"
      },
      "example": "de"
     }
    ],
    "responses": {
     "200": {
      "description": "The profile",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CountryDocument"
        }
       }
      }
     },
     "404": {
      "description": "No such country"
     }
    }
   }
  },
  "/data/countries.json": {
   "get": {
    "operationId": "getAllCountries",
    "tags": [
     "data"
    ],
    "summary": "Every full profile in one file",
    "responses": {
     "200": {
      "description": "All profiles",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AllCountries"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/data/countries.csv": {
   "get": {
    "operationId": "getCsv",
    "tags": [
     "data"
    ],
    "summary": "One row per country: the model and the status of each question",
    "responses": {
     "200": {
      "description": "CSV, UTF-8",
      "content": {
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/countries/{slug}.md": {
   "get": {
    "operationId": "getCountryMarkdown",
    "tags": [
     "text"
    ],
    "summary": "One profile as Markdown, with numbered sources",
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "description": "The slug from the index (`slug`)",
      "schema": {
       "type": "string",
       "pattern": "^[a-z0-9-]+$"
      },
      "example": "germany"
     }
    ],
    "responses": {
     "200": {
      "description": "Markdown",
      "content": {
       "text/markdown": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "404": {
      "description": "No such country"
     }
    }
   }
  },
  "/llms.txt": {
   "get": {
    "operationId": "getLlmsTxt",
    "tags": [
     "text"
    ],
    "summary": "llmstxt.org index of the site and every profile",
    "responses": {
     "200": {
      "description": "Plain text",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "Country": {
    "type": "object",
    "properties": {
     "iso2": {
      "type": "string",
      "minLength": 2,
      "maxLength": 2
     },
     "name": {
      "type": "string"
     },
     "nativeName": {
      "type": "string"
     },
     "slug": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$"
     },
     "memberships": {
      "default": [],
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "EU",
        "EEA",
        "EFTA",
        "CoE",
        "Schengen"
       ]
      }
     },
     "depth": {
      "type": "string",
      "enum": [
       "profile",
       "overview"
      ]
     },
     "lastReviewed": {
      "type": "string",
      "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
     },
     "model": {
      "type": "string",
      "enum": [
       "decriminalisation",
       "regulation",
       "abolitionism",
       "neo-abolitionism",
       "prohibition"
      ]
     },
     "modelNote": {
      "type": "string",
      "minLength": 20,
      "maxLength": 600
     },
     "modelSources": {
      "minItems": 1,
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "summary": {
      "type": "string",
      "minLength": 40,
      "maxLength": 900
     },
     "subnational": {
      "default": [],
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "name": {
         "type": "string"
        },
        "model": {
         "type": "string",
         "enum": [
          "decriminalisation",
          "regulation",
          "abolitionism",
          "neo-abolitionism",
          "prohibition"
         ]
        },
        "note": {
         "type": "string"
        },
        "sources": {
         "minItems": 1,
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       },
       "required": [
        "name",
        "note",
        "sources"
       ],
       "additionalProperties": false
      }
     },
     "topics": {
      "type": "object",
      "propertyNames": {
       "type": "string",
       "enum": [
        "selling",
        "buying",
        "brothels",
        "sharedPremises",
        "procuring",
        "advertising",
        "platforms",
        "street",
        "registration",
        "tax",
        "migrants"
       ]
      },
      "additionalProperties": {
       "type": "object",
       "properties": {
        "status": {
         "type": "string",
         "enum": [
          "legal",
          "regulated",
          "restricted",
          "illegal",
          "varies"
         ]
        },
        "penalty": {
         "type": "string",
         "enum": [
          "criminal",
          "administrative",
          "none"
         ]
        },
        "summary": {
         "type": "string",
         "minLength": 20,
         "maxLength": 500
        },
        "details": {
         "type": "string"
        },
        "provisions": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "sources": {
         "minItems": 1,
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "verified": {
         "type": "string",
         "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
        },
        "confidence": {
         "default": "high",
         "type": "string",
         "enum": [
          "high",
          "medium",
          "low"
         ]
        },
        "note": {
         "type": "string"
        },
        "mapLabel": {
         "type": "string",
         "maxLength": 28
        }
       },
       "required": [
        "status",
        "summary",
        "sources",
        "verified",
        "confidence"
       ],
       "additionalProperties": false
      }
     },
     "laws": {
      "default": [],
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "sourceId": {
         "type": "string"
        },
        "titleEn": {
         "type": "string"
        },
        "relevance": {
         "type": "string",
         "minLength": 10
        },
        "provisions": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "inForce": {
         "type": "string",
         "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
        }
       },
       "required": [
        "sourceId",
        "titleEn",
        "relevance"
       ],
       "additionalProperties": false
      }
     },
     "pending": {
      "default": [],
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^[a-z0-9-]+$"
        },
        "title": {
         "type": "string"
        },
        "stage": {
         "type": "string",
         "enum": [
          "proposed",
          "consultation",
          "in-parliament",
          "adopted",
          "review",
          "stalled",
          "rejected"
         ]
        },
        "updated": {
         "type": "string",
         "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
        },
        "next": {
         "type": "object",
         "properties": {
          "date": {
           "type": "string",
           "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
          },
          "what": {
           "type": "string"
          }
         },
         "required": [
          "what"
         ],
         "additionalProperties": false
        },
        "summary": {
         "type": "string",
         "minLength": 20
        },
        "sources": {
         "minItems": 1,
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       },
       "required": [
        "id",
        "title",
        "stage",
        "updated",
        "summary",
        "sources"
       ],
       "additionalProperties": false
      }
     },
     "timeline": {
      "default": [],
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "date": {
         "type": "string",
         "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
        },
        "event": {
         "type": "string",
         "minLength": 10
        },
        "sources": {
         "minItems": 1,
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       },
       "required": [
        "date",
        "event",
        "sources"
       ],
       "additionalProperties": false
      }
     },
     "stats": {
      "default": [],
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "label": {
         "type": "string"
        },
        "value": {
         "type": "string"
        },
        "year": {
         "type": "string"
        },
        "note": {
         "type": "string"
        },
        "sources": {
         "minItems": 1,
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       },
       "required": [
        "label",
        "value",
        "year",
        "sources"
       ],
       "additionalProperties": false
      }
     },
     "sources": {
      "minItems": 1,
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^[a-z0-9-]+$"
        },
        "kind": {
         "type": "string",
         "enum": [
          "legislation",
          "case-law",
          "government",
          "parliament",
          "statistics",
          "intergovernmental",
          "academic",
          "ngo",
          "news"
         ]
        },
        "title": {
         "type": "string",
         "minLength": 3
        },
        "titleEn": {
         "type": "string"
        },
        "publisher": {
         "type": "string",
         "minLength": 2
        },
        "url": {
         "type": "string",
         "format": "uri"
        },
        "published": {
         "type": "string",
         "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
        },
        "accessed": {
         "type": "string",
         "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
        },
        "lang": {
         "type": "string",
         "minLength": 2,
         "maxLength": 5
        }
       },
       "required": [
        "id",
        "kind",
        "title",
        "publisher",
        "url",
        "accessed",
        "lang"
       ],
       "additionalProperties": false
      }
     }
    },
    "required": [
     "iso2",
     "name",
     "memberships",
     "depth",
     "lastReviewed",
     "model",
     "modelNote",
     "modelSources",
     "summary",
     "subnational",
     "topics",
     "laws",
     "pending",
     "timeline",
     "stats",
     "sources"
    ]
   },
   "IndexEntry": {
    "type": "object",
    "required": [
     "iso2",
     "name",
     "aliases",
     "slug",
     "region",
     "regionLabel",
     "model",
     "depth",
     "lastReviewed",
     "topics",
     "subnational",
     "pending",
     "url",
     "markdown",
     "json"
    ],
    "additionalProperties": false,
    "properties": {
     "iso2": {
      "type": "string",
      "description": "ISO 3166-1 alpha-2, upper case",
      "pattern": "^[A-Z]{2}$"
     },
     "name": {
      "type": "string",
      "description": "English name"
     },
     "nativeName": {
      "type": "string",
      "description": "Name in the main local language"
     },
     "aliases": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Other English names and the ISO alpha-3 code"
     },
     "slug": {
      "type": "string",
      "description": "URL slug of the profile"
     },
     "region": {
      "type": "string",
      "enum": [
       "europe",
       "north-america",
       "latin-america",
       "middle-east",
       "africa",
       "asia",
       "oceania",
       "other"
      ]
     },
     "regionLabel": {
      "type": "string",
      "description": "Region name"
     },
     "model": {
      "type": "string",
      "enum": [
       "decriminalisation",
       "regulation",
       "abolitionism",
       "neo-abolitionism",
       "prohibition"
      ],
      "description": "Legal model"
     },
     "depth": {
      "type": "string",
      "enum": [
       "profile",
       "overview"
      ],
      "description": "Full profile (all 11 questions) or overview (5 core questions)"
     },
     "lastReviewed": {
      "type": "string",
      "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
      "description": "YYYY, YYYY-MM or YYYY-MM-DD"
     },
     "topics": {
      "type": "object",
      "description": "The status of each question the entry answers",
      "propertyNames": {
       "enum": [
        "selling",
        "buying",
        "brothels",
        "sharedPremises",
        "procuring",
        "advertising",
        "platforms",
        "street",
        "registration",
        "tax",
        "migrants"
       ]
      },
      "additionalProperties": {
       "type": "string",
       "enum": [
        "legal",
        "regulated",
        "restricted",
        "illegal",
        "varies"
       ]
      }
     },
     "subnational": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Regions whose rules differ"
     },
     "pending": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "id",
        "title",
        "stage",
        "updated"
       ],
       "properties": {
        "id": {
         "type": "string"
        },
        "title": {
         "type": "string"
        },
        "stage": {
         "type": "string"
        },
        "updated": {
         "type": "string",
         "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
         "description": "YYYY, YYYY-MM or YYYY-MM-DD"
        },
        "next": {
         "type": "object",
         "properties": {
          "date": {
           "type": "string",
           "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
           "description": "YYYY, YYYY-MM or YYYY-MM-DD"
          },
          "what": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "url": {
      "type": "string",
      "description": "The HTML profile",
      "format": "uri"
     },
     "markdown": {
      "type": "string",
      "description": "The profile as Markdown",
      "format": "uri"
     },
     "json": {
      "type": "string",
      "description": "The profile as JSON (/data/countries/{iso2}.json)",
      "format": "uri"
     }
    }
   },
   "IndexDocument": {
    "type": "object",
    "required": [
     "countries",
     "generated"
    ],
    "properties": {
     "site": {
      "type": "string",
      "description": "\"Prostitution Laws\""
     },
     "url": {
      "type": "string",
      "description": "The site",
      "format": "uri"
     },
     "license": {
      "type": "string",
      "description": "CC BY 4.0"
     },
     "attribution": {
      "type": "string",
      "description": "The credit line the licence asks for"
     },
     "disclaimer": {
      "type": "string",
      "description": "Not legal advice"
     },
     "generated": {
      "type": "string",
      "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
      "description": "YYYY, YYYY-MM or YYYY-MM-DD"
     },
     "countries": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/IndexEntry"
      }
     }
    }
   },
   "CountryDocument": {
    "type": "object",
    "required": [
     "country"
    ],
    "properties": {
     "site": {
      "type": "string",
      "description": "\"Prostitution Laws\""
     },
     "url": {
      "type": "string",
      "description": "The site",
      "format": "uri"
     },
     "license": {
      "type": "string",
      "description": "CC BY 4.0"
     },
     "attribution": {
      "type": "string",
      "description": "The credit line the licence asks for"
     },
     "disclaimer": {
      "type": "string",
      "description": "Not legal advice"
     },
     "country": {
      "allOf": [
       {
        "$ref": "#/components/schemas/Country"
       }
      ],
      "properties": {
       "region": {
        "type": "string"
       },
       "regionLabel": {
        "type": "string"
       },
       "url": {
        "type": "string",
        "description": "The HTML profile",
        "format": "uri"
       },
       "markdown": {
        "type": "string",
        "description": "The profile as Markdown",
        "format": "uri"
       },
       "json": {
        "type": "string",
        "description": "The profile as JSON (/data/countries/{iso2}.json)",
        "format": "uri"
       }
      }
     }
    }
   },
   "AllCountries": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "description": "Dataset name"
     },
     "license": {
      "type": "string",
      "description": "CC BY 4.0"
     },
     "url": {
      "type": "string",
      "description": "The site",
      "format": "uri"
     },
     "generated": {
      "type": "string",
      "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
      "description": "YYYY, YYYY-MM or YYYY-MM-DD"
     },
     "countries": {
      "type": "array",
      "items": {
       "allOf": [
        {
         "$ref": "#/components/schemas/Country"
        }
       ],
       "properties": {
        "url": {
         "type": "string",
         "description": "The HTML profile",
         "format": "uri"
        }
       }
      }
     }
    }
   }
  }
 }
}