# Nested JSON Contract Check (`godmind/my-actor`) Actor

Validate up to 1,000 JSON records against a finite nested typed contract. Get strict structural checks and precise field paths before the next workflow step. Not full JSON Schema, factual verification, coercion or repair. $0.02 per completed report plus the listed Actor start fee.

- **URL**: https://apify.com/godmind/my-actor.md
- **Developed by:** [Godmind](https://apify.com/godmind) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 completed validation reports

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

## Nested JSON contract check

Check a batch of JSON records against a small, explicit typed contract. Useful for an agent checking structured output before passing it to another step.

This is a finite contract checker, not a complete JSON Schema validator. It does not repair records or convert types. No LLM or external lookup is used by the validation engine.

### Input

Supply the complete request as a **string** in `request_json`. Keeping the JSON as text allows duplicate object keys and non-finite number literals to be refused.

```json
{"request_json":"{\"contract\":{\"type\":\"object\",\"required\":[\"id\"],\"properties\":{\"id\":{\"type\":\"string\"}}},\"records\":[{\"id\":\"A1\"},{\"id\":2}]}"}
```

The example produces FAIL with a TYPE_MISMATCH at /id in record 1 (zero-based). It is a fictional example.

### Contract profile

Each contract node must name one type: object, array, string, integer, number, boolean or null. The supported keywords are type, properties, required, additionalProperties and items. No enum, bounds, patterns, references, unions or custom code. Unsupported syntax is refused.

Limits: 1 MiB request text; 1000 records; 2000 contract nodes; 50000 total record nodes; depth 20. At most 50 issue details are returned, with exact issue totals and a truncation indicator.

### Output

The report is available as one item in the run's default dataset and through the OUTPUT key. PASS means all supplied records conform. FAIL is a completed check with violations. INVALID_REQUEST means the request was refused, not that the records failed validation. Issues use zero-based record indexes, JSON Pointer paths and codes.

The billing output links to BILLING. Engine completed_report_event metadata is synthetic; it is not a payment receipt. The adapter persists the report before a completion-charge attempt. Ambiguous charge outcomes are marked UNKNOWN_NEEDS_RECONCILIATION and are not blindly retried.

### Pricing and availability

A completed PASS or FAIL validation report costs USD0.02 for up to 1000 records. The separately listed Actor start fee also applies; its event count depends on allocated memory (minimum one event). Platform usage is included in the listed pricing. No automatic per-record fee is configured. An INVALID_REQUEST has no completed-report event, but may still incur the Actor start fee. Use the platform run-charge limit to control your maximum charge.

The package passed local SDK/container checks and one private hosted synthetic sample. Paid collection, paid-run idempotency, customer results, payout and high-volume economics have not been demonstrated. This is a finite-profile structural checker, not a complete JSON Schema validator or factual verifier.

### Data handling

Do not submit credentials or sensitive personal data. The engine does not put record values in issue diagnostics, but the hosting platform receives your request and may retain run input and storage under its own policies. This tool does not establish correctness of the real-world facts in your records.

# Actor input Schema

## `request_json` (type: `string`):

ONE complete engine request as JSON TEXT: {"contract": \<parsnip-contract-profile/v0 tree>, "records": \[ ... ]}. It is passed to the checker as the exact bytes you supply, so duplicate object keys, non-finite number literals and invalid encoding are detected and refused rather than silently rewritten. Limits: 1 MiB, 1000 records, 50000 record nodes, depth 20.

## Actor input object example

```json
{
  "request_json": "{\"contract\":{\"type\":\"object\",\"required\":[\"id\"],\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"}}},\"records\":[{\"id\":\"a\"},{\"id\":2}]}"
}
```

# Actor output Schema

## `report` (type: `string`):

PASS, FAIL or INVALID_REQUEST. Structural diagnostics do not include record values.

## `billing` (type: `string`):

Actual adapter charge status; uncertain results require reconciliation.

# 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 = {
    "request_json": "{\"contract\":{\"type\":\"object\",\"required\":[\"id\"],\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"}}},\"records\":[{\"id\":\"a\"},{\"id\":2}]}"
};

// Run the Actor and wait for it to finish
const run = await client.actor("godmind/my-actor").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 = { "request_json": "{\"contract\":{\"type\":\"object\",\"required\":[\"id\"],\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"}}},\"records\":[{\"id\":\"a\"},{\"id\":2}]}" }

# Run the Actor and wait for it to finish
run = client.actor("godmind/my-actor").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 '{
  "request_json": "{\\"contract\\":{\\"type\\":\\"object\\",\\"required\\":[\\"id\\"],\\"additionalProperties\\":false,\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"}}},\\"records\\":[{\\"id\\":\\"a\\"},{\\"id\\":2}]}"
}' |
apify call godmind/my-actor --silent --output-dataset

```

## MCP server setup

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

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/1hJ5S8jy7ALu1XB1U/builds/8S1lE55kajH6sxaON/openapi.json
