# Correos de Costa Rica Tracker (`wizardly_dedication_ab0/correos-costa-rica-tracker`) Actor

Track Correos de Costa Rica shipping guides by logging into the sucursal portal and scraping tracking events.

- **URL**: https://apify.com/wizardly\_dedication\_ab0/correos-costa-rica-tracker.md
- **Developed by:** [ainnllus](https://apify.com/wizardly_dedication_ab0) (community)
- **Categories:**
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Correos de Costa Rica Tracker

Tracks shipping guides (guías) via the [Correos de Costa Rica](https://sucursal.correos.go.cr) sucursal portal. Logs in once, queries each guide, and writes one dataset item per guide with current status and full event history.

### Input

| Field | Type | Required | Description |
|---|---|---|---|
| `username` | string | Yes | Correos portal username |
| `password` | string | Yes | Correos portal password (secret) |
| `trackingNumbers` | string\[] | Yes | Guide numbers, e.g. `["PY999999999CR"]` |
| `delaySeconds` | integer | No | Delay between guide queries to avoid rate limiting (default: 1) |

### Output

One dataset item per guide:

| Field | Description |
|---|---|
| `trackingNumber` | Guide number (as confirmed by the portal) |
| `status` | Normalized enum: `delivered`, `in_transit`, or `not_found`. An explicit delivery event (code `EMI`) overrides a stale estado label |
| `estado` | Human-readable status as shown on the page (e.g. `Entregado`) |
| `fechaRecepcion` | Reception/start date, e.g. `2026-08-11 14:40:56` |
| `destinatario` | Destination address, when the portal shows it |
| `recibidoPor` | Name of the person who received the shipment, when delivered |
| `eventos` | Event history in chronological order (see below) |
| `eventCount` | Number of events |
| `ok` | `true` if the portal responded without errors |
| `error` | Error message, if any |

Each event in `eventos`:

| Field | Description |
|---|---|
| `sucursal` | Office/location where the event occurred |
| `fecha` | Event date, `DD/MM/YY` |
| `hora` | Event time, `HH:MM AM/PM` |
| `descripcion` | Event description |
| `codigo` | Portal event code: `EMA` (admitted), `EMB` (distribution center), `EMF` (internal transfer), `EMG` (received at office), `EDG` (out for delivery), `EMI` (delivered) |
| `lat`, `lng` | Delivery coordinates, present on the delivery event when the portal provides a location map |

### Pricing

Pay per event — no subscription:

| Event | Price |
|---|---|
| Actor start | $0.00005 per run |
| Guide query | $0.01 per guide (one dataset item, whether delivered, in transit, or not found) |

A run that fails to log in costs only the start fee. A daily schedule checking 5 guides costs roughly $1.50/month.

### Usage

Run from the Apify Console, the API, or on a schedule (create a **Task** with saved input and attach a **Schedule** for recurring runs).

Example run via API:

```
POST /v2/acts/<your-actor-id>/runs
{
  "username": "...",
  "password": "...",
  "trackingNumbers": ["PY999999999CR"]
}
```

### Local development

```bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
apify run -i '{"username": "...", "password": "...", "trackingNumbers": ["PY999999999CR"]}'
```

### Notes

- The portal is protected by a WAF (Radware). Requests from Apify datacenter IPs may occasionally be blocked with 403s; retry, or add Apify Proxy support if it becomes a persistent problem.
- Login is a single session reused across all guides in one run; sessions are not persisted between runs.

# Actor input Schema

## `username` (type: `string`):

Your Correos de Costa Rica portal username.

## `password` (type: `string`):

Correos de Costa Rica portal password.

## `trackingNumbers` (type: `array`):

One or more Correos de Costa Rica guide numbers to track. The default is a delivered demo guide.

## `delaySeconds` (type: `integer`):

Seconds to sleep between tracking requests to avoid rate limiting.

## Actor input object example

```json
{
  "trackingNumbers": [
    "PY079309961CR"
  ],
  "delaySeconds": 1
}
```

# Actor output Schema

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

One dataset item per guide: normalized status (delivered / in\_transit / not\_found), human-readable estado, recipient, and the full chronological event history.

# 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 = {
    "trackingNumbers": [
        "PY079309961CR"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("wizardly_dedication_ab0/correos-costa-rica-tracker").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 = { "trackingNumbers": ["PY079309961CR"] }

# Run the Actor and wait for it to finish
run = client.actor("wizardly_dedication_ab0/correos-costa-rica-tracker").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 '{
  "trackingNumbers": [
    "PY079309961CR"
  ]
}' |
apify call wizardly_dedication_ab0/correos-costa-rica-tracker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,wizardly_dedication_ab0/correos-costa-rica-tracker"
        }
    }
}

```

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/px5UvnUUC32Lz0MJ2/builds/gCOWUSiZgfmFLn7uk/openapi.json
