{
  "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": "pfD4StWk3dviJa8IZ"
  },
  "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": {
          "mode": {
            "title": "What do you want to get?",
            "enum": [
              "resolutions",
              "searchFacets",
              "courtDirectory"
            ],
            "type": "string",
            "description": "Rulings: the court decisions (default). Search facets: result counts per year, court or specialty. Court directory: every court and chamber with its ID.",
            "default": "resolutions"
          },
          "searchTexts": {
            "title": "Search words (full text)",
            "type": "array",
            "description": "Words searched inside the full text of the rulings, one search per term. Example: minería ilegal.",
            "items": {
              "type": "string"
            }
          },
          "topics": {
            "title": "Ready-made 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 match)",
            "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 only)",
            "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": "Legal 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 only)",
            "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 procedural orders (autos calificatorios)",
            "type": "boolean",
            "description": "Also return procedural orders (autos calificatorios). Adds hundreds of thousands of Supreme Court rows.",
            "default": false
          },
          "dateFrom": {
            "title": "Ruling date from (YYYY-MM-DD)",
            "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": "Ruling date to (YYYY-MM-DD)",
            "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"
          },
          "facets": {
            "title": "What to count",
            "type": "array",
            "description": "Only for the Search facets mode. Example: year counts rulings per year for your search terms.",
            "items": {
              "type": "string",
              "enum": [
                "year",
                "court",
                "specialty",
                "appealType",
                "district"
              ],
              "enumTitles": [
                "Year",
                "Court level",
                "Specialty (Supreme)",
                "Appeal type (Supreme)",
                "District (Superior)"
              ]
            },
            "default": [
              "year"
            ]
          },
          "maxItems": {
            "title": "Max rulings to return",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "How many rulings to return, for example 100. Free plan: capped at 10 per run.",
            "default": 10
          },
          "includePdfText": {
            "title": "Add full text of each ruling (slower)",
            "type": "boolean",
            "description": "Downloads each ruling's PDF and adds the full text and page count. Slower: one extra download per ruling.",
            "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
          },
          "savePdfFiles": {
            "title": "Save the original PDFs (extra cost)",
            "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
          },
          "onlyNew": {
            "title": "Only new rulings since the last run",
            "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": "Forget previously seen rulings",
            "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
          },
          "concurrency": {
            "title": "Parallel sessions (1-6)",
            "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 (Peru residential, required)",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}