{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Sync (Reliable)",
    "description": "Sync Apify datasets with Google Sheets: append, upsert, replace or export. Batched writes, automatic retries, deduplication and clear error messages.",
    "version": "0.1",
    "x-build-id": "TexN8bwbkl2xkWnCr"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/loris-barce~google-sheets-sync/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-loris-barce-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/loris-barce~google-sheets-sync/runs": {
      "post": {
        "operationId": "runs-sync-loris-barce-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/loris-barce~google-sheets-sync/run-sync": {
      "post": {
        "operationId": "run-sync-loris-barce-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": [
          "spreadsheetId"
        ],
        "properties": {
          "spreadsheetId": {
            "title": "Spreadsheet ID or URL",
            "type": "string",
            "description": "The ID of the Google Sheet, or simply paste its full URL (e.g. https://docs.google.com/spreadsheets/d/<ID>/edit). The sheet must be shared with your service account email as Editor."
          },
          "sheetName": {
            "title": "Sheet (tab) name",
            "type": "string",
            "description": "Name of the tab to read from or write to. Defaults to the first tab. If the tab does not exist, it is created."
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "append",
              "upsert",
              "replace",
              "export"
            ],
            "type": "string",
            "description": "<b>append</b>: add rows at the bottom.<br><b>upsert</b>: update rows whose key columns match, append the rest (requires Key columns).<br><b>replace</b>: clear the tab and write the data.<br><b>export</b>: read the tab and save each row to the default dataset.",
            "default": "append"
          },
          "datasetId": {
            "title": "Source dataset ID",
            "type": "string",
            "description": "The Apify dataset to write to the sheet (append / upsert / replace). Takes precedence over Raw rows. The Actor only gets read access to this dataset."
          },
          "rawRows": {
            "title": "Raw rows (JSON)",
            "type": "array",
            "description": "Alternative to a dataset: a JSON array of objects. Used only when no dataset is selected. The example rows show what a run does: without a service account the Actor runs in demo mode and only previews the result."
          },
          "keyColumns": {
            "title": "Key columns",
            "type": "array",
            "description": "Columns that uniquely identify a row (e.g. \"url\" or \"id\"). Required for upsert. Also used by deduplication: when set, a row is a duplicate if its key already exists.",
            "items": {
              "type": "string"
            }
          },
          "deduplicate": {
            "title": "Skip duplicate rows",
            "type": "boolean",
            "description": "Skip rows that are already present in the sheet (identical rows, or same key if Key columns are set).",
            "default": true
          },
          "columns": {
            "title": "Columns (whitelist and order)",
            "type": "array",
            "description": "Optional. Only these columns are written/exported, in this order. Use flattened names for nested fields, e.g. \"address.city\".",
            "items": {
              "type": "string"
            }
          },
          "flattenNested": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn nested objects into columns like \"a.b.c\" and join arrays with \"; \". When off, nested values are written as JSON text.",
            "default": true
          },
          "serviceAccountJson": {
            "title": "Google service account JSON",
            "type": "string",
            "description": "Paste the full JSON key of a Google Cloud service account with the Google Sheets API enabled. Stored encrypted and never logged. Leave empty to run in demo mode (preview only, nothing written, no rows charged). See the README for a 5-step setup."
          },
          "dryRun": {
            "title": "Dry run",
            "type": "boolean",
            "description": "Validate everything (access, data, columns, limits) and report what would happen, without writing anything.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}