{
  "openapi": "3.0.1",
  "info": {
    "title": "Snowflake (apify/snowflake)",
    "description": "Imports any Apify dataset into a Snowflake table with append or create modes. Supports custom column mapping, automatic table creation with schema inference, batching, resumable imports, and programmatic access token (PAT) authentication. Works standalone or as an Actor-to-Actor integration.",
    "version": "0.0",
    "x-build-id": "uTGjzj67uG5je4V5Y"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/apify~snowflake-apify-snowflake/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-apify-snowflake-apify-snowflake",
        "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/apify~snowflake-apify-snowflake/runs": {
      "post": {
        "operationId": "runs-sync-apify-snowflake-apify-snowflake",
        "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/apify~snowflake-apify-snowflake/run-sync": {
      "post": {
        "operationId": "run-sync-apify-snowflake-apify-snowflake",
        "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": [
          "datasetId",
          "snowflakeAccount",
          "snowflakeUsername",
          "snowflakePat",
          "importMode",
          "destination"
        ],
        "properties": {
          "datasetId": {
            "title": "Dataset",
            "type": "string",
            "description": "Usually the default dataset of an Actor or task run. To import each run of another Actor, set it to `{{resource.defaultDatasetId}}` in that Actor's integration."
          },
          "snowflakeAccount": {
            "title": "Account identifier",
            "type": "string",
            "description": "Uses `orgname-accountname` format, like `myorg-myaccount`. Go to Snowflake -> Your Account -> Connect a tool to Snowflake -> Account identifier, or run `SELECT CURRENT_ORGANIZATION_NAME() || '-' || CURRENT_ACCOUNT_NAME();`."
          },
          "snowflakeUsername": {
            "title": "Login name",
            "type": "string",
            "description": "Go to Snowflake -> Your Account -> Connect a tool to Snowflake -> Login name, or run `DESCRIBE USER <user_name>;` with the name from `SELECT CURRENT_USER();` and copy `LOGIN_NAME`."
          },
          "snowflakePat": {
            "title": "Programmatic access token",
            "type": "string",
            "description": "Go to Snowflake -> Your Account -> Settings -> Authentication -> Programmatic access tokens and generate one, or run `ALTER USER ADD PROGRAMMATIC ACCESS TOKEN <token_name>;` in Snowflake. Snowflake shows the token only once."
          },
          "snowflakeWarehouse": {
            "title": "Warehouse",
            "type": "string",
            "description": "Leave empty to use your default warehouse. Required if you don't have one. To check, run `SELECT CURRENT_WAREHOUSE();` in Snowflake."
          },
          "importMode": {
            "title": "Import mode",
            "enum": [
              "append",
              "create_new"
            ],
            "type": "string",
            "description": "Both options add rows and never replace data. Create new table (`create_new`) also creates a missing table.",
            "default": "append"
          },
          "destination": {
            "title": "Destination table",
            "required": [
              "database",
              "schema",
              "table"
            ],
            "type": "object",
            "description": "Snowflake table to write into. With <b>Exact names</b> on, matching is case-sensitive. Names are uppercase by default. To check, run a `SHOW` command. Browse what you can access in Snowsight's Databases explorer, Snowflake's web interface.",
            "properties": {
              "database": {
                "title": "Database",
                "type": "string",
                "description": "Name of an existing Snowflake database. To list the ones you can access, run `SHOW DATABASES;` in Snowflake.",
                "minLength": 1,
                "editor": "textfield"
              },
              "schema": {
                "title": "Schema",
                "type": "string",
                "description": "Name of an existing schema in that database. To list the ones you can access, run `SHOW SCHEMAS IN DATABASE <database>;` in Snowflake.",
                "minLength": 1,
                "editor": "textfield"
              },
              "table": {
                "title": "Table",
                "type": "string",
                "description": "With Insert into existing table (`append`), it must already exist. To list tables, run `SHOW TABLES IN SCHEMA <database>.<schema>;` in Snowflake. With Create new table, it's created if it doesn't exist.",
                "minLength": 1,
                "editor": "textfield"
              }
            },
            "additionalProperties": false
          },
          "columnMapping": {
            "title": "Column mapping",
            "type": "array",
            "description": "Import only these fields, under these column names, in either mode. Leave empty to import every field in the first 5,000 rows. A source field missing from the dataset imports as an empty column.",
            "items": {
              "type": "object",
              "properties": {
                "source": {
                  "title": "Source field",
                  "type": "string",
                  "description": "Dataset field to import. Case-sensitive.",
                  "minLength": 1,
                  "editor": "textfield"
                },
                "destination": {
                  "title": "Destination column",
                  "type": "string",
                  "description": "Snowflake column to write this field to.",
                  "minLength": 1,
                  "editor": "textfield"
                }
              },
              "required": [
                "source",
                "destination"
              ],
              "additionalProperties": false
            },
            "default": []
          },
          "quoteIdentifiers": {
            "title": "Exact names",
            "type": "boolean",
            "description": "When on, database, schema, table, and column names keep their case and special characters. Names must match exactly. Names with lowercase letters, spaces, or special characters need double quotes in queries. When off, names are uppercase and unquoted, and column names can only use letters, digits, and underscores, starting with a letter or underscore. Other names fail the run.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}