{
  "openapi": "3.0.1",
  "info": {
    "title": "Python & JS Code Runner - $0.50/1K Rows, No API Key",
    "description": "Paste a transform(row) function in Python or JavaScript, give rows as JSON or an Apify dataset ID, get the returned rows in a dataset. One process per run (about 0.1 ms per row after start), per-row errors with line numbers, time and memory limits, filter/split rows, only-new mode with monitorId. Ca",
    "version": "0.1",
    "x-build-id": "dnefhhKYS2wrkQw11"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/martin10291~code-runner-sandbox/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-martin10291-code-runner-sandbox",
        "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/martin10291~code-runner-sandbox/runs": {
      "post": {
        "operationId": "runs-sync-martin10291-code-runner-sandbox",
        "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/martin10291~code-runner-sandbox/run-sync": {
      "post": {
        "operationId": "run-sync-martin10291-code-runner-sandbox",
        "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": [
          "code"
        ],
        "properties": {
          "language": {
            "title": "Language",
            "enum": [
              "python",
              "javascript"
            ],
            "type": "string",
            "description": "Language of your code: python (Python 3.12, standard library) or javascript (Node.js, async allowed).",
            "default": "python"
          },
          "code": {
            "title": "Your code",
            "type": "string",
            "description": "Define a function transform(row). It gets one input row (a dict / object) and returns a dict, a list of dicts (one row becomes many) or None (row is dropped = filter). print()/console.log output is kept per row in the ERRORS record when a row fails."
          },
          "rows": {
            "title": "Input rows (JSON)",
            "type": "array",
            "description": "Rows to process, as a JSON array of objects (or values). Used together with datasetId if both are given."
          },
          "datasetId": {
            "title": "Apify dataset ID (optional)",
            "type": "string",
            "description": "Read the input rows from this Apify dataset (for example the output of another actor run in your account). Leave empty to use only the rows field."
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 200000,
            "type": "integer",
            "description": "Process at most this many input rows in one run.",
            "default": 1000
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "result",
              "merge"
            ],
            "type": "string",
            "description": "result = only the fields your function returns; merge = the input row plus the returned fields (returned fields win).",
            "default": "result"
          },
          "rowTimeoutSecs": {
            "title": "Time limit per row (seconds)",
            "minimum": 0.1,
            "maximum": 300,
            "type": "number",
            "description": "A row that takes longer is stopped and reported as an error; the other rows continue.",
            "default": 10
          },
          "totalTimeoutSecs": {
            "title": "Total time limit (seconds)",
            "minimum": 5,
            "maximum": 3500,
            "type": "integer",
            "description": "Wall-clock limit for running your code on all rows. Rows not finished in time are reported as errors.",
            "default": 600
          },
          "memoryLimitMb": {
            "title": "Memory limit for your code (MB)",
            "minimum": 64,
            "maximum": 16384,
            "type": "integer",
            "description": "Memory cap for the child process that runs your code (keep it below the run memory).",
            "default": 1024
          },
          "includeErrorRows": {
            "title": "Put error rows in the dataset",
            "type": "boolean",
            "description": "Off (default): failed rows go only to the ERRORS key-value record and you pay nothing for them. On: they are also added to the dataset with _error and _input fields.",
            "default": false
          },
          "monitorId": {
            "title": "Only-new monitor ID (optional)",
            "type": "string",
            "description": "Give any name (for example daily-leads) to remember results between runs: rows whose output did not change since the last run with the same ID are skipped, new/changed rows get first_seen, changed_at and is_new."
          },
          "keyField": {
            "title": "Row key field for only-new mode (optional)",
            "type": "string",
            "description": "Field that identifies a row across runs (for example id or url). Empty = the whole input row is the key."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}