{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Import & Export - No OAuth, API & AI Agents",
    "description": "Append, replace, upsert or read Google Sheets with a service account: no OAuth popup, works from the API, schedules and AI agents (MCP).",
    "version": "1.0",
    "x-build-id": "VxnaGW9zM2S7ja8Zo"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/feedsmith~google-sheets-sync/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-feedsmith-google-sheets-sync",
        "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/feedsmith~google-sheets-sync/runs": {
      "post": {
        "operationId": "runs-sync-feedsmith-google-sheets-sync",
        "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/feedsmith~google-sheets-sync/run-sync": {
      "post": {
        "operationId": "run-sync-feedsmith-google-sheets-sync",
        "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": [
          "serviceAccountKey",
          "spreadsheet"
        ],
        "properties": {
          "serviceAccountKey": {
            "title": "Service account key (JSON)",
            "type": "string",
            "description": "Full content of a Google Cloud service-account JSON key file. Never expires, no OAuth popup. See the README for the 5-step setup (create project, enable Sheets API, create service account, create key, share the sheet with the key's client_email as Editor)."
          },
          "spreadsheet": {
            "title": "Spreadsheet ID or URL",
            "type": "string",
            "description": "A spreadsheet ID (any length) or a full Google Sheets URL. A URL's #gid=... selects that tab unless \"Sheet/tab name\" below is set."
          },
          "sheetName": {
            "title": "Sheet/tab name",
            "type": "string",
            "description": "Target tab name. Leave empty to use the first tab (or the URL's gid tab). Write modes create the tab if it does not exist yet."
          },
          "datasetId": {
            "title": "Apify dataset ID",
            "type": "string",
            "description": "Write modes only (append/replace/upsert): an Apify dataset ID to read items from, e.g. {{resource.defaultDatasetId}} when chaining after another Actor via Integrations. Provide this OR \"Raw data\", not both."
          },
          "rawData": {
            "title": "Raw data (JSON)",
            "type": "array",
            "description": "Write modes only: a JSON array of objects, or an array of arrays with the header row first. Provide this OR \"Apify dataset ID\", not both."
          },
          "offset": {
            "title": "Dataset offset",
            "minimum": 0,
            "type": "integer",
            "description": "Skip this many items at the start of the dataset before reading (datasetId only).",
            "default": 0
          },
          "limit": {
            "title": "Dataset limit",
            "minimum": 1,
            "type": "integer",
            "description": "Read at most this many items from the dataset (datasetId only). Leave empty to read all of them."
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "append",
              "replace",
              "upsert",
              "read"
            ],
            "type": "string",
            "description": "append never clears anything. replace clears the tab first (values only; a JSON backup of the old values is saved to the run's key-value store by default). upsert needs \"Key column(s)\". read exports the tab and ignores the data source fields above.",
            "default": "append"
          },
          "keyColumns": {
            "title": "Key column(s) (upsert only)",
            "type": "array",
            "description": "Column name(s) that uniquely identify a row, e.g. [\"id\"] or [\"order_id\", \"sku\"]. Required when mode = upsert. A number and the equivalent string (123 vs \"123\") are treated as the same key.",
            "items": {
              "type": "string"
            }
          },
          "backupBeforeReplace": {
            "title": "Backup before replace",
            "type": "boolean",
            "description": "mode = replace only: before clearing the tab, save its current values as JSON to the key-value store record \"BACKUP\" so you can restore them if needed.",
            "default": true
          },
          "readRange": {
            "title": "Read range (A1 notation)",
            "type": "string",
            "description": "mode = read only: an A1 range like \"Sheet1!A1:F200\" to export just part of the tab. Leave empty to read the whole tab."
          },
          "maxItems": {
            "title": "Max rows (read only)",
            "minimum": 1,
            "type": "integer",
            "description": "mode = read only: stop after exporting this many rows. Leave empty for no cap."
          },
          "fields": {
            "title": "Fields to keep",
            "type": "array",
            "description": "Write modes only: keep only these keys, in this order, as columns. Dotted paths reach into nested objects, e.g. \"address.city\". Leave empty to keep every field.",
            "items": {
              "type": "string"
            }
          },
          "omitFields": {
            "title": "Fields to omit",
            "type": "array",
            "description": "Write modes only: drop these columns after flattening/field selection, e.g. [\"password\", \"internalId\"].",
            "items": {
              "type": "string"
            }
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Write modes only: turn nested objects into \"a.b.c\" columns, join arrays of plain values with \", \", and JSON-stringify arrays of objects. Turned off, nested values are written as a single JSON-string cell.",
            "default": true
          },
          "deduplicateBy": {
            "title": "Deduplicate incoming rows by",
            "type": "array",
            "description": "Write modes only: before writing, drop incoming rows that share the same value(s) for these column name(s), keeping the last one. Leave empty to keep every incoming row.",
            "items": {
              "type": "string"
            }
          },
          "valueInputOption": {
            "title": "Value input option",
            "enum": [
              "RAW",
              "USER_ENTERED"
            ],
            "type": "string",
            "description": "USER_ENTERED lets Sheets interpret values as it would if you typed them (formulas, dates, currency). With USER_ENTERED, any string starting with =, +, -, or @ is prefixed with an apostrophe unless \"Allow formulas\" is on (formula-injection guard).",
            "default": "RAW"
          },
          "allowFormulas": {
            "title": "Allow formulas",
            "type": "boolean",
            "description": "Only relevant with valueInputOption = USER_ENTERED. When off (default), strings starting with =, +, -, or @ are escaped so incoming data can never execute a spreadsheet formula. Turn on only if you intentionally write formulas.",
            "default": false
          },
          "dryRun": {
            "title": "Dry run",
            "type": "boolean",
            "description": "Validate credentials, tab access and compute the plan (rows to append/update, new columns, cells after) without changing the sheet. Written to OUTPUT only. Not charged.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}