{
  "openapi": "3.0.1",
  "info": {
    "title": "JSON Transformer - jq & JMESPath for Datasets, APIs, Files",
    "description": "Reshape any JSON with a jq or JMESPath expression: an Apify dataset, a JSON or JSON Lines URL, a key-value record or pasted JSON. Flatten, cast, rename, then save to a dataset or a CSV, XLSX, JSON or JSONL file. The glue step for n8n, Make and Apify integrations.",
    "version": "0.1",
    "x-build-id": "WKOYMTYsyeTFaNo4d"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gazidev~json-transformer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gazidev-json-transformer",
        "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/gazidev~json-transformer/runs": {
      "post": {
        "operationId": "runs-sync-gazidev-json-transformer",
        "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/gazidev~json-transformer/run-sync": {
      "post": {
        "operationId": "run-sync-gazidev-json-transformer",
        "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",
        "properties": {
          "jsonUrl": {
            "title": "JSON / JSON Lines URL",
            "type": "string",
            "description": "Public URL of a JSON document, a REST API endpoint or a JSON Lines (NDJSON) file. GitHub 'blob', Dropbox and Google Drive file links are turned into direct downloads. Use exactly one source."
          },
          "datasetId": {
            "title": "Apify dataset",
            "type": "string",
            "description": "An Apify dataset ID, e.g. the output of a scraper run. In an integration or webhook use {{resource.defaultDatasetId}}. The Actor can read your own datasets and public ones; another user's private dataset is not accessible."
          },
          "kvStoreId": {
            "title": "Key-value store (for a record)",
            "type": "string",
            "description": "Key-value store that holds a JSON record (e.g. the OUTPUT of another Actor run). Use together with 'Record key'."
          },
          "kvRecordKey": {
            "title": "Record key",
            "type": "string",
            "description": "Key of the JSON record in the key-value store above, e.g. OUTPUT."
          },
          "inlineJson": {
            "title": "Or paste JSON",
            "type": "string",
            "description": "Paste a JSON document or JSON Lines directly (handy for quick tests, n8n / Make and AI agents)."
          },
          "engine": {
            "title": "Expression language",
            "enum": [
              "jq",
              "jmespath"
            ],
            "type": "string",
            "description": "jq (full jq language via libjq: select, map, group_by, reduce, string functions, $variables) or JMESPath (the AWS CLI query language).",
            "default": "jq"
          },
          "expression": {
            "title": "Expression",
            "type": "string",
            "description": "jq example: '.[] | select(.age > 30) | {name, city: .address.city}'. JMESPath example: \"[?age > `30`].{name: name, city: address.city}\". Empty = pass the input through ('.' / '@')."
          },
          "perItem": {
            "title": "Apply to each item separately",
            "type": "boolean",
            "description": "Off (default): the expression gets the whole document (for a dataset: the array of all items), like 'jq' on a file. On: the expression runs once per item (array element / dataset item / JSON line), like 'jq -c' on JSON Lines; datasets are then streamed page by page with low memory. Items for which the expression returns nothing (e.g. select() fails) are dropped.",
            "default": false
          },
          "jqVariables": {
            "title": "jq variables",
            "type": "object",
            "description": "Named values available as $name in a jq expression, e.g. {\"minPrice\": 10} -> 'select(.price >= $minPrice)'."
          },
          "onItemError": {
            "title": "When the expression fails on an item",
            "enum": [
              "skip",
              "fail"
            ],
            "type": "string",
            "description": "Skip the item (errors are counted and sampled in OUTPUT, never charged) or fail the run.",
            "default": "skip"
          },
          "explodeArrays": {
            "title": "One row per array element",
            "type": "boolean",
            "description": "When the expression returns an array (e.g. 'map(...)' or a JMESPath projection), output each element as its own row. Off = keep the array in one row under the value field.",
            "default": true
          },
          "valueField": {
            "title": "Field name for non-object results",
            "type": "string",
            "description": "Dataset rows must be objects, so a number / string / array result x becomes {\"value\": x}.",
            "default": "value"
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn {\"address\": {\"city\": \"Paris\"}} into {\"address.city\": \"Paris\"} after the expression.",
            "default": false
          },
          "flattenSeparator": {
            "title": "Flatten separator",
            "type": "string",
            "description": "Separator between nested key names.",
            "default": "."
          },
          "flattenArrays": {
            "title": "Arrays when flattening",
            "enum": [
              "keep",
              "join",
              "index"
            ],
            "type": "string",
            "description": "Keep arrays as they are, join simple arrays into 'a, b, c', or expand to indexed columns (tags.0, tags.1).",
            "default": "keep"
          },
          "castMap": {
            "title": "Convert types",
            "type": "object",
            "description": "Field -> string | number | integer | boolean | json | array, e.g. {\"lat\": \"number\"}. Text like '$1,299' or '15%' becomes a number. Uses names after flattening, before renaming."
          },
          "castFailure": {
            "title": "When a value cannot be converted",
            "enum": [
              "null",
              "keep",
              "dropRow"
            ],
            "type": "string",
            "description": "Set it to null, keep the original value, or drop the row.",
            "default": "null"
          },
          "renameMap": {
            "title": "Rename fields",
            "type": "object",
            "description": "Old name -> new name, e.g. {\"company\": \"companyName\"}. Applied after casting."
          },
          "selectFields": {
            "title": "Keep only these fields (in order)",
            "type": "array",
            "description": "Output only these fields, in this order (names after renaming). Empty = keep all.",
            "items": {
              "type": "string"
            }
          },
          "removeNullFields": {
            "title": "Remove null fields",
            "type": "boolean",
            "description": "Drop fields whose value is null.",
            "default": false
          },
          "outputToDataset": {
            "title": "Save rows to dataset",
            "type": "boolean",
            "description": "Write the result rows to this run's dataset (download as JSON, CSV, Excel or use in integrations).",
            "default": true
          },
          "outputFormat": {
            "title": "Also save as a file",
            "enum": [
              "none",
              "json",
              "jsonl",
              "csv",
              "xlsx"
            ],
            "type": "string",
            "description": "Save all result rows as one file in the key-value store; its public link is in the OUTPUT record. CSV and XLSX write nested values as JSON text (turn on 'Flatten' for columns).",
            "default": "none"
          },
          "fileName": {
            "title": "File name",
            "type": "string",
            "description": "Base name of the file (the extension is added).",
            "default": "transformed"
          },
          "maxItems": {
            "title": "Max output rows",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many output rows (0 = no limit).",
            "default": 0
          },
          "maxInputItems": {
            "title": "Max input items",
            "minimum": 0,
            "type": "integer",
            "description": "Read at most this many dataset items / array elements (0 = all). Useful for previews of big datasets.",
            "default": 0
          },
          "httpHeaders": {
            "title": "HTTP headers for the URL",
            "type": "object",
            "description": "Optional request headers for the JSON URL, e.g. {\"Authorization\": \"Bearer ...\"} for your own API. Stored in the run input; use a secret-free token where possible."
          },
          "maxFileSizeMb": {
            "title": "Max download size (MB)",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Larger URL downloads are refused (nothing is charged).",
            "default": 200
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}