# AmpleData AI Enrichment (`blagoysimandoff/ampledata-ai-enrichment`) Actor

Use AI to enrich a dataset through the AmpleData API.

- **URL**: https://apify.com/blagoysimandoff/ampledata-ai-enrichment.md
- **Developed by:** [Blagoy Simandoff](https://apify.com/blagoysimandoff) (community)
- **Categories:** AI, Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 96.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $30.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/platform/actors/running/actors-in-store#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

## AmpleData Enrichment — Apify Actor

Enrich a CSV through the [AmpleData](https://ampledata.io) API: upload a list, define
the columns you want filled in plain English, and get back cited, confidence-scored cells.

The actor runs one enrichment job and is **cancellable** — aborting the Apify run cancels the
underlying AmpleData job via `POST /jobs/{jobID}/cancel`.

### API key

Two ways to supply the AmpleData key — the actor uses whichever is present:

1. **Bring your own key** — set the `apiToken` input. Enrichment is billed per cell against
   *your* AmpleData balance. Generate a key at <https://ampledata.io> account settings.
2. **Keyless** — leave `apiToken` empty. The actor falls back to the `AMPLEDATA_KEY` environment
   variable configured on the actor, so users run without a key (these runs are billed by the
   actor owner, typically via Apify monetization).

`apiToken` always wins when both are set. The owner key lives in an Apify **secret environment
variable** (Console → Actor → Settings → Environment variables → `AMPLEDATA_KEY`, marked Secret) —
never hardcoded in source.

### Input

| Field | Required | Description |
| --- | --- | --- |
| `apiToken` | yes | AmpleData API key (`sk_live_...`). Generate from account settings. |
| `columns` | yes | Columns to enrich. Each: `{ name, type, description }`. `type` ∈ `string\|number\|boolean\|date`. |
| `csv` | one of | Inline CSV (first row = header). |
| `csvUrl` | one of | URL of a CSV to download. Takes precedence over `csv`. |
| `keyColumns` | no | Identifying columns (e.g. `["company"]`). Empty → AmpleData picks. |
| `keyColumnDescription` | no | Plain-English description of the key column. |
| `rowLimit` | no | Max rows to process. |
| `baseUrl` | no | API base URL. Default `https://ampledata.io/api/v1`. |
| `pollIntervalSecs` | no | Progress poll interval. Default `5`. |
| `insecureTLS` | no | Skip TLS verification. Only for a self-hosted endpoint with a self-signed cert. Insecure. |

#### Example

```json
{
  "apiToken": "sk_live_...",
  "csv": "company\nstripe.com\nfigma.com",
  "keyColumns": ["company"],
  "columns": [
    { "name": "industry", "type": "string", "description": "Primary industry" }
  ]
}
```

### Output

Each enriched row is pushed to the default dataset:

```json
{
  "key": "stripe.com",
  "extracted_data": { "industry": "Fintech" },
  "confidence": { "industry": { "score": 0.9, "reason": "..." } },
  "sources": ["https://..."]
}
```

A summary is written to the key-value store under `OUTPUT`:
`{ jobId, status, totalRows, resultCount }`.

### How it works

1. `POST /enrichment-signed-url` → signed upload URL + `sourceId`
2. `PUT` the CSV bytes to the signed URL
3. `POST /sources/{sourceId}/enrich` → `jobId`
4. Poll `GET /jobs/{jobId}/progress` until `COMPLETED` / `CANCELLED`
5. `GET /jobs/{jobId}/results` → dataset

### Develop

```bash
npm install
npm run build
apify run    # uses storage/key_value_stores/default/INPUT.json
```

### Deploy

```bash
apify login
apify push
```

# Actor input Schema

## `apiToken` (type: `string`):

Optional. Bring your own AmpleData API key (sk\_live\_...) to be billed on your own account balance. If left empty, runs use the actor's built-in key (paid runs). Generate a key at https://ampledata.io account settings; it is stored encrypted and never shared.

## `csv` (type: `string`):

Inline CSV to enrich. First row must be the header. Ignored when CSV URL is set.

## `csvUrl` (type: `string`):

URL of a CSV file to download and enrich. Takes precedence over inline CSV.

## `columns` (type: `array`):

Columns AmpleData should fill in. Each item: { name, type, description }. type is one of string|number|boolean|date.

## `keyColumns` (type: `array`):

Columns that identify each row (e.g. company name). Leave empty to let AmpleData pick.

## `keyColumnDescription` (type: `string`):

Optional plain-English description of what the key column holds.

## `rowLimit` (type: `integer`):

Maximum number of rows to process. Processes all rows if not set.

## `baseUrl` (type: `string`):

AmpleData API base URL.

## `pollIntervalSecs` (type: `integer`):

How often to poll job progress.

## `insecureTLS` (type: `boolean`):

Skip TLS certificate verification. Only enable for a self-hosted AmpleData endpoint with a self-signed certificate. Insecure — do not use against production.

## Actor input object example

```json
{
  "csv": "company\nstripe.com\nfigma.com\nnotion.so",
  "columns": [
    {
      "name": "industry",
      "type": "string",
      "description": "The company's primary industry"
    }
  ],
  "keyColumns": [
    "company"
  ],
  "baseUrl": "https://ampledata.io/api/v1",
  "pollIntervalSecs": 5,
  "insecureTLS": false
}
```

# 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 = {
    "csv": `company
stripe.com
figma.com
notion.so`,
    "columns": [
        {
            "name": "industry",
            "type": "string",
            "description": "The company's primary industry"
        }
    ],
    "keyColumns": [
        "company"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("blagoysimandoff/ampledata-ai-enrichment").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 = {
    "csv": """company
stripe.com
figma.com
notion.so""",
    "columns": [{
            "name": "industry",
            "type": "string",
            "description": "The company's primary industry",
        }],
    "keyColumns": ["company"],
}

# Run the Actor and wait for it to finish
run = client.actor("blagoysimandoff/ampledata-ai-enrichment").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "csv": "company\\nstripe.com\\nfigma.com\\nnotion.so",
  "columns": [
    {
      "name": "industry",
      "type": "string",
      "description": "The company'\''s primary industry"
    }
  ],
  "keyColumns": [
    "company"
  ]
}' |
apify call blagoysimandoff/ampledata-ai-enrichment --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=blagoysimandoff/ampledata-ai-enrichment",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/ghGcOOM0tUF7faChU/builds/Eboc3JX4ulHtbHTif/openapi.json
