{"openapi":"3.1.0","info":{"title":"Leya Legal Research API","description":"Search and cite primary legal sources from Latin America — statutes, decrees, congressional initiatives, court rulings and official gazettes.\n\nBuilt for LLM agents: every result carries a stable `document_id`, a source attribution, and corpus-freshness metadata, so answers can be cited rather than recalled.\n\nAuthenticate with `Authorization: Bearer leya_live_...`. Get a key at https://leya.lawyer/api-keys. Machine-readable errors and rate-limit headers are documented at https://leya.lawyer/docs/api.\n\nCalls are prepaid in credits; a new account gets 1,000 free. Search costs 3, a document read 1, and `/v1/me`, `/v1/credits`, `/v1/sources` and `/v1/filters` are free. Running out returns 402 `insufficient_credits`, which is **not** retryable — waiting clears a rate limit but never an empty balance. Buy more at `POST /v1/credits/purchase` over the Machine Payments Protocol (https://mpp.dev), settled in stablecoins on Tempo.","version":"0.1.122","contact":{"email":"hello@leya.lawyer","url":"https://leya.lawyer/docs/api"},"x-guidance":"Leya answers questions about primary Latin American law with citable sources, currently Guatemala and the Dominican Republic. Start with GET /v1/search (free filters at GET /v1/filters, datasets at GET /v1/sources), then GET /v1/documents/{document_id} for the full text of anything you intend to quote, and GET /v1/documents/{document_id}/citation for a citation string you must use verbatim. Never complete a partial citation from memory. A null effective_from means the date is unknown, not that the document is in force today. Separately, GET /v1/parcels/{ccc} returns a Guatemalan cadastral parcel and the protected areas, watersheds and archaeological sites it intersects; it carries no owner or title data, and a 404 there usually means the area was never surveyed rather than that the parcel does not exist. Pay per call with no account via the 402 challenge, or use a bearer API key from https://leya.lawyer/api-keys."},"components":{"schemas":{"CitationOut":{"properties":{"document_id":{"type":"string","title":"Document Id"},"source_id":{"type":"string","title":"Source Id"},"title":{"type":"string","title":"Title"},"formatted":{"type":"string","title":"Formatted","description":"Citation string for inline use. Use verbatim; never complete missing parts from memory."},"style":{"type":"string","title":"Style","description":"'latam-standard' = full `<Tipo> <Número>, <Órgano> (<Año>)` form. 'title-fallback' = the corpus lacks the metadata for the full form, so this is title + id and the citation is partial."},"document_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Type"},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Number"},"issuing_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuing Body"},"year":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Year"}},"type":"object","required":["document_id","source_id","title","formatted","style"],"title":"CitationOut"},"CorpusStatusResponse":{"properties":{"sources":{"items":{"$ref":"#/components/schemas/SourceStatus"},"type":"array","title":"Sources"},"countries":{"items":{"$ref":"#/components/schemas/CountryCoverage"},"type":"array","title":"Countries"},"total_documents":{"type":"integer","title":"Total Documents"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["sources","countries","total_documents","updated_at"],"title":"CorpusStatusResponse"},"CorrectionIn":{"properties":{"field":{"type":"string","title":"Field"},"value":{"title":"Value"}},"type":"object","required":["field"],"title":"CorrectionIn"},"CountryCoverage":{"properties":{"country":{"type":"string","title":"Country"},"name":{"type":"string","title":"Name"},"sources_registered":{"type":"integer","title":"Sources Registered"},"sources_with_documents":{"type":"integer","title":"Sources With Documents"},"total_documents":{"type":"integer","title":"Total Documents"},"earliest_document":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Earliest Document"},"latest_document":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Latest Document"}},"type":"object","required":["country","name","sources_registered","sources_with_documents","total_documents"],"title":"CountryCoverage"},"CoverageOut":{"properties":{"department_id":{"type":"integer","title":"Department Id"},"department_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Department Name"},"department_parcel_count":{"type":"integer","title":"Department Parcel Count"},"municipality_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Municipality Code"},"municipality_parcel_count":{"type":"integer","title":"Municipality Parcel Count","default":0},"municipality_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Municipality Name"},"municipality_declared":{"type":"boolean","title":"Municipality Declared","description":"RIC has formally declared cadastral process here. Independent of whether parcels are published: the two RIC layers disagree.","default":false},"survey_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Survey State"},"surveyed":{"type":"boolean","title":"Surveyed"}},"type":"object","required":["department_id","department_parcel_count","surveyed"],"title":"CoverageOut","description":"What RIC publishes for the area a cadastral code falls in.\n\n`surveyed` is false for most of Guatemala. A parcel absent from an unsurveyed\nmunicipality says nothing about whether the property exists."},"CreateJobRequest":{"properties":{"task_id":{"type":"string","title":"Task Id"},"cron_expression":{"type":"string","maxLength":64,"minLength":1,"title":"Cron Expression"},"timezone":{"type":"string","title":"Timezone","default":"UTC"},"recipients":{"items":{"type":"string"},"type":"array","title":"Recipients"},"slack_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slack Webhook Url"}},"type":"object","required":["task_id","cron_expression"],"title":"CreateJobRequest"},"CreateKeyRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Name"},"test":{"type":"boolean","title":"Test","description":"Mint a leya_test_ key instead of leya_live_.","default":false}},"type":"object","title":"CreateKeyRequest"},"CreateTaskRequest":{"properties":{"title":{"type":"string","maxLength":255,"minLength":1,"title":"Title"},"prompt":{"type":"string","minLength":1,"title":"Prompt"}},"type":"object","required":["title","prompt"],"title":"CreateTaskRequest"},"CreatedKeyOut":{"properties":{"id":{"type":"string","title":"Id"},"prefix":{"type":"string","title":"Prefix","description":"First 12 chars of the raw key, for identification."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At"},"revoked":{"type":"boolean","title":"Revoked"},"requests_last_30d":{"type":"integer","title":"Requests Last 30D"},"secret":{"type":"string","title":"Secret","description":"The full key. Returned once at creation and never again."}},"type":"object","required":["id","prefix","created_at","revoked","requests_last_30d","secret"],"title":"CreatedKeyOut"},"CreditsDetailOut":{"properties":{"balance":{"type":"integer","title":"Balance"},"enabled":{"type":"boolean","title":"Enabled"},"credit_price_usd":{"type":"number","title":"Credit Price Usd","description":"Cash price of one credit."},"costs":{"additionalProperties":{"type":"integer"},"type":"object","title":"Costs","description":"Credits charged per endpoint, keyed by route template."},"recent":{"items":{"$ref":"#/components/schemas/LedgerEntryOut"},"type":"array","title":"Recent"}},"type":"object","required":["balance","enabled","credit_price_usd","costs","recent"],"title":"CreditsDetailOut"},"FilterValueOut":{"properties":{"value":{"type":"string","title":"Value","description":"Pass verbatim to the matching search filter."},"document_count":{"type":"integer","title":"Document Count"}},"type":"object","required":["value","document_count"],"title":"FilterValueOut"},"FiltersOut":{"properties":{"countries":{"items":{"$ref":"#/components/schemas/FilterValueOut"},"type":"array","title":"Countries"},"document_types":{"items":{"$ref":"#/components/schemas/FilterValueOut"},"type":"array","title":"Document Types"},"legal_areas":{"items":{"$ref":"#/components/schemas/FilterValueOut"},"type":"array","title":"Legal Areas"}},"type":"object","required":["countries","document_types","legal_areas"],"title":"FiltersOut","description":"The accepted values for the corpus-defined search filters.\n\nSearch rejects a value that isn't in the corpus with a 422 listing the valid\nones. Reading this endpoint first avoids the round trip."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthOut":{"properties":{"status":{"type":"string","title":"Status"},"version":{"type":"string","title":"Version"}},"type":"object","required":["status","version"],"title":"HealthOut"},"JobDetail":{"properties":{"id":{"type":"string","title":"Id"},"task_id":{"type":"string","title":"Task Id"},"task_title":{"type":"string","title":"Task Title"},"cron_expression":{"type":"string","title":"Cron Expression"},"timezone":{"type":"string","title":"Timezone"},"recipients":{"items":{"type":"string"},"type":"array","title":"Recipients"},"slack_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slack Webhook Url"},"paused_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused At"},"last_triggered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Triggered At"},"next_fire_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Fire At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"recent_triggers":{"items":{"$ref":"#/components/schemas/JobTriggerOut"},"type":"array","title":"Recent Triggers"}},"type":"object","required":["id","task_id","task_title","cron_expression","timezone","created_at","updated_at"],"title":"JobDetail"},"JobSummary":{"properties":{"id":{"type":"string","title":"Id"},"task_id":{"type":"string","title":"Task Id"},"task_title":{"type":"string","title":"Task Title"},"cron_expression":{"type":"string","title":"Cron Expression"},"timezone":{"type":"string","title":"Timezone"},"recipients":{"items":{"type":"string"},"type":"array","title":"Recipients"},"slack_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slack Webhook Url"},"paused_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused At"},"last_triggered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Triggered At"},"next_fire_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Fire At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","task_id","task_title","cron_expression","timezone","created_at","updated_at"],"title":"JobSummary"},"JobTriggerOut":{"properties":{"id":{"type":"string","title":"Id"},"task_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Run Id"},"triggered_at":{"type":"string","format":"date-time","title":"Triggered At"},"success":{"type":"boolean","title":"Success"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["id","triggered_at","success"],"title":"JobTriggerOut"},"KeyOut":{"properties":{"id":{"type":"string","title":"Id"},"prefix":{"type":"string","title":"Prefix","description":"First 12 chars of the raw key, for identification."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At"},"revoked":{"type":"boolean","title":"Revoked"},"requests_last_30d":{"type":"integer","title":"Requests Last 30D"}},"type":"object","required":["id","prefix","created_at","revoked","requests_last_30d"],"title":"KeyOut"},"LedgerEntryOut":{"properties":{"delta":{"type":"integer","title":"Delta","description":"Positive for a grant or purchase, negative for a charge."},"balance_after":{"type":"integer","title":"Balance After"},"reason":{"type":"string","title":"Reason"},"endpoint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Endpoint"},"payment_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Method"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["delta","balance_after","reason","created_at"],"title":"LedgerEntryOut"},"LedgerRow":{"properties":{"delta":{"type":"integer","title":"Delta"},"balance_after":{"type":"integer","title":"Balance After"},"reason":{"type":"string","title":"Reason"},"endpoint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Endpoint"},"payment_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Method"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["delta","balance_after","reason","created_at"],"title":"LedgerRow"},"MeOut":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"key_prefix":{"type":"string","title":"Key Prefix"},"key_type":{"type":"string","title":"Key Type","description":"'live' or 'test'."},"rate_limits":{"$ref":"#/components/schemas/RateLimitOut"},"requests_last_30d":{"type":"integer","title":"Requests Last 30D","description":"Requests this key has made in the trailing 30 days."},"credits":{"$ref":"#/components/schemas/leya__api__v1__schemas__CreditsOut"}},"type":"object","required":["user_id","email","key_prefix","key_type","rate_limits","requests_last_30d","credits"],"title":"MeOut"},"OverlayOut":{"properties":{"layer":{"type":"string","title":"Layer"},"feature_id":{"type":"string","title":"Feature Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"attributes":{"additionalProperties":true,"type":"object","title":"Attributes","description":"Source attributes verbatim. Units differ per layer and are not normalized."},"overlap_m2":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Overlap M2"},"overlap_fraction":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Overlap Fraction","description":"Share of the parcel covered, 0-1. Near zero means a boundary graze."}},"type":"object","required":["layer","feature_id","attributes"],"title":"OverlayOut","description":"A territorial designation intersecting a parcel."},"ParcelDetailOut":{"properties":{"parcel":{"$ref":"#/components/schemas/ParcelOut"},"coverage":{"$ref":"#/components/schemas/CoverageOut"},"overlaps":{"items":{"$ref":"#/components/schemas/OverlayOut"},"type":"array","title":"Overlaps","default":[]}},"type":"object","required":["parcel","coverage"],"title":"ParcelDetailOut"},"ParcelOut":{"properties":{"ccc":{"type":"string","title":"Ccc","description":"RIC código catastral, e.g. '18-04-09-03971'."},"department_id":{"type":"integer","title":"Department Id"},"municipality_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Municipality Code"},"phase":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Phase","description":"RIC's survey phase code, passed through unchanged."},"area_m2":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Area M2","description":"RIC's own area figure, not recomputed from the geometry."},"perimeter_m":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Perimeter M"},"fetched_at":{"type":"string","format":"date-time","title":"Fetched At","description":"When this snapshot was taken. Cadastral data changes; this is not a live read."},"geometry":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Geometry","description":"GeoJSON, EPSG:4326."}},"type":"object","required":["ccc","department_id","fetched_at"],"title":"ParcelOut","description":"One cadastral parcel from RIC.\n\nThis is cadastral geometry, not a title record. `ccc` is RIC's código\ncatastral and does not map to the Registro General de la Propiedad's\nfinca/folio/libro. Nothing here identifies an owner or an encumbrance."},"ParcelPage":{"properties":{"parcels":{"items":{"$ref":"#/components/schemas/ParcelOut"},"type":"array","title":"Parcels"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["parcels"],"title":"ParcelPage"},"QueueItem":{"properties":{"doc_id":{"type":"string","title":"Doc Id","description":"Storage id; use it to fetch and to correct."},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"source_id":{"type":"string","title":"Source Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"score":{"type":"integer","title":"Score","description":"Higher means less trustworthy."},"reasons":{"items":{"type":"string"},"type":"array","title":"Reasons"},"effective_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective From"},"effective_from_basis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective From Basis"},"body_length":{"type":"integer","title":"Body Length","default":0},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"}},"type":"object","required":["doc_id","source_id","score","reasons"],"title":"QueueItem"},"QueueOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/QueueItem"},"type":"array","title":"Items"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["items","limit","offset","has_more"],"title":"QueueOut"},"RateLimitOut":{"properties":{"search_per_minute":{"type":"integer","title":"Search Per Minute"},"reads_per_minute":{"type":"integer","title":"Reads Per Minute"}},"type":"object","required":["search_per_minute","reads_per_minute"],"title":"RateLimitOut"},"ReviewIn":{"properties":{"corrections":{"items":{"$ref":"#/components/schemas/CorrectionIn"},"type":"array","title":"Corrections"},"status":{"type":"string","title":"Status","description":"one of ['pending', 'verified', 'flagged']","default":"verified"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","title":"ReviewIn"},"ReviewOut":{"properties":{"doc_id":{"type":"string","title":"Doc Id"},"written":{"type":"integer","title":"Written"},"status":{"type":"string","title":"Status"},"reviewer":{"type":"string","title":"Reviewer"},"reindex_hint":{"type":"string","title":"Reindex Hint"}},"type":"object","required":["doc_id","written","status","reviewer","reindex_hint"],"title":"ReviewOut"},"SearchResponse":{"properties":{"query":{"type":"string","title":"Query"},"results":{"items":{"$ref":"#/components/schemas/SearchResult"},"type":"array","title":"Results"},"result_count":{"type":"integer","title":"Result Count","description":"Number of results in this response."},"limit":{"type":"integer","title":"Limit","description":"The effective limit applied (max 50)."},"has_more":{"type":"boolean","title":"Has More","description":"True when further pages exist. Determined by a lookahead row, not guessed from a full page."},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Pass back as `cursor` to fetch the next page, with q and every filter unchanged. Null on the last page. Opaque — do not parse."},"truncated":{"type":"boolean","title":"Truncated","description":"Deprecated alias for `has_more`; use `has_more`."}},"type":"object","required":["query","results","result_count","limit","has_more","truncated"],"title":"SearchResponse"},"SearchResult":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"Stable id. Pass verbatim to /v1/documents/{document_id}."},"source_id":{"type":"string","title":"Source Id"},"title":{"type":"string","title":"Title"},"snippet":{"type":"string","title":"Snippet","description":"Excerpt, truncated to ~500 chars. Not the full text.","default":""},"score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Score"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"effective_from":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective From","description":"Date the document entered into force. Null means the corpus does not know it — not that the document is undated."},"effective_to":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective To"},"effective_from_basis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective From Basis","description":"How effective_from was obtained: 'stated_date' (the document names the date), 'on_publication', or 'days_after_publication' (derived from the document's own vigencia clause plus its publication date). Null when effective_from is null."},"publication_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Publication Date","description":"Official gazette publication date as recorded by the source. Free-form because sources are inconsistent; use effective_from when present."},"source_last_indexed":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Source Last Indexed","description":"When this result's source was last ingested. Corpus freshness."}},"type":"object","required":["document_id","source_id","title"],"title":"SearchResult"},"SourceOut":{"properties":{"id":{"type":"string","title":"Id"},"country":{"type":"string","title":"Country"},"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"languages":{"items":{"type":"string"},"type":"array","title":"Languages"}},"type":"object","required":["id","country","name","type","languages"],"title":"SourceOut"},"SourceStatus":{"properties":{"source_id":{"type":"string","title":"Source Id"},"name":{"type":"string","title":"Name"},"country":{"type":"string","title":"Country"},"document_type":{"type":"string","title":"Document Type"},"update_cadence":{"type":"string","title":"Update Cadence"},"last_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run At"},"last_run_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Run Status"},"docs_added_last_run":{"type":"integer","title":"Docs Added Last Run"},"total_indexed":{"type":"integer","title":"Total Indexed"},"earliest_document":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Earliest Document"},"latest_document":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Latest Document"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"}},"type":"object","required":["source_id","name","country","document_type","update_cadence","last_run_at","last_run_status","docs_added_last_run","total_indexed","last_error"],"title":"SourceStatus"},"SourceSummary":{"properties":{"id":{"type":"string","title":"Id"},"country":{"type":"string","title":"Country"},"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"languages":{"items":{"type":"string"},"type":"array","title":"Languages"}},"type":"object","required":["id","country","name","type","languages"],"title":"SourceSummary"},"TaskCitation":{"properties":{"source_id":{"type":"string","title":"Source Id"},"document_id":{"type":"string","title":"Document Id"},"title":{"type":"string","title":"Title"},"section":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Section"},"page":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"}},"type":"object","required":["source_id","document_id","title"],"title":"TaskCitation"},"TaskDetail":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"prompt":{"type":"string","title":"Prompt"},"archived_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Archived At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"latest_run":{"anyOf":[{"$ref":"#/components/schemas/TaskRunOut"},{"type":"null"}]},"runs":{"items":{"$ref":"#/components/schemas/TaskRunOut"},"type":"array","title":"Runs"}},"type":"object","required":["id","title","prompt","created_at","updated_at"],"title":"TaskDetail"},"TaskRunOut":{"properties":{"id":{"type":"string","title":"Id"},"task_id":{"type":"string","title":"Task Id"},"status":{"type":"string","enum":["queued","running","succeeded","failed"],"title":"Status"},"triggered_by":{"type":"string","title":"Triggered By"},"result_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Text"},"citations":{"items":{"$ref":"#/components/schemas/TaskCitation"},"type":"array","title":"Citations"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","task_id","status","triggered_by","created_at"],"title":"TaskRunOut"},"TaskSummary":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"prompt":{"type":"string","title":"Prompt"},"archived_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Archived At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"latest_run":{"anyOf":[{"$ref":"#/components/schemas/TaskRunOut"},{"type":"null"}]}},"type":"object","required":["id","title","prompt","created_at","updated_at"],"title":"TaskSummary"},"UpdateJobRequest":{"properties":{"cron_expression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cron Expression"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"recipients":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Recipients"},"slack_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slack Webhook Url"},"paused":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Paused"}},"type":"object","title":"UpdateJobRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"leya__api__admin__router__DocumentOut":{"properties":{"doc_id":{"type":"string","title":"Doc Id"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"source_id":{"type":"string","title":"Source Id"},"fields":{"additionalProperties":true,"type":"object","title":"Fields","description":"Current values of correctable fields."},"corrections":{"additionalProperties":true,"type":"object","title":"Corrections","description":"Reviewer overrides already in force."},"score":{"type":"integer","title":"Score"},"reasons":{"items":{"type":"string"},"type":"array","title":"Reasons"},"full_text":{"type":"string","title":"Full Text"},"body_length":{"type":"integer","title":"Body Length"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"correctable":{"items":{"type":"string"},"type":"array","title":"Correctable"}},"type":"object","required":["doc_id","source_id","fields","score","reasons","full_text","body_length"],"title":"DocumentOut"},"leya__api__billing__router__CreditsOut":{"properties":{"balance":{"type":"integer","title":"Balance"},"enabled":{"type":"boolean","title":"Enabled","description":"Whether calls are charged in this environment."},"credit_price_usd":{"type":"number","title":"Credit Price Usd"},"costs":{"additionalProperties":{"type":"integer"},"type":"object","title":"Costs"},"recent":{"items":{"$ref":"#/components/schemas/LedgerRow"},"type":"array","title":"Recent"},"purchase_available":{"type":"boolean","title":"Purchase Available"},"purchase_url":{"type":"string","title":"Purchase Url"},"min_credits":{"type":"integer","title":"Min Credits"},"max_credits":{"type":"integer","title":"Max Credits"}},"type":"object","required":["balance","enabled","credit_price_usd","costs","recent","purchase_available","purchase_url","min_credits","max_credits"],"title":"CreditsOut"},"leya__api__v1__schemas__CreditsOut":{"properties":{"enabled":{"type":"boolean","title":"Enabled","description":"Whether calls are charged at all in this environment."},"balance":{"type":"integer","title":"Balance","description":"Credits remaining."},"top_up_url":{"type":"string","title":"Top Up Url"}},"type":"object","required":["enabled","balance","top_up_url"],"title":"CreditsOut","description":"Prepaid balance for the account behind this key."},"leya__api__v1__schemas__DocumentOut":{"properties":{"document_id":{"type":"string","title":"Document Id"},"source_id":{"type":"string","title":"Source Id"},"title":{"type":"string","title":"Title"},"body_markdown":{"type":"string","title":"Body Markdown","description":"Full document text. Empty string when the document is indexed but its text has not been extracted yet — check `has_body` to tell that apart from a genuinely empty document."},"has_body":{"type":"boolean","title":"Has Body","description":"False when body_markdown is empty because text is missing."},"body_length":{"type":"integer","title":"Body Length","description":"Character count of body_markdown."},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"document_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Type"},"issuing_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuing Body"},"publication_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Publication Date"},"effective_from":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective From"},"effective_from_basis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective From Basis"},"effective_to":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective To"}},"type":"object","required":["document_id","source_id","title","body_markdown","has_body","body_length"],"title":"DocumentOut"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"An API key from https://leya.lawyer/api-keys, sent as `Authorization: Bearer leya_live_...`. Paid routes accept a Machine Payments Protocol credential in the same header instead."}}},"x-service-info":{"categories":["data","search"],"docs":{"apiReference":"https://leya.lawyer/docs/api","homepage":"https://leya.lawyer","llms":"https://leya.lawyer/llms-full.txt"}},"paths":{"/v1/sources":{"get":{"tags":["corpus"],"summary":"List Sources","operationId":"list_sources_v1_sources_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SourceOut"},"type":"array","title":"Response List Sources V1 Sources Get"}}}}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}]}},"/v1/search":{"get":{"tags":["corpus"],"summary":"Search","operationId":"search_v1_search_get","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Natural-language or keyword query.","title":"Q"},"description":"Natural-language or keyword query."},{"name":"country","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO-2, e.g. 'GT'.","title":"Country"},"description":"ISO-2, e.g. 'GT'."},{"name":"source_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"}},{"name":"document_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Type"}},{"name":"as_of","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Restrict to docs in effect on this date.","title":"As Of"},"description":"Restrict to docs in effect on this date."},{"name":"legal_area","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Area"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":10,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`next_cursor` from the previous page. Opaque.","title":"Cursor"},"description":"`next_cursor` from the previous page. Opaque."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"Payment Required. Settle the WWW-Authenticate: Payment challenge and retry, or send a bearer API key."}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.030000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","payTo":"0xB9dBf93DF02749068899F3A267A40356B4eaed03","price":"0.030000"}}],"offers":[{"intent":"charge","method":"tempo","amount":"30000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"3 credit(s) per request"}]}}},"/v1/filters":{"get":{"tags":["corpus"],"summary":"List Filters","description":"Enumerate the values the search filters actually accept.\n\nWithout this, `document_type=decretos` (plural, wrong) is indistinguishable\nfrom a jurisdiction we don't cover: both return an empty result set.","operationId":"list_filters_v1_filters_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersOut"}}}}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}]}},"/v1/documents/{document_id}":{"get":{"tags":["corpus"],"summary":"Get Document","operationId":"get_document_v1_documents__document_id__get","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/leya__api__v1__schemas__DocumentOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"Payment Required. Settle the WWW-Authenticate: Payment challenge and retry, or send a bearer API key."}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","payTo":"0xB9dBf93DF02749068899F3A267A40356B4eaed03","price":"0.010000"}}],"offers":[{"intent":"charge","method":"tempo","amount":"10000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"1 credit(s) per request"}]}}},"/v1/documents/{document_id}/citation":{"get":{"tags":["corpus"],"summary":"Get Citation","operationId":"get_citation_v1_documents__document_id__citation_get","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CitationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"Payment Required. Settle the WWW-Authenticate: Payment challenge and retry, or send a bearer API key."}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","payTo":"0xB9dBf93DF02749068899F3A267A40356B4eaed03","price":"0.010000"}}],"offers":[{"intent":"charge","method":"tempo","amount":"10000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"1 credit(s) per request"}]}}},"/v1/me":{"get":{"tags":["corpus"],"summary":"Me","description":"Key introspection, including the budget a client should pace itself against.","operationId":"me_v1_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeOut"}}}}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}]}},"/v1/credits":{"get":{"tags":["corpus"],"summary":"Prepaid balance, the price list, and recent ledger activity.","description":"Free to call, deliberately.\n\nAn account that has run out of credits still has to be able to see why and\nwhat a top-up costs; charging for that would be a trap.","operationId":"credits_detail_v1_credits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsDetailOut"}}}}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}]}},"/v1/parcels/{ccc}":{"get":{"tags":["cadastre"],"summary":"Look up one cadastral parcel by its RIC código catastral.","operationId":"get_parcel_v1_parcels__ccc__get","parameters":[{"name":"ccc","in":"path","required":true,"schema":{"type":"string","title":"Ccc"}},{"name":"include_geometry","in":"query","required":false,"schema":{"type":"boolean","description":"Return the parcel polygon as GeoJSON.","default":true,"title":"Include Geometry"},"description":"Return the parcel polygon as GeoJSON."},{"name":"include_overlaps","in":"query","required":false,"schema":{"type":"boolean","description":"Return protected areas, watersheds and other layers it intersects.","default":true,"title":"Include Overlaps"},"description":"Return protected areas, watersheds and other layers it intersects."},{"name":"layer","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Restrict overlaps to these layer keys. See GET /v1/cadastre/layers.","title":"Layer"},"description":"Restrict overlaps to these layer keys. See GET /v1/cadastre/layers."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParcelDetailOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"Payment Required. Settle the WWW-Authenticate: Payment challenge and retry, or send a bearer API key."}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.020000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","payTo":"0xB9dBf93DF02749068899F3A267A40356B4eaed03","price":"0.020000"}}],"offers":[{"intent":"charge","method":"tempo","amount":"20000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"2 credit(s) per request"}]}}},"/v1/parcels":{"get":{"tags":["cadastre"],"summary":"List parcels in cadastral-code order.","operationId":"list_parcels_v1_parcels_get","parameters":[{"name":"department_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":22,"minimum":1},{"type":"null"}],"description":"Guatemalan department code.","title":"Department Id"},"description":"Guatemalan department code."},{"name":"municipality_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1,"maxLength":4},{"type":"null"}],"title":"Municipality Code"}},{"name":"include_geometry","in":"query","required":false,"schema":{"type":"boolean","description":"Polygons are large; off by default.","default":false,"title":"Include Geometry"},"description":"Polygons are large; off by default."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`next_cursor` from the previous page. Opaque.","title":"Cursor"},"description":"`next_cursor` from the previous page. Opaque."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParcelPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"Payment Required. Settle the WWW-Authenticate: Payment challenge and retry, or send a bearer API key."}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.020000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","payTo":"0xB9dBf93DF02749068899F3A267A40356B4eaed03","price":"0.020000"}}],"offers":[{"intent":"charge","method":"tempo","amount":"20000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"2 credit(s) per request"}]}}},"/v1/cadastre/coverage":{"get":{"tags":["cadastre"],"summary":"Which departments RIC has actually surveyed.","description":"Per-department parcel counts.\n\nRead this before concluding anything from an empty parcel result: RIC's\ncadastre is concentrated in the north and east and is effectively absent from\nthe capital and the western highlands.","operationId":"coverage_v1_cadastre_coverage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Coverage V1 Cadastre Coverage Get"}}}},"402":{"description":"Payment Required. Settle the WWW-Authenticate: Payment challenge and retry, or send a bearer API key."}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.010000"},"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20c000000000000000000000b9537d11c60e8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","payTo":"0xB9dBf93DF02749068899F3A267A40356B4eaed03","price":"0.010000"}}],"offers":[{"intent":"charge","method":"tempo","amount":"10000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"1 credit(s) per request"}]}}},"/v1/cadastre/layers":{"get":{"tags":["cadastre"],"summary":"The overlay layers a parcel can be compared against.","operationId":"layers_v1_cadastre_layers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Layers V1 Cadastre Layers Get"}}}}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}]}},"/v1/credits/purchase":{"post":{"tags":["billing"],"summary":"Buy credits with a stablecoin payment (Machine Payments Protocol).","description":"Pay per the MPP flow: unpaid calls get a 402 challenge, paid retries get credits.\n\nThe first request returns `402` with a `WWW-Authenticate: Payment` challenge\nnaming the price. The caller settles it and retries with\n`Authorization: Payment <credential>`, and the credits land on the account\nnamed by the API key header.","operationId":"purchase_credits_v1_credits_purchase_post","parameters":[{"name":"credits","in":"query","required":true,"schema":{"type":"integer","maximum":1000000,"minimum":100,"description":"How many credits to buy.","title":"Credits"},"description":"How many credits to buy."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-leya-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Leya-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKeyAuth":[]},{"HTTPBearer":[]}]}},"/api/corpus/status":{"get":{"tags":["corpus"],"summary":"Corpus Status","operationId":"corpus_status_api_corpus_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorpusStatusResponse"}}}}},"security":[]}},"/health":{"get":{"tags":["corpus"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthOut"}}}}},"security":[]}}},"servers":[{"url":"https://api.leya.lawyer"}]}