{
  "openapi": "3.0.1",
  "info": {
    "title": "Reliable Google Sheets Bridge",
    "description": "Two-way Apify dataset ↔ Google Sheets transfers with your service account. Append, replace, or strict composite-key upsert with Limited Permissions, deterministic nested JSON, safe row limits, and credential-safe errors.",
    "version": "0.3",
    "x-build-id": "EUDNKPHXjZehRSXBk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/groundedvisionmedia~reliable-sheets-bridge/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-groundedvisionmedia-reliable-sheets-bridge",
        "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/groundedvisionmedia~reliable-sheets-bridge/runs": {
      "post": {
        "operationId": "runs-sync-groundedvisionmedia-reliable-sheets-bridge",
        "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/groundedvisionmedia~reliable-sheets-bridge/run-sync": {
      "post": {
        "operationId": "run-sync-groundedvisionmedia-reliable-sheets-bridge",
        "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": [
          "operation"
        ],
        "properties": {
          "operation": {
            "title": "Operation",
            "enum": [
              "health_check",
              "dataset_to_sheet",
              "sheet_to_dataset"
            ],
            "type": "string",
            "description": "Health check uses no Google credential and is the safe Store-test default.",
            "default": "health_check"
          },
          "serviceAccountJson": {
            "title": "Google service-account JSON",
            "type": "string",
            "description": "Required for either transfer direction. Paste the complete JSON key. Apify stores this field encrypted."
          },
          "spreadsheetIdOrUrl": {
            "title": "Spreadsheet ID or URL",
            "minLength": 20,
            "maxLength": 500,
            "type": "string",
            "description": "Full docs.google.com/spreadsheets URL or its spreadsheet ID."
          },
          "sheetName": {
            "title": "Sheet/tab name",
            "maxLength": 100,
            "type": "string",
            "description": "Case-sensitive source or destination tab.",
            "default": "Sheet1"
          },
          "datasetId": {
            "title": "Source Apify dataset",
            "type": "string",
            "description": "Required for dataset → Sheet. Selecting it grants this Limited Permissions Actor read-only access to that dataset."
          },
          "writeMode": {
            "title": "Sheet write mode",
            "enum": [
              "append",
              "replace",
              "upsert"
            ],
            "type": "string",
            "description": "Used only for dataset → Sheet.",
            "default": "append"
          },
          "keyColumns": {
            "title": "Upsert key columns",
            "uniqueItems": true,
            "type": "array",
            "description": "One or more case-sensitive columns forming a unique composite key. Names are Unicode-normalized and trimmed. Blank or duplicate keys fail before data writes.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "readRange": {
            "title": "Optional A1 read range",
            "type": "string",
            "description": "Used only for Sheet → dataset. Leave empty to read the selected tab."
          },
          "headerRow": {
            "title": "Header row",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "1-based row containing column names for Sheet → dataset.",
            "default": 1
          },
          "maxRows": {
            "title": "Maximum data rows",
            "minimum": 1,
            "maximum": 250000,
            "type": "integer",
            "description": "Safety cap per run. By default the Actor fails instead of silently truncating.",
            "default": 50000
          },
          "rowLimitAction": {
            "title": "When maxRows is exceeded",
            "enum": [
              "fail",
              "truncate"
            ],
            "type": "string",
            "description": "Fail before transferring, or deliberately transfer only the first maxRows data rows.",
            "default": "fail"
          },
          "batchSize": {
            "title": "Batch size",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Rows per Google or Apify write batch.",
            "default": 2000
          },
          "autoCreateSheet": {
            "title": "Create missing destination tab",
            "type": "boolean",
            "description": "Used only for dataset → Sheet.",
            "default": true
          },
          "valueInputOption": {
            "title": "Google value mode",
            "enum": [
              "RAW",
              "USER_ENTERED"
            ],
            "type": "string",
            "description": "RAW prevents formulas from being executed. USER_ENTERED lets Google parse formulas and dates.",
            "default": "RAW"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}