{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Data Enricher — Add AI Columns to Any Dataset",
    "description": "Add AI columns to any Apify dataset, CSV or JSON file: classify, extract, score, summarize or translate every row. Input: a dataset ID, a file URL or inline rows, one instruction and the output fields you define. Output: each row plus your new fields, with fixed names and types.",
    "version": "0.1",
    "x-build-id": "vpUnrDe0Pnj5LCSbe"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/istmobot~ai-data-enricher/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-istmobot-ai-data-enricher",
        "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/istmobot~ai-data-enricher/runs": {
      "post": {
        "operationId": "runs-sync-istmobot-ai-data-enricher",
        "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/istmobot~ai-data-enricher/run-sync": {
      "post": {
        "operationId": "run-sync-istmobot-ai-data-enricher",
        "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": [
          "instruction",
          "outputFields"
        ],
        "properties": {
          "datasetId": {
            "title": "Apify dataset",
            "type": "string",
            "description": "A dataset from your account, for example the output of a scraper run. Pick it from the list or paste its ID, e.g. \"aBcD1234efGH5678ij\"; \"username~dataset-name\" works too. The Actor only reads it. Use exactly one data source: a dataset, a file URL or inline rows."
          },
          "fileUrl": {
            "title": "File URL (CSV, JSON or JSONL)",
            "type": "string",
            "description": "Public link to a UTF-8 text file of up to 10 MB, e.g. https://example.com/reviews.csv. CSV needs a header row (comma, semicolon or tab separated). JSON must be an array of objects. JSONL has one object per line. The format is detected from the content."
          },
          "items": {
            "title": "Rows as JSON (clear this field when you use a dataset or a file)",
            "type": "array",
            "description": "Rows pasted as a JSON array of objects, e.g. [{\"review\":\"Great sound\"},{\"review\":\"Broke in a week\"}]. A list of plain texts also works: each text becomes a row with one field named \"value\"."
          },
          "instruction": {
            "title": "Instruction",
            "maxLength": 1500,
            "type": "string",
            "description": "What the AI should do with each row, in plain words, up to 1,500 characters. E.g. \"Classify the sentiment of the review and name the main complaint in at most 8 words.\" The AI reads one row at a time and answers only from that row."
          },
          "outputFields": {
            "title": "Output fields (your new columns)",
            "type": "array",
            "description": "1 to 12 new fields as a JSON array. Each one has a \"name\" (letters, digits and _), a \"type\" (text, number, boolean, list or category), an optional \"description\", and \"options\" when the type is category. E.g. [{\"name\":\"sentiment\",\"type\":\"category\",\"options\":[\"positive\",\"neutral\",\"negative\"]},{\"name\":\"score\",\"type\":\"number\",\"description\":\"1 to 5\"}]. A value the row does not contain comes back as null (an empty list for a list field). The whole answer for a row is limited to about 200 words, so ask for short texts."
          },
          "inputFields": {
            "title": "Fields the AI reads",
            "type": "array",
            "description": "Names of the row fields to send to the AI, one per line, e.g. \"title\" and \"text\". Leave empty to send every field. Sending only what the task needs gives better answers and keeps long rows under the character limit. Nested objects are sent as compact JSON.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Max rows",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many rows, e.g. 100. You pay per enriched row.",
            "default": 100
          },
          "offset": {
            "title": "Skip rows",
            "minimum": 0,
            "type": "integer",
            "description": "Skip this many rows at the start of the data, e.g. 100 to continue after a first run of 100 rows.",
            "default": 0
          },
          "maxInputCharsPerRow": {
            "title": "Max characters read per row",
            "minimum": 100,
            "maximum": 12000,
            "type": "integer",
            "description": "The AI reads each row as compact JSON. A row longer than this many characters is cut and the AI reads only the start, e.g. 6000. The hard maximum is 12000. Chinese, Japanese and Korean characters count as 3.5 characters each, because they cost that much more to read. Put the important fields first with \"Fields the AI reads\".",
            "default": 6000
          },
          "keepOriginalFields": {
            "title": "Keep the original fields",
            "type": "boolean",
            "description": "On: each output row has its original fields plus the new ones, e.g. {\"review\":\"…\",\"sentiment\":\"negative\"}. A new field whose name the row already uses is written as ai_<name>. Off: only rowIndex (the row's position in the data, starting at 0) and the new fields.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}