# JSON Schema Generator (`automation-lab/json-schema-generator`) Actor

Generate JSON Schema (draft-07) from sample JSON instantly. Auto-detects types, required fields, nullable values, and nested structures. Export as JSON or YAML.

- **URL**: https://apify.com/automation-lab/json-schema-generator.md
- **Developed by:** [Stas Persiianenko](https://apify.com/automation-lab) (community)
- **Categories:** Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## JSON Schema Generator

### What does JSON Schema Generator do?

**JSON Schema Generator** instantly converts sample JSON objects into a valid [JSON Schema (draft-07)](https://json-schema.org/specification-links#draft-7) — no coding required. Paste one or more JSON examples and get a complete, ready-to-use schema with correct types, required fields, nullable values, and nested structures.

It handles everything automatically: **objects, arrays, nested structures, mixed types, null values, optional fields**, and common string formats like email addresses, URLs, dates, and ISO timestamps. You can merge multiple samples into one unified schema (so optional fields are properly detected), or generate a separate schema for each sample.

The easiest way to try it: open the actor on [Apify Store](https://apify.com/automation-lab/json-schema-generator), paste your JSON into the input form, and click Run.

### Who is JSON Schema Generator for?

**Backend developers validating API responses** — your service returns JSON from a third-party API you don't control. Paste a few example responses and get a schema to validate future payloads, catch breaking changes, and document the contract.

**Frontend developers documenting data shapes** — you're working with a new dataset or API and need to understand its structure. Feed the actor 10-20 real samples and instantly see which fields are always present vs optional, what types they are, and how nested objects are shaped.

**Data engineers building pipelines** — you receive raw JSON from event streams or webhooks and need to schema-validate before loading into a database. Generate a draft-07 schema in one run, then use it with [ajv](https://ajv.js.org/), [jsonschema](https://python-jsonschema.readthedocs.io/), or any validator.

**QA engineers writing test fixtures** — use the generated schema to verify test data is structurally correct, catch regressions when upstream data changes shape, and document expected output formats in CI.

**No-code users exploring JSON datasets** — if someone sent you a JSON file and you want to understand its structure without writing code, this actor produces a human-readable summary of every field, its type, and whether it's required.

### Why use JSON Schema Generator?

- 🚀 **Instant results** — generates schemas in under 5 seconds regardless of input complexity
- 🔀 **Multi-sample merging** — feed multiple JSON examples and optional fields are correctly detected (fields missing from some samples get `["type", "null"]` type)
- 🏷️ **Auto format detection** — strings are automatically tagged with `format: email`, `format: uri`, `format: date`, `format: date-time` where applicable
- 🎯 **Correct required inference** — a field is required only if it appears in ALL your samples AND is never null
- 📦 **Nested object and array support** — recursively infers types for objects inside objects, arrays of primitives, and arrays of objects
- 📝 **JSON + YAML output** — get the schema in JSON (default) or YAML format
- 🔒 **additionalProperties control** — optionally generate strict schemas that reject unknown keys
- 🌐 **Runs via API** — automate schema generation in your CI/CD pipeline or data validation workflow
- ☁️ **No software to install** — runs on Apify cloud, works from any device

### What data can you extract?

Each schema result in the dataset includes:

| Field | Type | Description |
|-------|------|-------------|
| `sampleIndex` | integer | Schema index (0 for merged, 1-N for per-sample) |
| `schemaTitle` | string | Title embedded in the schema (from your input or auto-generated) |
| `fieldCount` | integer | Number of top-level properties in the schema |
| `requiredCount` | integer | Number of fields marked as required |
| `outputFormat` | string | `json` or `yaml` |
| `schema` | string | The generated schema as a formatted string (JSON or YAML) |
| `schemaObject` | object | The schema as a raw JSON object (useful for downstream processing) |

**Supported schema features:**
- 🔤 Type inference: `string`, `integer`, `number`, `boolean`, `array`, `object`, `null`
- 📋 Required field detection from multi-sample overlap
- 🔗 String formats: `email`, `uri`, `date`, `date-time`
- 🏗️ Nested objects and arrays (recursive, any depth)
- ⚙️ `additionalProperties: false` for strict schemas
- 🎛️ Custom `title` and `description` in the schema root

### How much does it cost to generate JSON schemas?

JSON Schema Generator uses **Pay-Per-Event pricing** — you only pay for what you generate. Prices scale down at higher Apify subscription tiers.

| Event | Free plan | Paid plans (from) |
|-------|-----------|-------------------|
| Run start | $0.005 (one-time per run) | $0.005 |
| Schema generated | $0.0023 per schema | from $0.00056 |

**Real-world cost examples (Free plan):**

| Scenario | Schemas | Cost |
|----------|---------|------|
| Single sample → 1 merged schema | 1 | ~$0.0073 |
| 10 samples merged | 1 | ~$0.0073 |
| 50 samples, per-sample mode | 50 | ~$0.1200 |
| 1000 samples, per-sample mode | 1000 | ~$2.305 |

**Free plan estimate:** Apify gives new users **$5 in free credits**. That's enough to generate ~2,150 schemas on the free plan — more than enough to evaluate the actor and set up your workflow.

Pricing is the same whether you run via the Apify Console or the API.

### How to generate a JSON Schema from sample data

1. Go to [JSON Schema Generator on Apify Store](https://apify.com/automation-lab/json-schema-generator)
2. Click **Try for free** (no credit card required for the free tier)
3. In the **JSON samples** field, paste one or more JSON objects (as a JSON array)
4. Optionally set a **Schema title** and choose **JSON** or **YAML** output format
5. Configure options: toggle **Infer required fields**, **Allow additional properties**, and **Merge all samples**
6. Click **Start** — the run completes in a few seconds
7. Open the **Dataset** tab to download your schema as JSON, CSV, or Excel

**Input JSON example (two user objects):**
```json
[
  {"id": 1, "name": "Alice", "email": "alice@example.com", "age": 30, "isActive": true},
  {"id": 2, "name": "Bob", "age": null, "isActive": false}
]
````

**Generated schema output:**

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "User",
  "type": "object",
  "properties": {
    "id": { "type": "integer" },
    "name": { "type": "string" },
    "email": { "type": ["string", "null"], "format": "email" },
    "age": { "type": ["integer", "null"] },
    "isActive": { "type": "boolean" }
  },
  "required": ["id", "name", "isActive"]
}
```

Note how `email` is optional (only in sample 1) and `age` is nullable (null in sample 2) — both correctly reflected as `["type", "null"]`.

### Input parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `samples` | array | — | **Required.** One or more JSON objects to generate a schema from |
| `schemaTitle` | string | `""` | Optional title for the `"title"` field in the generated schema |
| `schemaDescription` | string | `""` | Optional description for the `"description"` field |
| `outputFormat` | string | `"json"` | Output format: `"json"` or `"yaml"` |
| `inferRequired` | boolean | `true` | Mark fields as `required` if they appear in ALL samples and are never null |
| `allowAdditionalProperties` | boolean | `true` | When `false`, adds `"additionalProperties": false` to object schemas |
| `mergeAllSamples` | boolean | `true` | Merge all samples into one schema (recommended); when `false`, generates one schema per sample |

**Multiple samples input format:**

```json
{
  "samples": [
    {"field1": "value1", "field2": 42},
    {"field1": "value2", "field3": true}
  ],
  "schemaTitle": "MySchema",
  "inferRequired": true,
  "mergeAllSamples": true
}
```

### Output examples

**JSON output (default):**

```json
{
  "sampleIndex": 0,
  "schemaTitle": "Product",
  "fieldCount": 5,
  "requiredCount": 4,
  "outputFormat": "json",
  "schema": "{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  ...\n}",
  "schemaObject": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Product",
    "type": "object",
    "properties": {
      "url": { "type": "string", "format": "uri" },
      "price": { "type": "number" },
      "inStock": { "type": "boolean" },
      "tags": { "type": "array", "items": { "type": "string" } },
      "sku": { "type": ["string", "null"] }
    },
    "required": ["url", "price", "inStock", "tags"]
  }
}
```

**YAML output:**

```yaml
$schema: "http://json-schema.org/draft-07/schema#"
title: Product
type: object
properties:
  url:
    type: string
    format: uri
  price:
    type: number
  inStock:
    type: boolean
required:
  - url
  - price
  - inStock
```

### Tips for best results

- 🔢 **Use at least 2-3 samples** — a single sample won't distinguish required from optional fields. The more samples you provide, the more accurate the "required" inference.
- 🎯 **Include edge cases** — if some records have null values, missing fields, or different types for the same field, include those samples. The schema will reflect the full range of observed data.
- 🔗 **Real URLs get `format: uri`** — if your string field contains URLs in the samples, the generated schema will automatically include `"format": "uri"`.
- ⚠️ **Large array items** — when arrays contain many different object structures, the actor merges all item schemas. This is usually what you want, but if you have highly polymorphic arrays, consider separating them.
- 🔒 **Strict schemas** — set `allowAdditionalProperties: false` when you want to reject unknown keys in validated data (e.g., API contract validation). Leave it `true` for lenient validation.
- 📊 **Per-sample mode** — when you want to see differences across sample versions (e.g., comparing API v1 vs v2 responses), use `mergeAllSamples: false` to get one schema per record.
- ⬇️ **Download as JSON** — the `schemaObject` field in each result is the raw JSON you can copy directly into your project.

### Integrations

**JSON Schema Generator → GitHub Actions (CI schema validation)**

Generate schemas from production data samples, commit them to your repo, and run validation in CI. Every time your upstream API changes shape, your tests catch it:

1. Run JSON Schema Generator on a set of real API response samples
2. Download the `schemaObject` from the dataset
3. Commit it to your repo as `schemas/api-response.json`
4. In CI, validate new responses against the stored schema with `ajv`

**JSON Schema Generator → Google Sheets (documentation workflow)**

Teams maintaining API documentation use this actor to auto-generate field documentation:

1. Paste 10-20 API response examples into the actor
2. Export the dataset to Google Sheets via [Apify's Google Sheets integration](https://apify.com/apify/google-sheets-import-export)
3. The `fieldCount`, `requiredCount`, and formatted `schema` columns give a clear table of what changed across schema versions

**JSON Schema Generator → Make / Zapier (automated schema monitoring)**

Monitor a webhook payload for schema drift:

1. Schedule the actor to run daily with fresh samples
2. Connect the Apify trigger in Make or Zapier
3. Compare `fieldCount` and `requiredCount` against baseline — alert via Slack when they change

**JSON Schema Generator → Apify Dataset → Your database**

Use the `schemaObject` field directly from the Apify dataset API to automate schema ingestion into your app:

```javascript
const dataset = await client.dataset(datasetId).listItems();
const schema = dataset.items[0].schemaObject;
await db.schemas.insert({ name: 'my-schema', schema });
```

### Using the Apify API

Run JSON Schema Generator programmatically from your code — no browser needed.

#### Node.js

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

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('automation-lab/json-schema-generator').call({
    samples: [
        { id: 1, name: 'Alice', email: 'alice@example.com', age: 30 },
        { id: 2, name: 'Bob', age: null },
    ],
    schemaTitle: 'User',
    outputFormat: 'json',
    inferRequired: true,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].schemaObject);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient(token='YOUR_APIFY_TOKEN')

run = client.actor('automation-lab/json-schema-generator').call(run_input={
    'samples': [
        {'id': 1, 'name': 'Alice', 'email': 'alice@example.com', 'age': 30},
        {'id': 2, 'name': 'Bob', 'age': None},
    ],
    'schemaTitle': 'User',
    'outputFormat': 'json',
    'inferRequired': True,
})

items = client.dataset(run['defaultDatasetId']).list_items().items
print(items[0]['schemaObject'])
```

#### cURL

```bash
curl -s -X POST \
  "https://api.apify.com/v2/acts/automation-lab~json-schema-generator/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "samples": [
      {"id": 1, "name": "Alice", "email": "alice@example.com"},
      {"id": 2, "name": "Bob"}
    ],
    "schemaTitle": "User",
    "outputFormat": "json"
  }'
```

Then poll `GET /v2/actor-runs/{runId}` for status and fetch results from the default dataset.

### Use with AI agents via MCP

JSON Schema Generator is available as a tool for AI assistants that support the [Model Context Protocol (MCP)](https://docs.apify.com/platform/integrations/mcp).

Add the Apify MCP server to your AI client — this gives you access to all Apify actors, including this one:

#### Setup for Claude Code

```bash
claude mcp add --transport http apify "https://mcp.apify.com"
```

#### Setup for Claude Desktop, Cursor, or VS Code

Add this to your MCP config file:

```json
{
    "mcpServers": {
        "apify": {
            "url": "https://mcp.apify.com"
        }
    }
}
```

Your AI assistant will use OAuth to authenticate with your Apify account on first use.

#### Example prompts

Once connected, try asking your AI assistant:

- "Use automation-lab/json-schema-generator to generate a draft-07 schema from these API response samples: \[paste JSON]"
- "I have these webhook payloads — generate a JSON Schema so I can validate future payloads against it"
- "Generate a strict schema (no additional properties) from these 5 sample records and show me which fields are required"

Learn more in the [Apify MCP documentation](https://docs.apify.com/platform/integrations/mcp).

### Is it legal to use JSON Schema Generator?

Yes. JSON Schema Generator performs **pure local computation** — it does not scrape any website, call any external API, or access any third-party data. It takes JSON data you already have and transforms it mathematically into a schema. There are no Terms of Service concerns, no GDPR issues with third-party data, and no ethical considerations around scraping.

You are responsible for ensuring the JSON samples you provide do not contain personal data you're not authorized to process.

### FAQ

**How fast is JSON Schema Generator?**
Typically under 5 seconds for any input size. The actor performs pure in-memory computation — there's no network I/O, no browser, no proxy. Even 1,000 samples completes in seconds.

**How much does it cost?**
$0.005 to start + $0.0023 per schema generated (free plan). Generating a single merged schema from any number of samples costs ~$0.0073 total. The Apify free tier ($5 credits) covers ~2,150 schemas.

**How is this different from running a JSON Schema library locally?**
Running `jsonschema-gen` or similar locally requires installing Node.js or Python, writing code, and handling I/O. This actor gives you the same capability via a web UI, a REST API, and Zapier/Make integrations — no setup, any language, any device. It's also pre-integrated with the Apify ecosystem for scheduling, webhooks, and data export.

**Why are some fields `["string", "null"]` instead of just `"string"`?**
A field gets a nullable type (`["string", "null"]`) in two cases: (1) the field is missing from at least one sample (so it could be absent/null in new data), or (2) the field is present in all samples but had a `null` value in at least one. This is correct draft-07 behavior for optional/nullable fields.

**Why are my required fields fewer than expected?**
A field is only marked `required` if it appears in **every** sample AND is never `null` in any sample. If you want more required fields, provide more samples that consistently include those fields with non-null values, or disable `inferRequired` and manually define requirements.

**The schema shows `"type": "integer"` but I expected `"number"` — why?**
Integer detection is automatic: if every observed value for a field has no decimal component (`Number.isInteger(value)` is true), the type is `integer`. If any value has a decimal (like `4.5`), the type becomes `number`. To force `number`, include at least one decimal value in your samples.

**Output shows an empty `items: {}` for an array — what does that mean?**
This happens when an array field was empty (`[]`) in all samples, so no item type could be inferred. Provide at least one sample where that array has items and re-run to get a proper items schema.

### Other developer tools

Explore other utility actors from [automation-lab](https://apify.com/automation-lab):

- 🔒 [Base64 Converter](https://apify.com/automation-lab/base64-converter) — encode/decode Base64 strings in bulk
- 🌐 [AAAA Record Checker](https://apify.com/automation-lab/aaaa-record-checker) — check IPv6 DNS records for domains
- ♿ [Accessibility Checker](https://apify.com/automation-lab/accessibility-checker) — automated WCAG accessibility audit
- 📄 [Ads.txt Checker](https://apify.com/automation-lab/ads-txt-checker) — validate ads.txt files for publishers
- 🔍 [Apify Store Analyzer](https://apify.com/automation-lab/apify-store-analyzer) — analyze and compare Apify Store actor listings

# Actor input Schema

## `samples` (type: `array`):

Provide one or more sample JSON objects. Multiple samples are merged — fields that appear in some samples but not all are marked optional.

## `schemaTitle` (type: `string`):

Optional title to embed in the generated schema's 'title' field.

## `schemaDescription` (type: `string`):

Optional description to embed in the generated schema's 'description' field.

## `outputFormat` (type: `string`):

Choose JSON (default) or YAML output format for the generated schema.

## `inferRequired` (type: `boolean`):

Mark fields as required if they appear in ALL provided samples. When disabled, no fields are required.

## `allowAdditionalProperties` (type: `boolean`):

Set additionalProperties: false in generated object schemas to reject extra keys.

## `mergeAllSamples` (type: `boolean`):

When enabled, all samples are merged into one unified schema. When disabled, each sample generates its own separate schema.

## Actor input object example

```json
{
  "samples": [
    {
      "id": 1,
      "name": "Alice",
      "email": "alice@example.com",
      "age": 30,
      "isActive": true,
      "tags": [
        "admin",
        "user"
      ],
      "address": {
        "city": "New York",
        "zip": "10001"
      }
    },
    {
      "id": 2,
      "name": "Bob",
      "age": null,
      "isActive": false,
      "tags": [],
      "address": {
        "city": "London",
        "zip": "SW1A"
      }
    }
  ],
  "schemaTitle": "My Schema",
  "schemaDescription": "",
  "outputFormat": "json",
  "inferRequired": true,
  "allowAdditionalProperties": true,
  "mergeAllSamples": true
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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 = {
    "samples": [
        {
            "id": 1,
            "name": "Alice",
            "email": "alice@example.com",
            "age": 30,
            "isActive": true,
            "tags": [
                "admin",
                "user"
            ],
            "address": {
                "city": "New York",
                "zip": "10001"
            }
        },
        {
            "id": 2,
            "name": "Bob",
            "age": null,
            "isActive": false,
            "tags": [],
            "address": {
                "city": "London",
                "zip": "SW1A"
            }
        }
    ],
    "schemaTitle": "My Schema"
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/json-schema-generator").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 = {
    "samples": [
        {
            "id": 1,
            "name": "Alice",
            "email": "alice@example.com",
            "age": 30,
            "isActive": True,
            "tags": [
                "admin",
                "user",
            ],
            "address": {
                "city": "New York",
                "zip": "10001",
            },
        },
        {
            "id": 2,
            "name": "Bob",
            "age": None,
            "isActive": False,
            "tags": [],
            "address": {
                "city": "London",
                "zip": "SW1A",
            },
        },
    ],
    "schemaTitle": "My Schema",
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/json-schema-generator").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 '{
  "samples": [
    {
      "id": 1,
      "name": "Alice",
      "email": "alice@example.com",
      "age": 30,
      "isActive": true,
      "tags": [
        "admin",
        "user"
      ],
      "address": {
        "city": "New York",
        "zip": "10001"
      }
    },
    {
      "id": 2,
      "name": "Bob",
      "age": null,
      "isActive": false,
      "tags": [],
      "address": {
        "city": "London",
        "zip": "SW1A"
      }
    }
  ],
  "schemaTitle": "My Schema"
}' |
apify call automation-lab/json-schema-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=automation-lab/json-schema-generator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "JSON Schema Generator",
        "description": "Generate JSON Schema (draft-07) from sample JSON instantly. Auto-detects types, required fields, nullable values, and nested structures. Export as JSON or YAML.",
        "version": "0.1",
        "x-build-id": "dOUAg69Op6pwZJmV5"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/automation-lab~json-schema-generator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-automation-lab-json-schema-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/automation-lab~json-schema-generator/runs": {
            "post": {
                "operationId": "runs-sync-automation-lab-json-schema-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/automation-lab~json-schema-generator/run-sync": {
            "post": {
                "operationId": "run-sync-automation-lab-json-schema-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "samples"
                ],
                "properties": {
                    "samples": {
                        "title": "JSON samples",
                        "type": "array",
                        "description": "Provide one or more sample JSON objects. Multiple samples are merged — fields that appear in some samples but not all are marked optional."
                    },
                    "schemaTitle": {
                        "title": "Schema title",
                        "type": "string",
                        "description": "Optional title to embed in the generated schema's 'title' field.",
                        "default": ""
                    },
                    "schemaDescription": {
                        "title": "Schema description",
                        "type": "string",
                        "description": "Optional description to embed in the generated schema's 'description' field.",
                        "default": ""
                    },
                    "outputFormat": {
                        "title": "Output format",
                        "enum": [
                            "json",
                            "yaml"
                        ],
                        "type": "string",
                        "description": "Choose JSON (default) or YAML output format for the generated schema.",
                        "default": "json"
                    },
                    "inferRequired": {
                        "title": "Infer required fields",
                        "type": "boolean",
                        "description": "Mark fields as required if they appear in ALL provided samples. When disabled, no fields are required.",
                        "default": true
                    },
                    "allowAdditionalProperties": {
                        "title": "Allow additional properties",
                        "type": "boolean",
                        "description": "Set additionalProperties: false in generated object schemas to reject extra keys.",
                        "default": true
                    },
                    "mergeAllSamples": {
                        "title": "Merge all samples",
                        "type": "boolean",
                        "description": "When enabled, all samples are merged into one unified schema. When disabled, each sample generates its own separate schema.",
                        "default": true
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
