# CSV Row Rescue: accepted rows and rejection ledger (`immemorial_sarinda/csv-row-rescue`) Actor

Inspect one pasted CSV without guessing repairs. Get literal accepted values, a rejected-record ledger, and a reconciled receipt. Experimental; no confidential data.

- **URL**: https://apify.com/immemorial_sarinda/csv-row-rescue.md
- **Developed by:** [Picknotes](https://apify.com/immemorial_sarinda) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$100.00 / 1,000 completed csv inspections

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

## CSV Row Rescue

Inspect one pasted CSV and download a ZIP containing accepted rows, rejected records, and a receipt that reconciles every data record. Experimental first release. No AI, repair, inferred types, or silent row skipping.

### What it does

Give it exactly two input strings: `csv` and `delimiter`. Choose comma, semicolon, or tab explicitly. The small prefilled example is synthetic.

On complete inspection, `BUNDLE.zip` contains exactly:

- `accepted.csv`: literal accepted values, all fields quoted; the header is retained even when no rows are accepted.
- `accepted.jsonl`: positional string values, record indexes, physical-line coordinates and source-record hashes.
- `rejected.jsonl`: wrong-width or blank data records, including their original record text, parsed values, location and reason.
- `receipt.json`: input/output hashes, limits, counts and reconciliation.

“Complete” means all data records were accounted for. A complete inspection can reject some or every data record, and a header-only file is complete with zero data records. Require `status == complete` and `rejected == 0` if you need all records to be structurally valid; also require `accepted > 0` if you need nonempty data.

Malformed quoting, invalid headers or a hard limit cause a diagnostic-only failure. Final counts are unknown. There is no accepted-prefix download, no data ZIP, and no completion dataset row for that failure. `DIAGNOSTIC.json` is the only inspection artifact; `OUTPUT` summarizes it. Operational storage failures may leave no diagnostic or a partially written/unverified ZIP. Only a matching completion dataset receipt qualifies a verified ZIP as the completed deliverable.

### Limits and literal-value safety

- One UTF-8 CSV string, up to 1 MiB (1,048,576 bytes), excluding one optional leading UTF-8 BOM
- At most 10,000 data records, plus the header
- Up to 8 MiB across the four core artifacts, including the receipt; ZIP overhead is capped at 4 KiB more
- Stored platform INPUT is rejected above 2 MiB when the platform supplies its size; canonical reserialized JSON is also capped at 2 MiB
- LF or CRLF record boundaries; bare CR outside quoted fields and ambiguous quotes fail closed
- Unique, nonblank, literal header names; no trimming, deduplication, type conversion or repair
- Fixed 512 MiB run memory, 45-second asynchronous work deadline and 60-second application watchdog, starting after Python imports. Startup/shutdown and platform storage billing are outside that application deadline. Set the separate platform run timeout to 60 seconds; the application watchdog does not set it for you.

Formula-like values remain literal. Opening `accepted.csv` in spreadsheet software may execute formulas, even though every field is quoted. Prefer the JSONL artifacts for automated use. Formula detection is a warning heuristic, not a security guarantee.

The Actor receives JSON already decoded by Apify's SDK. Request hashes in the receipt describe the Actor's canonical UTF-8 JSON reserialization, not original HTTP bytes. Original duplicate JSON keys, original JSON escape spelling and original file encoding cannot be checked at this boundary. CSV hashes describe the supplied string's UTF-8 representation. Keep the original source if you need independent source-fidelity verification. Hashes show consistency, not authenticity.

### Where to get results

Open the run in Apify Console. In Storage → Key-value store, open `OUTPUT` and download `BUNDLE.zip`, or inspect `DIAGNOSTIC.json` on a file failure. The Dataset contains exactly one completion receipt on confirmed completion; its `completionId` and `bundleSha256` must match `OUTPUT` and the downloaded ZIP. The run links open Console rather than creating public or signed file links. Authorized API clients can read these same named records through their normal credentials.

`OUTPUT.status` intentionally remains `bundle_verified_completion_pending`: it is written and read back before the sole dataset append. A matching dataset completion receipt is authoritative for completion publication, even if a run reaches its spending cap or terminates before acknowledging that append. Inspect the platform's billing details separately. Dataset and key-value storage are separate writes; cloud atomicity and exactly-once billing are not promised.

### Storage and privacy

Input and output are processed and stored on Apify using the caller's run/storage settings. Storage IDs can grant read access. This Actor does not make storage private, publish it, create signed download links, or change your access restrictions. For this first release, use synthetic or non-confidential data only. Do not paste secrets, credentials, personal records or confidential business files. Keep storage IDs and exported links out of public messages. Default unnamed run storage may expire after 7 days; retention and subsequent storage access follow your Apify plan and settings. See [Apify storage](https://docs.apify.com/storage).

### Price and completion behavior

US$0.10 per completed inspection, with platform usage during the run included. Check the live Store pricing before starting; the pricing shown there controls. Complete includes rejected/all-rejected data and header-only inputs. The completion event is `apify-default-dataset-item`: one event per inspection, with no start/custom fee or per-CSV-row event.

A parsing failure has no completion row. An operationally failed or aborted run can still have a committed completion row and its charge, so inspect the dataset and run billing before starting another run. Accessing retained storage after the run may incur separate platform usage, and retention is plan-dependent. See [Apify pricing](https://apify.com/pricing) and [pay-per-event documentation](https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event).

A low remaining completion budget produces no ZIP or completion append. Files and a manifest are saved and read back before the completion event is attempted. A lost append acknowledgment can still mean the dataset row and charge committed. The Actor never retries that append, never deletes a committed result to hide uncertainty, and refuses reused/nonempty run storage. Do not resurrect, migrate/replay, or restart a run as a retry; inspect saved evidence first. A separate new run is a separate inspection and may be charged again.

### When a free tool is enough

Python's `csv` module, DuckDB, spreadsheets, and n8n's CSV tools are free alternatives (hosting or other service costs may apply). They may be sufficient if you only need to load a well-formed file or already maintain your own rejection accounting. This narrow offer packages literal-value outputs, a rejected-record ledger and verifiable complete accounting on Apify. Buyer adoption and willingness to pay have not been validated. It does not promise uniqueness, profitability, production readiness, or business-data correctness.

No URL fetching, file-upload workflow, batch inputs, encoding guessing, AI, dedupe, destination integration or repair is included. Local deterministic, fuzz and resource tests are evidence, not an SLA.

# Actor input Schema

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

Header required. Values remain literal, including formula-like strings. Byte limits are enforced in code.

## `delimiter` (type: `string`):

Choose the delimiter. It is never inferred.

## Actor input object example

```json
{
  "csv": "id,name\n001,Ada\n002,Grace\n",
  "delimiter": ","
}
```

# Actor output Schema

## `completion` (type: `string`):

A completed inspection may include rejected rows. Match completionId and bundleSha256 with OUTPUT and BUNDLE.zip.

## `files` (type: `string`):

Download BUNDLE.zip only when the completion receipt and OUTPUT match. On a parsing failure, inspect DIAGNOSTIC.json.

# 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": `id,name
001,Ada
002,Grace`,
    "delimiter": ","
};

// Run the Actor and wait for it to finish
const run = await client.actor("immemorial_sarinda/csv-row-rescue").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": """id,name
001,Ada
002,Grace
""",
    "delimiter": ",",
}

# Run the Actor and wait for it to finish
run = client.actor("immemorial_sarinda/csv-row-rescue").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 '{
  "csv": "id,name\\n001,Ada\\n002,Grace\\n",
  "delimiter": ","
}' |
apify call immemorial_sarinda/csv-row-rescue --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,immemorial_sarinda/csv-row-rescue"
        }
    }
}
```

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/OVx6NCfnHhrqGpEDN/builds/j8hrvyMlJ5FLfHX7l/openapi.json
