{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Sheets Integration",
    "description": "Synchronize Apify datasets and Google Sheets with secure read, append, replace, upsert, delete, and filter operations.",
    "version": "1.0",
    "x-build-id": "RzMdNPhggGAFSKGtl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/solutionssmart~google-sheets-integration/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-solutionssmart-google-sheets-integration",
        "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/solutionssmart~google-sheets-integration/runs": {
      "post": {
        "operationId": "runs-sync-solutionssmart-google-sheets-integration",
        "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/solutionssmart~google-sheets-integration/run-sync": {
      "post": {
        "operationId": "run-sync-solutionssmart-google-sheets-integration",
        "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",
          "spreadsheetId"
        ],
        "properties": {
          "operation": {
            "title": "Operation",
            "enum": [
              "READ",
              "CREATE_SHEET",
              "APPEND",
              "REPLACE",
              "UPSERT",
              "DELETE",
              "CLEAR"
            ],
            "type": "string",
            "description": "READ imports records. CREATE_SHEET adds a worksheet tab. APPEND, REPLACE, UPSERT, and DELETE provide CRUD-style data management. CLEAR removes a range.",
            "default": "READ"
          },
          "spreadsheetId": {
            "title": "Spreadsheet ID or URL",
            "type": "string",
            "description": "The ID from a Google Sheets URL, or the full spreadsheet URL. A public Google sample sheet is prefilled for testing."
          },
          "sheetName": {
            "title": "Sheet name",
            "type": "string",
            "description": "Worksheet tab name. Required for CREATE_SHEET and defaults to the first sheet when reading."
          },
          "range": {
            "title": "Cell range",
            "type": "string",
            "description": "Optional A1 range, such as A1:Z. It may include a sheet name."
          },
          "serviceAccountKey": {
            "title": "Google service account key",
            "type": "string",
            "description": "Service-account JSON for private sheets and write operations. Store it as a secret input. Public READ operations can run without credentials."
          },
          "googleApiKey": {
            "title": "Google API key (public reads only)",
            "type": "string",
            "description": "Optional API key for public READ operations. It supports private-sheet API features; published public sheets can be read without credentials. All writes require a service account."
          },
          "firstRowHeaders": {
            "title": "First row contains headers",
            "type": "boolean",
            "description": "For reads, emits objects keyed by the first row. For writes of object rows, controls whether headers are written.",
            "default": true
          },
          "rows": {
            "title": "Rows to write",
            "type": "array",
            "description": "Rows as JSON objects or arrays. Used for CREATE_SHEET, APPEND, REPLACE, and UPSERT unless sourceDatasetId is supplied.",
            "default": []
          },
          "sourceDatasetId": {
            "title": "Source dataset ID",
            "type": "string",
            "description": "Optional dataset ID whose items are exported. Takes precedence over Rows."
          },
          "upsertKey": {
            "title": "Upsert key column",
            "type": "string",
            "description": "Required for UPSERT. Existing rows with the same value are updated; other rows are added."
          },
          "columnMapping": {
            "title": "Column mapping",
            "type": "object",
            "description": "Optional JSON object mapping source fields to Google Sheets headers, for example {\"profile.email\": \"Email\"}."
          },
          "filters": {
            "title": "Filters",
            "type": "object",
            "description": "Exact-match filters for READ or DELETE, for example {\"status\": \"active\"}. DELETE requires at least one filter."
          },
          "filterMode": {
            "title": "Filter matching",
            "enum": [
              "ALL",
              "ANY"
            ],
            "type": "string",
            "description": "Match all filter fields or any filter field.",
            "default": "ALL"
          },
          "maxRows": {
            "title": "Maximum read rows",
            "type": "integer",
            "description": "Optional maximum number of matched rows returned by READ."
          },
          "maxCells": {
            "title": "Maximum populated cells",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Maximum populated cells returned by a READ request. Use a narrower A1 range for larger sheets.",
            "default": 1000000
          },
          "valueInputOption": {
            "title": "Write value interpretation",
            "enum": [
              "USER_ENTERED",
              "RAW"
            ],
            "type": "string",
            "description": "USER_ENTERED lets Sheets evaluate formulas and formatting; RAW writes literal values.",
            "default": "USER_ENTERED"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}