Loading...
Loading...
Generate output schemas (dataset_schema.json, output_schema.json, key_value_store_schema.json) for an Apify Actor by analyzing its source code. Use when creating or updating Actor output schemas.
npx skill4agent add apify/agent-skills apify-generate-output-schemadataset_schema.jsonoutput_schema.jsonkey_value_store_schema.jsonactor.json"nullable": true.actor/actor.jsonactor.jsondataset_schema.jsonoutput_schema.jsonkey_value_store_schema.json.actor/**/dataset_schema.json**/output_schema.json**/key_value_store_schema.jsonActor.pushData(dataset.pushData(Dataset.pushData(Actor.push_data(dataset.push_data(Dataset.push_data(Actor.setValue(keyValueStore.setValue(KeyValueStore.setValue(Actor.set_value(key_value_store.set_value(KeyValueStore.set_value(src/types/src/types/output.tsstorages.datasetstorages.keyValueStoreactor.jsondataset_schema.json{
"actorSpecification": 1,
"fields": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
// ALL output fields here — every field the Actor can produce,
// not just the ones shown in the overview view
},
"required": [],
"additionalProperties": true
},
"views": {
"overview": {
"title": "Overview",
"description": "Most important fields at a glance",
"transformation": {
"fields": [
// 8-12 most important field names
]
},
"display": {
"component": "table",
"properties": {
// Display config for each overview field
}
}
}
}
}| Rule | Detail |
|---|---|
All fields in | The |
| On every field — APIs are unpredictable |
| On the top-level |
| Always empty array — on the top-level |
| Anonymized examples | No real user IDs, usernames, or content |
| AJV rejects |
Warning — most common mistakes:
- Only including fields that appear in the overview view. The
must list ALL output fields, even if they are not in thefields.propertiessection.views- Only adding
and"required": []on nested object-type properties but forgetting them on the top-level"additionalProperties": trueobject. Both levels need them.fields
Note:is an Apify-specific extension to JSON Schema draft-07. It is intentional and correct.nullable
"title": {
"type": "string",
"description": "Title of the scraped item",
"nullable": true,
"example": "Example Item Title"
}"viewCount": {
"type": "number",
"description": "Number of views",
"nullable": true,
"example": 15000
}"isVerified": {
"type": "boolean",
"description": "Whether the account is verified",
"nullable": true,
"example": true
}"hashtags": {
"type": "array",
"description": "Hashtags associated with the item",
"items": { "type": "string" },
"nullable": true,
"example": ["#example", "#demo"]
}"authorInfo": {
"type": "object",
"description": "Information about the author",
"properties": {
"name": { "type": "string", "nullable": true },
"url": { "type": "string", "nullable": true }
},
"required": [],
"additionalProperties": true,
"nullable": true,
"example": { "name": "Example Author", "url": "https://example.com/author" }
}"contentType": {
"type": "string",
"description": "Type of content",
"enum": ["article", "video", "image"],
"nullable": true,
"example": "article"
}ObjectType | string"metadata": {
"type": ["object", "string"],
"description": "Structured metadata object, or error string if unavailable",
"nullable": true,
"example": { "key": "value" }
}| Field type | Example approach |
|---|---|
| IDs | Match platform format and length (e.g., 11 chars for YouTube video IDs) |
| Usernames | |
| Display names | |
| URLs | Use platform's standard URL format with fake IDs |
| Dates | |
| Text content | Generic descriptive text, e.g., |
transformation.fieldsdisplay.propertieslabelformat"text""number""date""link""boolean""image""array""object"key_value_store_schema.jsonSkip this phase if no/Actor.setValue()calls were found in Phase 1 (beyond the defaultActor.set_value()key).INPUT
{
"actorKeyValueStoreSchemaVersion": 1,
"title": "<Descriptive title — what the key-value store contains>",
"description": "<One sentence describing the stored data>",
"collections": {
"<collectionName>": {
"title": "<Human-readable title>",
"description": "<What this collection contains>",
"keyPrefix": "<prefix->"
}
}
}setValueset_value"RESULTS""summary""key""screenshot-${id}"f"image-{name}""keyPrefix"| Property | Required | Description |
|---|---|---|
| Yes | Shown in UI tabs |
| No | Shown in UI tooltips |
| Conditional | Exact key for single-key collections (use |
| Conditional | Prefix for multi-key collections (use |
| No | Restrict allowed MIME types (e.g., |
| No | JSON Schema draft-07 for validating |
{
"actorKeyValueStoreSchemaVersion": 1,
"title": "Analysis Results",
"description": "Key-value store containing analysis output",
"collections": {
"report": {
"title": "Report",
"description": "Final analysis report",
"key": "REPORT",
"contentTypes": ["application/json"]
}
}
}{
"actorKeyValueStoreSchemaVersion": 1,
"title": "Scraped Files",
"description": "Key-value store containing downloaded files and screenshots",
"collections": {
"screenshots": {
"title": "Screenshots",
"description": "Page screenshots captured during scraping",
"keyPrefix": "screenshot-",
"contentTypes": ["image/png", "image/jpeg"]
},
"documents": {
"title": "Documents",
"description": "Downloaded document files",
"keyPrefix": "doc-",
"contentTypes": ["application/pdf", "text/html"]
}
}
}output_schema.json{
"actorOutputSchemaVersion": 1,
"title": "<Descriptive title — what the Actor returns>",
"description": "<One sentence describing the output data>",
"properties": {
"dataset": {
"type": "string",
"title": "Results",
"description": "Dataset containing all scraped data",
"template": "{{links.apiDefaultDatasetUrl}}/items"
}
}
}Critical: Each property entry must include— this is an Apify-specific convention. The Apify meta-validator rejects properties without it (and rejects"type": "string"— only"type": "object"is valid here)."string"
key_value_store_schema.json"files": {
"type": "string",
"title": "Files",
"description": "Key-value store containing downloaded files",
"template": "{{links.apiDefaultKeyValueStoreUrl}}/keys"
}{{links.apiDefaultDatasetUrl}}{{links.apiDefaultKeyValueStoreUrl}}{{links.publicRunUrl}}{{links.consoleRunUrl}}{{links.apiRunUrl}}{{links.containerRunUrl}}{{run.defaultDatasetId}}{{run.defaultKeyValueStoreId}}actor.jsonactor.jsonstorages.dataset"storages": {
"dataset": "./dataset_schema.json"
}key_value_store_schema.json"storages": {
"dataset": "./dataset_schema.json",
"keyValueStore": "./key_value_store_schema.json"
}output"output": "./output_schema.json"actor.jsonstorages.datasetstorages.keyValueStoredataset_schema.jsonfields.properties"nullable": truefields"additionalProperties": true"required": []properties"additionalProperties": true"required": []"description""example""type""nullable"output_schema.json"type": "string"key_value_store_schema.jsonsetValueset_valuekeykeyPrefixactor.jsonapify run