{
  "openapi": "3.0.1",
  "info": {
    "title": "Peru Jurisprudencia Nacional Scraper - Court Rulings, Text/PDFs",
    "description": "Scrape Peru's Poder Judicial jurisprudencia portal: 686,572 Supreme and Superior Court rulings (casaciones, sentencias, autos) by topic, court, district, year or date, with summary, keywords, full text and PDFs. Export CSV, Excel, JSON, XML. No login or API key.",
    "version": "0.1",
    "x-build-id": "4GUijDBQjxwxuiKbG"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/recordsdata~peru-jurisprudencia-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-recordsdata-peru-jurisprudencia-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/recordsdata~peru-jurisprudencia-scraper/runs": {
      "post": {
        "operationId": "runs-sync-recordsdata-peru-jurisprudencia-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/recordsdata~peru-jurisprudencia-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-recordsdata-peru-jurisprudencia-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "searchTexts": {
            "title": "Search terms (full text)",
            "type": "array",
            "description": "Words searched inside the full content of the resolutions. Each term runs as its own search and results are merged and de-duplicated. The portal needs every word of one term to appear (\"minería ilegal\" matches rulings with both words).",
            "items": {
              "type": "string"
            }
          },
          "topics": {
            "title": "Topics",
            "type": "array",
            "description": "Ready-made topic searches. Each topic expands to several Spanish legal terms (with and without accents) and the results are merged. Combine freely with the search terms.",
            "items": {
              "type": "string",
              "enum": [
                "mining",
                "environment",
                "corruption",
                "money-laundering",
                "drugs",
                "gender-violence",
                "family-law",
                "labor",
                "pensions",
                "public-procurement",
                "tax",
                "property",
                "consumer",
                "arbitration",
                "human-rights",
                "indigenous",
                "energy",
                "financial",
                "traffic",
                "sexual-crimes",
                "criminal-violent",
                "telecom",
                "education",
                "health"
              ],
              "enumTitles": [
                "Mining and mining concessions",
                "Environment and environmental crimes",
                "Corruption of public officials",
                "Money laundering",
                "Drug trafficking",
                "Gender and family violence",
                "Family law (alimony, custody, divorce)",
                "Labor and employment",
                "Pensions and social security",
                "Public procurement and contracts",
                "Tax and customs",
                "Property, land and evictions",
                "Consumer protection and competition",
                "Arbitration",
                "Human rights and constitutional remedies",
                "Indigenous peoples and prior consultation",
                "Hydrocarbons and energy",
                "Banking, credit and mortgages",
                "Traffic accidents and civil liability",
                "Sexual offenses and minors",
                "Homicide, robbery and organized crime",
                "Telecommunications and technology",
                "Education and universities",
                "Health and medical liability"
              ]
            }
          },
          "includeAccentVariants": {
            "title": "Also search without accents",
            "type": "boolean",
            "description": "The portal is accent-sensitive (\"minería\" and \"mineria\" return different rulings). Keep this on to search both spellings of every term.",
            "default": true
          },
          "keywords": {
            "title": "Official keywords (exact)",
            "type": "array",
            "description": "Keep only rulings tagged with one of these keywords, exactly as the portal publishes them (see the keywords column of any result). Unknown keywords are skipped with a warning.",
            "items": {
              "type": "string"
            }
          },
          "caseNumbers": {
            "title": "Case numbers",
            "type": "array",
            "description": "Resolution or case number, or its first digits (for example 001190-2019 or 00911-2023). Prefix match.",
            "items": {
              "type": "string"
            }
          },
          "claimContains": {
            "title": "Claim or offense contains",
            "type": "string",
            "description": "Keep only rulings whose claim or offense (pretensión o delito) contains this text, for example \"lavado\" or \"alimentos\". Applied to the rows after they are read, so combine it with a search term or topic."
          },
          "courts": {
            "title": "Courts",
            "type": "array",
            "description": "Corte Suprema (Supreme Court, about 210,895 searchable rulings) and/or Cortes Superiores (district appeal courts, about 94,632).",
            "items": {
              "type": "string",
              "enum": [
                "supreme",
                "superior"
              ],
              "enumTitles": [
                "Corte Suprema (Supreme Court)",
                "Cortes Superiores (Superior Courts)"
              ]
            },
            "default": [
              "supreme"
            ]
          },
          "districts": {
            "title": "Judicial districts (Superior Courts)",
            "type": "array",
            "description": "Only for Cortes Superiores. Leave empty for all 34 districts.",
            "items": {
              "type": "string",
              "enum": [
                "Amazonas",
                "Ancash",
                "Apurimac",
                "Arequipa",
                "Ayacucho",
                "Cajamarca",
                "Callao",
                "Cañete",
                "Cusco",
                "Del Santa",
                "Huancavelica",
                "Huánuco",
                "Huaura",
                "Ica",
                "Junin",
                "La Libertad",
                "Lambayeque",
                "Lima",
                "Lima Este",
                "Lima Norte",
                "Lima Sur",
                "Loreto",
                "Madre de Dios",
                "Moquegua",
                "Pasco",
                "Piura",
                "Puente Piedra - Ventanilla",
                "Puno",
                "San Martin",
                "Selva Central",
                "Sullana",
                "Tacna",
                "Tumbes",
                "Ucayali"
              ]
            }
          },
          "specialties": {
            "title": "Specialties",
            "type": "array",
            "description": "Legal specialty of the court. Derecho Constitucional exists only in Superior Courts of some districts.",
            "items": {
              "type": "string",
              "enum": [
                "Civil",
                "Comercial",
                "Constitucional",
                "Contencioso Adm. Laboral",
                "Contencioso Adm. Previsional",
                "Contencioso Administrativo",
                "Derecho Constitucional",
                "Familia Civil",
                "Familia Penal",
                "Familia Tutelar",
                "Laboral",
                "Penal",
                "Revisión de Procedimiento Coactivo"
              ]
            }
          },
          "chambers": {
            "title": "Chamber or court names",
            "type": "array",
            "description": "Sala or juzgado name, for example \"Sala Penal Permanente\" or \"Sala Civil Transitoria\". Needs a specialty (and a district for Superior Courts). The Court directory mode lists every valid name.",
            "items": {
              "type": "string"
            }
          },
          "appealTypes": {
            "title": "Appeal types (Supreme Court)",
            "type": "array",
            "description": "Type of recourse such as Casación, Amparo or Recurso de Nulidad. Supreme Court only.",
            "items": {
              "type": "string",
              "enum": [
                "Acción Popular",
                "Amparo",
                "Apelación",
                "Casación",
                "Casación Previsional",
                "Competencia",
                "Consulta",
                "Extradición Activa",
                "Extradición Pasiva",
                "Inhibición",
                "Medida Cautelar de Proceso de Amparo",
                "Nulidad",
                "Queja",
                "Queja NCPP",
                "Querella",
                "Recurso de Nulidad",
                "Recurso de Queja Directa",
                "Recurso de Queja Excepcional",
                "Recurso de Queja Ordinaria",
                "Recusación",
                "Revisión de Medida Disciplinaria",
                "Revisión de Sentencia"
              ]
            }
          },
          "resolutionTypes": {
            "title": "Resolution types",
            "type": "array",
            "description": "Auto, Ejecutoria Suprema (final Supreme ruling) or Sentencia de Vista (appeal judgment). Applied to the rows after they are read.",
            "items": {
              "type": "string",
              "enum": [
                "Auto",
                "Ejecutoria Suprema",
                "Sentencia de Vista"
              ]
            }
          },
          "years": {
            "title": "Years",
            "type": "array",
            "description": "Year of the resolution. Leave empty for all years. One search runs per year.",
            "items": {
              "type": "string",
              "enum": [
                "2026",
                "2025",
                "2024",
                "2023",
                "2022",
                "2021",
                "2020",
                "2019",
                "2018",
                "2017",
                "2016",
                "2015",
                "2014",
                "2013",
                "2012",
                "2011",
                "2010",
                "2009",
                "2008",
                "2007",
                "2006",
                "2005",
                "2004",
                "2003",
                "2002",
                "2001",
                "2000",
                "1999",
                "1998",
                "1982"
              ]
            }
          },
          "includeAutos": {
            "title": "Include \"autos calificatorios\"",
            "type": "boolean",
            "description": "Also return procedural orders (autos calificatorios). Adds hundreds of thousands of Supreme Court rows.",
            "default": false
          },
          "dateFrom": {
            "title": "Resolution date from",
            "type": "string",
            "description": "Earliest resolution date (YYYY-MM-DD). The portal has no date filter, so the Actor locates the date window with a page search when sorted by date."
          },
          "dateTo": {
            "title": "Resolution date to",
            "type": "string",
            "description": "Latest resolution date (YYYY-MM-DD)."
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "date",
              "caseNumber",
              "year",
              "claim",
              "resolutionType",
              "chamber"
            ],
            "type": "string",
            "description": "Column used to order the portal results.",
            "default": "date"
          },
          "sortDirection": {
            "title": "Sort direction",
            "enum": [
              "DESC",
              "ASC"
            ],
            "type": "string",
            "description": "Newest first is the default.",
            "default": "DESC"
          },
          "maxItems": {
            "title": "Max Items",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Maximum number of rulings (or facet and directory rows) to return. Free users: limited to 10 items (preview). Paid users: up to 1,000,000. Each ruling is billed as one resolution record.",
            "default": 10
          },
          "onlyNew": {
            "title": "Only new results (monitor mode)",
            "type": "boolean",
            "description": "Only new results: skip every ruling this same search already returned in an earlier run, so scheduled runs return just the rulings you have not seen, and you are not charged for skipped ones. Max Items then means N new rulings. Applies to the Resolutions mode only.",
            "default": false
          },
          "stateKey": {
            "title": "Monitor name (optional)",
            "type": "string",
            "description": "Optional label to keep several independent monitors for the same search. Runs that share the same search filters and the same name share one list of seen rulings. Leave empty to use the default monitor.",
            "default": ""
          },
          "resetSeen": {
            "title": "Reset seen records",
            "type": "boolean",
            "description": "Clear the stored list of already-seen rulings for this search and monitor name before the run, so every matching ruling counts as new again.",
            "default": false
          },
          "includePdfText": {
            "title": "Add full text of each ruling",
            "type": "boolean",
            "description": "Downloads the signed PDF of every ruling and adds its full text, page count and the labeled caption lines (case, plaintiff, defendant, subject). Billed as an extra event per ruling with a text layer.",
            "default": false
          },
          "savePdfFiles": {
            "title": "Save the original PDFs",
            "type": "boolean",
            "description": "Stores each PDF in the run key-value store and adds a download link. Billed as an extra event per saved file.",
            "default": false
          },
          "maxTextChars": {
            "title": "Max characters of full text per ruling",
            "minimum": 1000,
            "maximum": 2000000,
            "type": "integer",
            "description": "Longer texts are cut with an ellipsis. The row also reports the real length in textChars.",
            "default": 300000
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "resolutions",
              "searchFacets",
              "courtDirectory"
            ],
            "type": "string",
            "description": "Resolutions returns the rulings. Search facets returns result counts (for example rulings per year for a topic). Court directory lists every court, specialty and chamber with its ID.",
            "default": "resolutions"
          },
          "facets": {
            "title": "Facets (search facets mode)",
            "type": "array",
            "description": "Dimensions to count for the searches above. Specialty and appeal type apply to the Supreme Court, district to the Superior Courts.",
            "items": {
              "type": "string",
              "enum": [
                "year",
                "court",
                "specialty",
                "appealType",
                "district"
              ],
              "enumTitles": [
                "Year",
                "Court level",
                "Specialty (Supreme)",
                "Appeal type (Supreme)",
                "District (Superior)"
              ]
            },
            "default": [
              "year"
            ]
          },
          "concurrency": {
            "title": "Parallel sessions",
            "minimum": 1,
            "maximum": 6,
            "type": "integer",
            "description": "Portal sessions reading result pages at the same time (1 to 6). Each session reads about one page of 10 rulings every 4 seconds.",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Required. The portal answers HTTP 403 to datacenter IPs and works with Peruvian residential IPs, so the default is Apify Residential proxy in Peru. A page of 10 rulings costs about 70 KB of proxy traffic.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ],
              "apifyProxyCountry": "PE"
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}