{
  "openapi": "3.0.1",
  "info": {
    "title": "Sheets Sync: Apify dataset to Google Sheets",
    "description": "Write any Apify dataset into Google Sheets: append, replace or upsert by key. Uses your own Google service account, with no browser sign-in. A run that fails on our side costs $0.",
    "version": "0.1",
    "x-build-id": "j9804chT2f7E16UHE"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/cybernative-ai~sheets-sync/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-cybernative-ai-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/cybernative-ai~sheets-sync/runs": {
      "post": {
        "operationId": "runs-sync-cybernative-ai-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/cybernative-ai~sheets-sync/run-sync": {
      "post": {
        "operationId": "run-sync-cybernative-ai-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": [
          "spreadsheetId",
          "serviceAccountKey",
          "confirmDataScope"
        ],
        "properties": {
          "datasetId": {
            "title": "Dataset",
            "type": "string",
            "description": "The dataset to export. Pick it here, or run Sheets Sync as an integration of the Actor that made the data and this field is filled with that run's default dataset. Sheets Sync can read only the dataset picked here."
          },
          "items": {
            "title": "Raw items (for testing)",
            "maxItems": 1000,
            "type": "array",
            "description": "Optional. A JSON array of up to 1,000 records to write instead of a dataset, for a first test. Ignored when a dataset is given, and an empty list counts as not set."
          },
          "spreadsheetId": {
            "title": "Spreadsheet URL or ID",
            "type": "string",
            "description": "Paste the spreadsheet's URL, or the ID between /d/ and /edit. The spreadsheet must be shared with your service account's email address as Editor."
          },
          "serviceAccountKey": {
            "title": "Google service account key (JSON)",
            "type": "string",
            "description": "The full contents of the JSON key file of your Google service account. Stored encrypted by Apify. You can rotate or revoke it in Google Cloud at any time."
          },
          "confirmDataScope": {
            "title": "I confirm the data scope",
            "type": "boolean",
            "description": "Tick to confirm: you control the dataset and the spreadsheet; the rows hold no personal, special-category or regulated data and no credentials; and you know what the chosen mode does to the tab (replace clears the old rows and columns of that tab only). The run stops before reading anything if this is not ticked.",
            "default": false
          },
          "sheetName": {
            "title": "Tab name",
            "type": "string",
            "description": "Tab (worksheet) to write to. Created if it does not exist.",
            "default": "Sheet1"
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "append",
              "replace",
              "upsert"
            ],
            "type": "string",
            "description": "append: add rows below the existing ones. replace: make the tab equal to the dataset (removes old rows). upsert: update rows whose key matches, add the rest.",
            "default": "append"
          },
          "keyColumns": {
            "title": "Key columns (upsert only)",
            "type": "array",
            "description": "Column(s) that identify a row, for example url or id. Nested fields use the column style you chose: owner/id (Apify style) or owner.id (compact); either form is accepted.",
            "items": {
              "type": "string"
            }
          },
          "columnStyle": {
            "title": "Column names",
            "enum": [
              "apify",
              "compact"
            ],
            "type": "string",
            "description": "apify: names like Apify's own exports and most other Sheets tools (owner/team, tags/0). Pick this when you move an existing sheet over. compact: owner.team, arrays kept as JSON text in one cell.",
            "default": "apify"
          },
          "newColumns": {
            "title": "When the dataset has new columns",
            "enum": [
              "add",
              "ignore",
              "fail"
            ],
            "type": "string",
            "description": "append/upsert only. add: put new columns to the right of the existing header. ignore: skip them. fail: stop without writing.",
            "default": "add"
          },
          "columns": {
            "title": "Only these columns (optional)",
            "type": "array",
            "description": "Limit and order the columns written. Empty means all columns found in the dataset.",
            "items": {
              "type": "string"
            }
          },
          "flattenDepth": {
            "title": "Nested object depth (compact style)",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Compact style only. Nested objects become one column per field ('owner.name') down to this depth. Deeper levels and arrays are written as JSON text in a single cell.",
            "default": 2
          },
          "createSheetIfMissing": {
            "title": "Create the tab if missing",
            "type": "boolean",
            "description": "Create the tab automatically when the spreadsheet has no tab with the name above. Turn off to get an error instead.",
            "default": true
          },
          "allowEmpty": {
            "title": "Allow replacing with an empty dataset",
            "type": "boolean",
            "description": "Safety switch. When off, replace mode refuses to wipe the tab if the dataset has no rows.",
            "default": false
          },
          "maxRows": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 200000,
            "type": "integer",
            "description": "Write at most this many dataset rows. The ceiling is 200,000 rows and 5,000,000 cells per run; a dataset with more rows than the ceiling is refused, not cut. Split it across runs.",
            "default": 200000
          },
          "dryRun": {
            "title": "Dry run",
            "type": "boolean",
            "description": "Check access, columns and keys and report what would happen, without writing or charging.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}