# OMPIC Morocco Company Data Scraper (`scraper_guru/ompic-scraper`) Actor

Scrape Morocco's OMPIC business registry. Extract company names, RC and ICE numbers, cities, legal forms, activities, capital, status, and addresses for B2B research.

- **URL**: https://apify.com/scraper\_guru/ompic-scraper.md
- **Developed by:** [LIAICHI MUSTAPHA](https://apify.com/scraper_guru) (community)
- **Categories:** Lead generation, Automation
- **Stats:** 17 total users, 2 monthly users, 97.6% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.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?

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

## OMPIC Morocco Company Data Scraper

Scrape public company records from Morocco's **OMPIC business registry through directinfo.ma**. Extract names, RC and ICE identifiers, cities, legal forms, activities, creation dates, capital, status, and addresses for B2B research and company verification.

### Features

- Searches the public OMPIC/directinfo.ma company index by keyword
- Supports an A-Z sweep when no specific keyword is supplied
- Expands capped searches to collect additional matching companies
- Filters returned companies by city and legal form
- Deduplicates companies by RC number or company name
- Saves structured company records and a `STATS` run summary

### Use Cases

- **B2B research:** build company lists by sector, city, and legal form
- **Business verification:** check public registration identifiers and status
- **Market sizing:** count and compare registered companies across niches
- **Due diligence:** enrich supplier, partner, or competitor research
- **Data pipelines:** feed Moroccan firmographic data into CRM and analytics workflows

### Input

| Field | Type | Default | Description |
|---|---|---:|---|
| `searchKeywords` | array | `[]` | Company or sector terms; empty triggers an A-Z sweep |
| `maxItems` | integer | `500` | Maximum unique company records, from 1 to 50,000 |
| `city` | string | all cities | Optional city text filter |
| `legalForm` | string | all forms | Optional SA, SARL, SNC, SCS, GIE, or Auto-entrepreneur filter |
| `proxyConfiguration` | object | Apify Residential Proxy | Proxy settings used to establish the browser session |

```json
{
  "searchKeywords": ["informatique", "software"],
  "city": "Casablanca",
  "legalForm": "SARL",
  "maxItems": 500
}
```

### Output

Each dataset item represents one public company record:

```json
{
  "name": "EXAMPLE TECHNOLOGY SARL",
  "rc": "123456",
  "ice": "003000000000000",
  "city": "CASABLANCA",
  "legalForm": "SARL",
  "activity": "DEVELOPPEMENT INFORMATIQUE",
  "creationDate": "2021-03-15",
  "capital": "100000",
  "address": "Casablanca, Morocco",
  "status": "EN ACTIVITE",
  "source": "directinfo.ma / OMPIC",
  "keyword": "informatique",
  "scrapedAt": "2026-07-11T10:00:00.000Z"
}
```

The `STATS` key-value store record reports attempted, blocked, and failed queries, filters, duration, and total companies saved.

### How to Use

1. Open the Actor and click **Try for free**.
2. Enter one or more company or activity keywords.
3. Optionally select a city and legal form.
4. Start with `maxItems: 20` to validate the search.
5. Keep the configured proxy enabled for reliable session establishment.
6. Start the run and export the resulting dataset.

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('scraper_guru/ompic-scraper').call({
  searchKeywords: ['immobilier'],
  city: 'Casablanca',
  maxItems: 200,
});
```

### Pricing

This is a pay-per-event Actor. A successfully saved company record costs **$0.01**, or **$10 per 1,000 results**, plus any platform usage shown by Apify. Search filters may reduce the number of billable records produced.

### FAQ

**What is OMPIC?**\
OMPIC is Morocco's industrial and commercial property office. This Actor searches company information exposed through the public directinfo.ma portal.

**Does an empty keyword download the entire registry?**\
It starts an A-Z sweep and continues until `maxItems` is reached. Completeness depends on the source search limits and availability during the run.

**Why can city or legal-form filters return fewer results?**\
Filtering happens after the source search. Records that do not contain the requested field or value are excluded.

**Does the Actor verify beneficial owners or private contact details?**\
No. It returns only the public company fields available in the source response.

**Is this legal to use?**\
Use public registry data for lawful purposes and comply with directinfo.ma terms, applicable regulations, and data-protection requirements.

For source changes or extraction problems, open the **Issues** tab on this Actor.

# Actor input Schema

## `searchKeywords` (type: `array`):

Keywords to search in OMPIC registry. Leave empty for full A-Z alphabetic sweep (slower but more complete).

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

Maximum number of companies to extract.

## `city` (type: `string`):

Filter results by city (e.g. Casablanca, Rabat, Marrakech). Leave empty for all cities.

## `legalForm` (type: `string`):

Filter by legal form: SA, SARL, SNC, SCS, GIE, Auto-entrepreneur. Leave empty for all.

## `proxyConfiguration` (type: `object`):

Use Apify residential proxies to avoid blocks.

## Actor input object example

```json
{
  "searchKeywords": [
    "informatique"
  ],
  "maxItems": 20,
  "city": "",
  "legalForm": "",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `companies` (type: `string`):

Structured OMPIC company records.

## `runStats` (type: `string`):

Query counts, filters, duration, and number of unique companies saved.

# 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 = {
    "searchKeywords": [
        "informatique"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("scraper_guru/ompic-scraper").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 = {
    "searchKeywords": ["informatique"],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("scraper_guru/ompic-scraper").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 '{
  "searchKeywords": [
    "informatique"
  ],
  "maxItems": 20
}' |
apify call scraper_guru/ompic-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scraper_guru/ompic-scraper"
        }
    }
}

```

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/NTPougyIw737NMqVb/builds/s8WKfofB40QzczeWq/openapi.json
