# GCC Open Data Search (Qatar, Bahrain) (`firebrick_zamia/uae-open-data-catalog`) Actor

Search the official Qatar and Bahrain open data portals and get clean dataset records with licence, publisher, CSV/JSON export links and a ready-made attribution.

- **URL**: https://apify.com/firebrick_zamia/uae-open-data-catalog.md
- **Developed by:** [Aadam Ahmed](https://apify.com/firebrick_zamia) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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?

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

## GCC Open Data Search: Qatar and Bahrain Datasets with Licence

**Search the official Qatar (`data.gov.qa`) and Bahrain (`data.gov.bh`) open data portals and get one clean dataset record per hit, with the licence, publisher, export links and a ready-made attribution line.**

### What you get

Per dataset: title, description (HTML stripped), publisher, themes and keywords, **licence** as stated by the portal, last-modified date, record count, API and CSV/JSON export links, dataset page URL, and an `attribution` string. Optionally up to 5 sample rows per dataset. See the example output below.

### Use cases

- Find official Gulf open data on a topic (population, trade, health, energy) and see at once whether you may reuse it.
- Feed a research assistant or AI agent a list of citable Qatar and Bahrain datasets with the correct credit line.
- Monitor the newest datasets published on both portals (an empty query returns the newest first).
- Build a catalogue of dataset licences for compliance review.

### What it does

- Calls each portal's public Opendatasoft Explore API v2.1: `GET {portal}/api/explore/v2.1/catalog/datasets` with `where=search("<query>")`, `order_by=modified desc`, `limit` and `offset` paging.
- Optionally fetches up to 5 sample rows per dataset from `/catalog/datasets/{dataset_id}/records?limit=5`.
- Polite by design: sequential requests (about 1 per second), a descriptive user-agent, retries with backoff on HTTP 429/5xx.
- If a portal answers HTTP 403, the run fails with a clear message. The actor never uses proxies or other workarounds to get around access controls.
- Metadata only (plus optional samples). No login, no scraping, no personal data.

Note: the UAE federal portal (`opendata.fcsc.gov.ae`) blocks requests from outside the UAE and `bayanat.ae` has no public API, so the UAE is not supported.

### Input

| Field | Meaning |
|---|---|
| `query` | Free-text search; empty returns the newest datasets |
| `portals` | `qatar`, `bahrain` (default both) |
| `maxItems` | 1-1000 datasets in total (default 50) |
| `includeRecordsSample` | Add up to 5 sample rows per dataset (default false; one extra request per dataset) |
| `language` | Optional two-letter language filter, e.g. `en` |

### Example input and output

Input (bundled `test-input.json`): `{"query": "population", "maxItems": 3, "includeRecordsSample": true}`.

The record below uses **illustrative values only**; real results depend on what the portals hold when you run it (a recorded API fixture is used in our tests).

```json
{
  "portal": "qatar",
  "dataset_id": "population-by-nationality",
  "title": "Population by Nationality",
  "description": "Mid-year population estimates & shares.",
  "publisher": "Planning and Statistics Authority",
  "theme": ["Demographics"],
  "keywords": ["population", "census"],
  "license": "CC BY 4.0",
  "license_url": "https://creativecommons.org/licenses/by/4.0/",
  "modified": "2026-09-30T08:15:00+00:00",
  "records_count": 120,
  "api_url": "https://www.data.gov.qa/api/explore/v2.1/catalog/datasets/population-by-nationality",
  "export_urls": {"csv": ".../exports/csv", "json": ".../exports/json"},
  "portal_url": "https://www.data.gov.qa/explore/dataset/population-by-nationality/",
  "attribution": "Source: Planning and Statistics Authority via Qatar Open Data Portal, licence CC BY 4.0"
}
```

### Pricing (pay per result)

Pay-per-event with Apify's built-in dataset-item event. The live price is set in Apify Console and shown on the Store page (see Store). Each dataset record written to the output is one result. Suggested starting price in our notes: USD 0.002 per record (proposed, not a quote).

### Licences and attribution

Each dataset carries its own licence, shown in the `license` / `license_url` fields exactly as the portal states them (it may be empty). **Check each dataset's licence field** before reusing the data, and credit the publisher; the `attribution` field helps. The actor reports "not stated" rather than guessing. This actor is not affiliated with or endorsed by any government entity. Takedown requests are honoured within 24 hours.

### Limitations

- UAE federal and Saudi portals are not supported: `opendata.fcsc.gov.ae` blocks requests from outside the UAE and `bayanat.ae` has no public API.
- Metadata only; the actor does not download or repackage dataset contents (beyond 5 optional sample rows).
  Depends on portal availability and portal-side rate limits. Dataset counts change over time.

### FAQ

**Is there a UAE open data search?** Not in this actor, for the reasons above. Qatar and Bahrain only.

**Can I trust the licence field?** It repeats what the portal states and may be empty. Check the dataset page before reuse.

**Does it scrape websites?** No. It calls each portal's public Opendatasoft API at about one request per second.

**Which languages?** Whatever the portal holds; `language` filters by two-letter code.

# Actor input Schema

## `query` (type: `string`):

Free-text search across dataset metadata (ODS where=search("...")). Empty returns the most recently modified datasets.

## `portals` (type: `array`):

Which open data portals to search, queried one after another.

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

Maximum dataset records to return in total across portals (1-1000). Each record is one billed result.

## `includeRecordsSample` (type: `boolean`):

If enabled, fetch up to 5 sample data rows per dataset (one extra request each, so slower).

## `language` (type: `string`):

Optional two-letter dataset language code (e.g. en, ar) applied as an ODS refine on the language field. Leave empty for all.

## Actor input object example

```json
{
  "query": "",
  "portals": [
    "qatar",
    "bahrain"
  ],
  "maxItems": 50,
  "includeRecordsSample": false
}
```

# Actor output Schema

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

All matching dataset records.

# 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 = {
    "portals": [
        "qatar",
        "bahrain"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("firebrick_zamia/uae-open-data-catalog").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 = { "portals": [
        "qatar",
        "bahrain",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("firebrick_zamia/uae-open-data-catalog").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 '{
  "portals": [
    "qatar",
    "bahrain"
  ]
}' |
apify call firebrick_zamia/uae-open-data-catalog --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,firebrick_zamia/uae-open-data-catalog"
        }
    }
}
```

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/bIm6VjpkrFRkNwUk3/builds/u4cVmtZSuuTwBXFPh/openapi.json
