# Philippine Law Data — Lawphil (`epiconetic/philippines-law-data`) Actor

Philippine legislation and Supreme Court jurisprudence from the official Lawphil portal: 45,500+ statutes, executive orders, proclamations and administrative issuances plus 67,000 decisions, with official document numbers, dates, titles and PDF links.

- **URL**: https://apify.com/epiconetic/philippines-law-data.md
- **Developed by:** [dedy iskandar](https://apify.com/epiconetic) (community)
- **Categories:** Business, Developer tools, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 1,000 legislation records

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Philippine Law Data — Lawphil (Arellano Law Foundation)

Scrape **Philippine legislation and Supreme Court jurisprudence** from the official Lawphil e-Library — [`lawphil.net`](https://lawphil.net) — into clean, structured JSON.

Every record is normalised to the **same schema**, regardless of which of the eleven source collections it came from: official document number, title, date, document type, the **official Lawphil page**, and the **official PDF link** whenever the source publishes one.

No proxies, no browser, no API key. Lawphil serves its data through a public JSON API; this Actor reads it directly.

***

### What you get

| What | Detail |
| --- | --- |
| **Coverage** | ~45,500 legislative documents + ~67,000 Supreme Court decisions |
| **Eleven collections** | Republic Acts, Executive Orders, Acts of Congress, Proclamations, Administrative Orders, Memorandum Orders, Memorandum Circulars, Batas Pambansa Blg., Commonwealth Acts, General Orders, Supreme Court jurisprudence |
| **Official numbers** | `Republic Act No. 12317`, `Executive Order No. 29`, `G.R. No. 279863` — exactly as the Supreme Court publishes them |
| **Official PDFs** | `pdfUrl` points at Lawphil's own PDF path — the file is never downloaded, only linked |
| **Dates** | Normalised to ISO-8601 (`YYYY-MM-DD`) |
| **Issuer & citation** | Kept where the source states them (issuing President, formal citation) |
| **Judgment metadata** | Reporter reference (`598 SCRA`), ponente, and subject area for jurisprudence |
| **Deterministic ids** | `id` = `<collection>:<document number>:<source file slug>`, stable across runs |
| **No duplication** | Records are de-duplicated in-flight, even when the source repeats rows |
| **Verified links** | 95.7% of published HTML pages and 93.8% of published PDF links were live when this Actor was last checked — see [Link availability](#link-availability) |
| **Optional full text** | Turn on `includeFullText` to get the clean statutory or opinion text |

***

### Collections

Pick one or more with the `collections` input. The default is all ten legislative collections.

| `collections` value | What it contains | ≈ Records |
| --- | --- | --- |
| `republic` | Republic Acts and their IRRs | 12,072 |
| `execord` | Executive Orders | 5,904 |
| `acts` | Acts of Congress | 4,279 |
| `proclamations` | Presidential Proclamations | 14,013 |
| `ao` | Administrative Orders | 2,858 |
| `mo` | Memorandum Orders | 2,438 |
| `mc` | Memorandum Circulars | 2,268 |
| `bataspambansa` | Batas Pambansa Blg. | 891 |
| `commonwealth` | Commonwealth Acts | 733 |
| `genor` | General Orders | 85 |
| `jurisprudence` | Supreme Court jurisprudence | 66,998 |

> Counts are the `total` reported by the Lawphil API at build time (2026-11). The corpus grows; treat them as a guide. Legislation totals ~45,541 source rows, of which **45,396 are distinct documents** (the source repeats 145 rows verbatim).

`jurisprudence` is **opt-in** because it is a much larger corpus and it is billed under a separate pay-per-event. Add it explicitly:

```json
{ "collections": ["jurisprudence"], "maxItems": 1000 }
```

***

### Input

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `collections` | array | all ten legislative collections | Collections to scrape. |
| `years` | array | `[]` | Server-side year filter, e.g. `[2024, 2025]`. Empty = every year. |
| `search` | string | `""` | Server-side keyword matched against every field of a document (number, title, citation). |
| `includeFullText` | boolean | `false` | Also fetch each document's page and attach the clean text as `fullText`. |
| `includePdf` | boolean | `true` | Include the official PDF URL in `pdfUrl`. The PDF is never downloaded. |
| `maxItems` | integer | `100` | Max records written this run. Hard cap `60000`. |
| `maxPages` | integer | `0` | Max API pages this run (`0` = unlimited). Each page returns up to 100 records. |
| `resume` | boolean | `true` | Continue from where the previous identical run stopped. |

#### Example: one topic across all legislation

```json
{
  "collections": ["republic", "execord", "proclamations"],
  "search": "data privacy",
  "maxItems": 500
}
```

#### Example: everything enacted in 2025

```json
{
  "collections": ["republic", "acts", "proclamations"],
  "years": [2025],
  "maxItems": 2000
}
```

#### Example: recent Supreme Court decisions with full text

```json
{
  "collections": ["jurisprudence"],
  "years": [2024, 2025, 2026],
  "includeFullText": true,
  "maxItems": 300
}
```

#### Example: a full legislative snapshot

```json
{
  "collections": [
    "republic",
    "execord",
    "acts",
    "proclamations",
    "ao",
    "mo",
    "mc",
    "bataspambansa",
    "commonwealth",
    "genor"
  ],
  "maxItems": 60000,
  "resume": true
}
```

***

### Output

One dataset item per document. Empty strings and `null` mean *the source does not provide that value for this document* — they are never invented.

```json
{
  "id": "republic:Republic Act No. 12317:ra_12317_2023",
  "collection": "republic",
  "collectionLabel": "Republic Acts",
  "docType": "statute",
  "number": "Republic Act No. 12317",
  "title": "AN ACT TO PROTECT THE RIGHT OF INDIVIDUALS TO PERSONAL DATA",
  "date": "2023-09-06",
  "year": 2023,
  "htmlUrl": "https://lawphil.net/statutes/repacts/ra2023/ra_12317_2023.htm",
  "pdfUrl": "https://lawphil.net/statutes/repacts/ra2023/pdf/ra_12317_2023.pdf",
  "pdfAvailable": true,
  "issuer": "President Ferdinand R. Marcos Jr.",
  "scrapedAt": "2026-11-16T09:14:03.118Z"
}
```

| Field | Type | Notes |
| --- | --- | --- |
| `id` | string | `<collection>:<document number>:<source file slug>` — stable and unique per document, even when the same document number is reused in a later year or month |
| `collection` | string | Source collection id |
| `collectionLabel` | string | Human-readable collection name |
| `docType` | string | `statute` | `act` | `executive-order` | `proclamation` | `administrative-order` | `memorandum-order` | `memorandum-circular` | `batas-pambansa` | `commonwealth-act` | `general-order` | `decision` |
| `number` | string | Official document number as published |
| `title` | string | Official title / short title |
| `date` | string | ISO-8601 (`YYYY-MM-DD`) |
| `year` | integer | Derived from the date |
| `htmlUrl` | string | Lawphil HTML page for the document |
| `pdfUrl` | string | Official PDF URL, `null` when the source has none |
| `pdfAvailable` | boolean | `true` when the source record carries a PDF |
| `issuer` | string | Issuing authority, when stated |
| `citation` | string | Formal citation, when provided |
| `reference` | string | Reporter reference, e.g. `598 SCRA` (jurisprudence only) |
| `ponente` | string | Justice who wrote the opinion (jurisprudence only) |
| `subject` | string | Subject area of the decision (jurisprudence only) |
| `fullText` | string | Clean statutory or opinion text — only with `includeFullText: true` |
| `fullTextChars` | integer | Length of the extracted full text |
| `scrapedAt` | string | ISO-8601 run timestamp |

Field names are treated as a stable public contract.

The Actor also writes a **run summary** to the default key-value store (`OUTPUT`) with per-collection statistics, resume offsets, and stop reasons.

***

### Pricing

**Pay-per-event.** You pay for data, not for run time, memory or proxies.

| Event | Price (USD) | Charged when |
| --- | --- | --- |
| `legislation` | **0.0025** | One legislative record is written to your dataset |
| `jurisprudence` | **0.0020** | One Supreme Court decision is written to your dataset |

Plan-based discount events are registered for higher-priced plans and switch themselves on automatically when the platform exposes the user's plan. The base event price never changes.

| Plan | `legislation` event | `jurisprudence` event |
| --- | --- | --- |
| Free | $0.0025 | $0.0020 |
| Bronze | $0.0023 | $0.0018 |
| Silver | $0.0020 | $0.0016 |
| Gold | $0.0018 | $0.0014 |
| Platinum | $0.0016 | $0.0012 |
| Diamond | $0.0014 | $0.0010 |

Reference costs:

| Records | Legislation | Jurisprudence |
| --- | --- | --- |
| 100 | $0.25 | $0.20 |
| 1,000 | $2.50 | $2.00 |
| 10,000 | $25.00 | $20.00 |
| Full corpus | ~$113 (45,396 records) | ~$134 (66,998 records) |

Charging rules:

- **Write first, charge second.** A record is only charged after it has been successfully pushed to the dataset. If storage fails, you are not charged for it.
- **No charge for empty results.** A keyword with no matches costs nothing.
- **Budget is respected mid-run.** If your run's maximum charge is reached, the Actor stops cleanly and keeps the records already delivered.
- **No double billing within a run.** Duplicated rows from the source are collapsed *before* charging. This holds across API pages too, not just inside one page: the Actor keeps a hash of every record it has already written and skips repeats that reappear on a later page.
- **Re-runs only pay for new records.** With `resume: true`, a second run continues where the first stopped instead of re-billing the same documents. Documents already written by a previous run with the same settings are skipped and never charged again.
- **The minimum spend floor is $0.10.** That is low enough for any sensible filtered run. Your own per-run budget is what actually limits how much a run may buy — raise it in the Apify Console if you want the whole 45,396-record corpus in one go (~$113).

**Note:** because the Actor runs under the platform's limited-permissions profile, the user's plan cannot be read at run time, so every customer is currently charged the base event price above. The discount ladder switches itself on automatically if the platform ever exposes the plan — it is never charged for a tier the customer did not qualify for.

***

### Running it from the API

> **Pass the input flat.** The Apify run API silently discards a payload whose input is wrapped in an `input` key and falls back to the schema defaults — your filter is lost and you are billed for the default corpus. Send the fields at the top level of the request body.

```bash
## WRONG - the nested "input" object is discarded, defaults are applied
curl -X POST "https://api.apify.com/v2/acts/1ZcBH9CtQLUc64yFF/runs?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"input":{"collections":["republic"],"maxItems":50}}'

## RIGHT - flat body
curl -X POST "https://api.apify.com/v2/acts/1ZcBH9CtQLUc64yFF/runs?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"collections":["republic"],"maxItems":50}'
```

The Apify Console, the Apify MCP server and the `apify` CLI all send flat input correctly, so this only matters for hand-written API calls.

Every run writes its **effective input** to the default key-value store under `OUTPUT`, alongside the per-collection statistics. If the input you sent is not what you see there, you were charged for something else — check it before a large run.

***

### How it works

1. Requests the Lawphil public JSON API in pages of 100 records, applying the `year` and `search` filters server-side so the Actor never downloads what you excluded.
2. Resolves each document's HTML and PDF URLs from the source's own path scheme, so links are built locally without an extra HTTP request per record.
3. Normalises every record to the public schema above.
4. Optionally fetches the document page and extracts the clean statutory text (trailing markup and the source's stray footer characters are stripped).
5. Pushes the batch to the dataset, then charges for exactly those records.
6. Saves the per-collection page offset plus a hashed fingerprint of every record already written, so the next run resumes instead of restarting — and never re-bills a document it has already delivered.

Requests are spaced out (~200 ms) and retried with exponential backoff, so the portal stays comfortable.

***

### Limitations

#### Link availability

Lawphil is a volunteer-maintained archive, and its API sometimes lists a document before the file is uploaded (or after it is removed). The Actor reports what the source claims and never invents a substitute link.

Measured on a 1,085-record sample across all eleven collections (2026-11):

| | Claimed by the source | Link resolves |
| --- | --- | --- |
| HTML page | 1,057 records | 1,012 (**95.7%**) |
| PDF | 691 records | 648 (**93.8%**) |
| Records with a working PDF link | — | 648 of 1,085 (**59.7%**) |

Per collection, published HTML pages resolve at 94–100%, except Supreme Court jurisprudence. Within jurisprudence the only failing batch is **January 2026** (4 of 47 pages live) — the API carries those decisions before Arellano uploads the files. Every other month resolves at 97–100%.

The 59.7% figure for PDFs is *not* a defect: Acts of Congress, Commonwealth Acts, General Orders and most Batas Pambansa Blg. are published as HTML only, and the source marks them as having no PDF. Those records carry `pdfUrl: null` and `pdfAvailable: false` rather than a broken link.

#### Other limitations

- **Some legislative rows have no HTML page.** A number of API rows carry a PDF but no page URL — IRRs are the clearest example. Their `htmlUrl` is empty.
- **Keyword search is server-side and matches every field.** It is a substring match on number, title and citation — it is not a semantic search.
- **Year filtering is per request.** A run with `years` set fetches only those years; a run without it walks the whole corpus.
- **No AI summaries in v1.** Output is source-faithful data only, so nothing in the dataset is generated or inferred.
- **Resume needs a named key-value store.** The cursor is kept in a per-user store (`state-<userId>`). If the platform refuses to create it for your account (some accounts restrict named storage creation from runs), the Actor logs a warning, falls back to the run's default store and continues — only resume *across* runs is then unavailable. `OUTPUT.stateStore.persistent` tells you which mode was used.
- **A completed scope restarts.** Re-running a scope that was fully read returns the data again — and charges again. That is deliberate: you always get what you asked for.
- **Full text is best-effort.** With `includeFullText: true` the Actor fetches each document page. If a page is missing upstream, that record gets `fullText: null` and a warning is logged; the run continues.

***

### Use cases

- Legal-tech and compliance teams building a Philippine statute database.
- Law firms and in-house counsel tracking amendments, proclamations and executive issuances.
- Fintech, BPO, insurance and healthcare companies mapping sector regulation (Data Privacy Act, Financial Reporting, consumer protection).
- Regtech vendors enriching contract-review and due-diligence products with citable, current Philippine legal sources.
- Researchers and journalists analysing legislative output and Supreme Court trends over time.
- AI/RAG pipelines that need citable Philippine legal text with official PDF links.

***

### Data source

Public data published by the **Arellano Law Foundation**, which operates the Lawphil e-Library for the **Supreme Court of the Philippines** — [lawphil.net](https://lawphil.net). This Actor reads only what the portal serves publicly, at a polite rate, and always links back to the official page and PDF.

The source is authoritative; this Actor is an access layer. Always verify against the official document before relying on it legally.

***

### Support

Open an issue from the Actor's page in Apify Console with the run id and the input you used. Questions about coverage or a missing collection are welcome.

# Actor input Schema

## `collections` (type: `array`):

Which Lawphil collections to scrape. Each collection is normalised to the same output shape. 'jurisprudence' is billed under a separate pay-per-event and is opt-in because it is a much larger corpus (≈67,000 decisions).

## `years` (type: `array`):

Optional list of years to fetch, e.g. \[2024, 2025]. The filter is applied server-side, so a narrow year range is dramatically cheaper and faster than fetching the whole corpus. Leave empty to fetch every year.

## `search` (type: `string`):

Optional keyword matched server-side against every field of each document (number, title, citation). Useful for narrowing to a topic, e.g. 'cyber', 'privacy', 'data'. Leave empty to fetch everything.

## `includeFullText` (type: `boolean`):

Also fetch each document's HTML page and attach the clean statutory text as `fullText`. Off by default because it roughly doubles the request count and makes dataset rows much larger. Metadata and PDF links are always included.

## `includePdf` (type: `boolean`):

Include the official PDF URL of each document in `pdfUrl`. The PDF itself is never downloaded — only the link is recorded.

## `maxItems` (type: `integer`):

Maximum number of records written in this run (hard cap, capped at 60000). Run the Actor again with the same settings to continue from where it stopped.

## `maxPages` (type: `integer`):

Maximum number of API pages to fetch in this run. Each page returns up to 100 records. Use 0 for no limit. Useful as a safety cap when resuming a very large corpus.

## `resume` (type: `boolean`):

Continue from the position stored by the previous run with the same settings instead of starting from the beginning. Disable to always start from the first record.

## Actor input object example

```json
{
  "collections": [
    "republic",
    "execord",
    "acts",
    "proclamations",
    "ao",
    "mo",
    "mc",
    "bataspambansa",
    "commonwealth",
    "genor"
  ],
  "years": [],
  "search": "",
  "includeFullText": false,
  "includePdf": true,
  "maxItems": 100,
  "maxPages": 0,
  "resume": true
}
```

# Actor output Schema

## `results` (type: `string`):

All Philippine law records produced by this run: collection, document number, title, date, and official PDF links.

## `summary` (type: `string`):

Per-collection statistics, charging details and resume state for this run.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "collections": [
        "republic",
        "execord",
        "acts",
        "proclamations",
        "ao",
        "mo",
        "mc",
        "bataspambansa",
        "commonwealth",
        "genor"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("epiconetic/philippines-law-data").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "collections": [
        "republic",
        "execord",
        "acts",
        "proclamations",
        "ao",
        "mo",
        "mc",
        "bataspambansa",
        "commonwealth",
        "genor",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("epiconetic/philippines-law-data").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "collections": [
    "republic",
    "execord",
    "acts",
    "proclamations",
    "ao",
    "mo",
    "mc",
    "bataspambansa",
    "commonwealth",
    "genor"
  ]
}' |
apify call epiconetic/philippines-law-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,epiconetic/philippines-law-data"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/1ZcBH9CtQLUc64yFF/builds/uuFATXi0Gk2VBrbjt/openapi.json
