# PSA Population Report Lookup (`muhammadafzal/psa-population-report-lookup`) Actor

Look up official Philippine Statistics Authority OpenSTAT population tables by topic and census scope, with table metadata and optional data previews.

- **URL**: https://apify.com/muhammadafzal/psa-population-report-lookup.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $12.00 / 1,000 official psa population tables

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## PSA Population Report Lookup

**Free plan limit:** Free-plan users can receive up to **5 result records per run**. Paid-plan and local/unknown runs retain the Actor's existing limits.

Find official Philippine Statistics Authority (PSA) population and housing tables in PSA OpenSTAT. It is for analysts, researchers, journalists, and AI agents that need an authoritative table title, census scope, dimensions, update timestamp, and direct OpenSTAT source link.

### What it returns

Each dataset item is one matching official PSA OpenSTAT table:

| Field | Meaning |
| --- | --- |
| `title` | Official PSA table title |
| `tableId` | PSA OpenSTAT PX table identifier |
| `censusScope` | Census or projection collection |
| `variables` | Available official table dimensions and their value counts |
| `sourceUrl` | Direct official OpenSTAT table page |
| `dataPreview` | Optional small sample of official values, never a full export |

### Input examples

Lookup 2024 census household tables:

```json
{ "keyword": "household", "scope": "2024", "maxTables": 10 }
```

Find population-projection tables and include a small value preview:

```json
{ "keyword": "population", "scope": "projection", "includeDataPreview": true, "maxPreviewRows": 10 }
```

### Scope and limits

The actor uses PSA's public OpenSTAT API directly. It searches table titles in the selected Population and Vital Statistics collections; it does not crawl the general PSA news/reports website, retrieve microdata, or generate custom cross-tabulations. A preview chooses the first available values in each dimension and should be treated as a quick inspection, not a complete table download.

### Pricing

This Actor uses **pay-per-event** pricing. These are the current Apify Store event prices:

| Event | Price (USD) | When it is charged |
|---|---:|---|
| `apify-actor-start` | $0.006251 | Actor Start — Charged when the Actor starts running. Number of events charged depends on Actor memory (one event per GB, minimum one event). — Charged once per run. |
| `population-table` | $0.015 | Official PSA population table — Charged only after one schema-valid official PSA OpenSTAT table record is stored. |

Apify platform usage for this Actor run is included alongside the event prices above; no separate per-run platform-usage fee is passed to users.

This covers Apify platform usage for this Actor run. Other Apify products or usage outside this Actor run may still follow your account plan.

### Source and attribution

Data and metadata are retrieved from the [PSA OpenSTAT API](https://openstat.psa.gov.ph/API-Documentation). PSA content is subject to the source's stated licensing and attribution requirements; verify the official source page before redistributing or making policy decisions.

# Actor input Schema

## `keyword` (type: `string`):

Use this when you need an official PSA population table by topic. Enter a term such as 'population', 'household', or 'age'; it defaults to 'population'. This searches PSA OpenSTAT table titles only, not the general PSA website or unpublished microdata.

## `scope` (type: `string`):

Use this to select one official PSA census collection, population projections, or all supported collections. Choose 2010, 2015, 2020, 2024, projection, or all; it defaults to 2024. This is not a date filter inside a table.

## `maxTables` (type: `integer`):

Use this to cap matching official table records. Enter 1 through 25, for example 10; it defaults to 10. This is a table-record limit, not a data-row or page limit.

## `includeDataPreview` (type: `boolean`):

Use this when you need a small sample of values from each matched official table. It defaults to false; true requests up to maxPreviewRows using the first available values per table dimension. This is not a complete export or a custom cross-tabulation.

## `maxPreviewRows` (type: `integer`):

Use this with includeDataPreview=true to cap sample rows per table. Enter 1 through 100, for example 10; it defaults to 10. This does not change the number of matching table records.

## Actor input object example

```json
{
  "keyword": "age",
  "scope": "2024",
  "maxTables": 10,
  "includeDataPreview": false,
  "maxPreviewRows": 10
}
```

# Actor output Schema

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

Structured official PSA OpenSTAT table records.

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

Outcome, table count, and non-fatal lookup warnings.

# 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 = {
    "keyword": "population",
    "scope": "2024",
    "maxTables": 10,
    "includeDataPreview": false,
    "maxPreviewRows": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadafzal/psa-population-report-lookup").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 = {
    "keyword": "population",
    "scope": "2024",
    "maxTables": 10,
    "includeDataPreview": False,
    "maxPreviewRows": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("muhammadafzal/psa-population-report-lookup").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 '{
  "keyword": "population",
  "scope": "2024",
  "maxTables": 10,
  "includeDataPreview": false,
  "maxPreviewRows": 10
}' |
apify call muhammadafzal/psa-population-report-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muhammadafzal/psa-population-report-lookup"
        }
    }
}
```

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/r4KA9dGoM0p7h1rwv/builds/iw3YN7ACukS4qaxiA/openapi.json
