{
  "openapi": "3.0.1",
  "info": {
    "title": "Sheets Sync Pro",
    "description": "Reliable export of datasets/JSON to Google Sheets and import of sheets into datasets, with service-account auth.",
    "version": "0.5",
    "x-build-id": "AM3LifPDFTaff5mef"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/master_invictus~sheets-sync-pro/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-master_invictus-sheets-sync-pro",
        "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/master_invictus~sheets-sync-pro/runs": {
      "post": {
        "operationId": "runs-sync-master_invictus-sheets-sync-pro",
        "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/master_invictus~sheets-sync-pro/run-sync": {
      "post": {
        "operationId": "run-sync-master_invictus-sheets-sync-pro",
        "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": [
          "mode",
          "spreadsheetId"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "import-public",
              "export-append",
              "export-replace",
              "export-upsert",
              "import"
            ],
            "type": "string",
            "description": "import-public reads a sheet shared as anyone with the link via the public CSV export and needs no credentials. The other modes use the Sheets API.",
            "default": "import-public"
          },
          "spreadsheetId": {
            "title": "Spreadsheet ID",
            "type": "string",
            "description": "The ID from the sheet URL (between /d/ and /edit). The default is Google's public Class Data sample, shared as anyone with the link.",
            "default": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
          },
          "sheetName": {
            "title": "Sheet (tab) name",
            "type": "string",
            "description": "Tab to read/write for API modes; created on export if missing. import-public uses gid instead.",
            "default": "Sheet1"
          },
          "gid": {
            "title": "Public sheet tab id (gid)",
            "minimum": 0,
            "type": "integer",
            "description": "Tab id for import-public (the gid query on /export?format=csv). The first tab is usually 0. Ignored by API modes.",
            "default": 0
          },
          "range": {
            "title": "Range (import)",
            "type": "string",
            "description": "Optional A1 range for import, e.g. A1:F500."
          },
          "serviceAccountJson": {
            "title": "Service account JSON key",
            "type": "string",
            "description": "Paste the whole JSON key file. Share the sheet with its client_email."
          },
          "oauthAccessToken": {
            "title": "OAuth access token (alternative)",
            "type": "string",
            "description": "Use instead of a service account. Expires after ~1 hour."
          },
          "datasetId": {
            "title": "Source dataset ID (export)",
            "type": "string",
            "description": "Apify dataset to export."
          },
          "rawData": {
            "title": "Raw JSON data (export)",
            "type": "array",
            "description": "Array of objects to export instead of a dataset."
          },
          "columnsMapping": {
            "title": "Columns mapping",
            "type": "object",
            "description": "Rename fields/headers: {\"source\": \"Target\"}."
          },
          "onlyMappedColumns": {
            "title": "Only mapped columns",
            "type": "boolean",
            "description": "Keep only columns present in the mapping.",
            "default": false
          },
          "upsertKey": {
            "title": "Upsert key columns (export-upsert)",
            "type": "array",
            "description": "Column(s) identifying a row, e.g. id. Matching sheet rows are updated in place (columns missing from the input keep their sheet value); others are appended. A comma-separated string is also accepted via API.",
            "items": {
              "type": "string"
            }
          },
          "dedupeBy": {
            "title": "Deduplicate by fields",
            "type": "array",
            "description": "String or array of column names. Skip rows whose values in these fields already exist. An array such as [\"id\", \"city\"] and a comma-separated string such as \"id,city\" are equivalent. Empty or missing values skip deduplication.",
            "items": {
              "type": "string"
            }
          },
          "limit": {
            "title": "Row limit",
            "minimum": 1,
            "type": "integer",
            "description": "Max rows to read/write."
          },
          "valueInputOption": {
            "title": "Value input option",
            "enum": [
              "RAW",
              "USER_ENTERED"
            ],
            "type": "string",
            "description": "RAW stores values exactly; USER_ENTERED parses like typing.",
            "default": "RAW"
          },
          "batchSize": {
            "title": "Batch size",
            "minimum": 1,
            "type": "integer",
            "description": "Rows per API write."
          },
          "maxRetries": {
            "title": "Max retries",
            "minimum": 0,
            "type": "integer",
            "description": "Retries on 429/5xx with backoff.",
            "default": 6
          },
          "allowEmpty": {
            "title": "Allow empty result",
            "type": "boolean",
            "description": "Do not fail when 0 rows are processed.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}