{
  "openapi": "3.0.1",
  "info": {
    "title": "42 Polars AI Data Transformer",
    "description": "Transform datasets using natural language. Upload CSV/Excel/JSON, describe your transformation in plain English, get results + reusable Python code. Powered by AI.",
    "version": "0.2",
    "x-build-id": "o3VKG4uzTtrR6Lw2Z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/salesmart-srl~polars-ai-data-transformer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-salesmart-srl-polars-ai-data-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/salesmart-srl~polars-ai-data-transformer/runs": {
      "post": {
        "operationId": "runs-sync-salesmart-srl-polars-ai-data-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/salesmart-srl~polars-ai-data-transformer/run-sync": {
      "post": {
        "operationId": "run-sync-salesmart-srl-polars-ai-data-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",
        "required": [
          "prompt"
        ],
        "properties": {
          "datasetUrls": {
            "title": "📁 Dataset URLs",
            "type": "array",
            "description": "URLs to your data files (CSV, JSON, Excel, Parquet). Add multiple URLs to merge files together.",
            "items": {
              "type": "string"
            }
          },
          "uploadedFiles": {
            "title": "📤 Upload Files",
            "type": "array",
            "description": "Or upload files directly (CSV, JSON, Excel, Parquet). Max 50MB per file."
          },
          "apifyDatasetId": {
            "title": "📊 Apify Dataset ID",
            "type": "string",
            "description": "Or use an existing Apify dataset from another Actor run"
          },
          "datasetId": {
            "title": "📊 Dataset ID (API/Integration)",
            "type": "string",
            "description": "Apify Dataset ID to transform. Simple alternative for API calls and integrations. Example: 'abc123def456'"
          },
          "resource": {
            "title": "🔗 Webhook Payload",
            "type": "object",
            "description": "Auto-populated when triggered via webhook/integration from another Actor. Contains defaultDatasetId from the previous run. Leave empty - filled automatically by Apify."
          },
          "inputData": {
            "title": "📋 Direct JSON Data",
            "type": "object",
            "description": "Pass data directly as JSON (no file upload needed).\n\n**Single table:** {\"data\": [{\"name\": \"A\", \"price\": 100}]}\n\n**Multi-table JOIN:** {\"contacts\": [{...}], \"companies\": [{...}]}\n\nMax ~9MB. Response includes full output_data if < 10MB."
          },
          "prompt": {
            "title": "💬 Transformation Prompt",
            "type": "string",
            "description": "Describe your transformation in plain English. Be specific about column names, aggregations, filters, and sorting."
          },
          "useAdvancedFeatures": {
            "title": "💎 Use Advanced Features",
            "type": "boolean",
            "description": "Enable Premium tier: Gemini 2.5 Pro + Google Search grounding + RAG memory. Works with hosted ($0.20) or BYOK Google API (same features, you pay Google directly). Basic tier uses Flash-Lite ($0.0015 hosted).",
            "default": false
          },
          "llmProvider": {
            "title": "🤖 AI Provider (BYOK)",
            "enum": [
              "groq",
              "anthropic",
              "openai",
              "google"
            ],
            "type": "string",
            "description": "Select AI provider for BYOK (Bring Your Own Key). Leave API key blank to use hosted tier instead. BYOK = $0.05 Apify fee + your API costs.",
            "default": "google"
          },
          "groqApiKey": {
            "title": "🔑 Groq API Key (FREE)",
            "type": "string",
            "description": "Get your FREE API key at console.groq.com (takes 30 seconds). BYOK = $0.05 Apify fee + free Groq API."
          },
          "anthropicApiKey": {
            "title": "🔑 Anthropic API Key",
            "type": "string",
            "description": "Required if using Claude. Get your key at console.anthropic.com. BYOK = $0.05 Apify fee + Claude API costs."
          },
          "openaiApiKey": {
            "title": "🔑 OpenAI API Key",
            "type": "string",
            "description": "Required if using GPT-4o. Get your key at platform.openai.com. BYOK = $0.05 Apify fee + OpenAI API costs."
          },
          "googleApiKey": {
            "title": "🔑 Google AI API Key",
            "type": "string",
            "description": "Get your key at aistudio.google.com. BYOK = $0.05 Apify fee + Google API costs (~$1.25/1M tokens). Enable 'Advanced Features' above for grounding (~$35/1K searches)."
          },
          "outputFormat": {
            "title": "📄 Output Format",
            "enum": [
              "csv",
              "json",
              "parquet",
              "xlsx"
            ],
            "type": "string",
            "description": "Choose the format for your transformed data",
            "default": "csv"
          },
          "includeGeneratedCode": {
            "title": "📝 Include Generated Code",
            "type": "boolean",
            "description": "Include the generated Python/Polars code in output for reuse in your own projects",
            "default": true
          },
          "fallbackProvider": {
            "title": "🔄 Fallback AI Model",
            "enum": [
              "",
              "groq",
              "anthropic",
              "openai",
              "google"
            ],
            "type": "string",
            "description": "If primary model fails, try this one (requires corresponding API key)"
          },
          "maxRetries": {
            "title": "🔄 Max Retries",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Number of attempts if code generation fails",
            "default": 3
          },
          "enableStreaming": {
            "title": "🌊 Enable Streaming",
            "type": "boolean",
            "description": "Process large files in chunks. Auto-enabled for files > 100MB.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}