{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Drive Folder Copier",
    "description": "Copy entire folders and files from any public or shared Google Drive link directly into your Google Drive. Supports large files, nested folders, and automated structure replication — no manual downloads required.",
    "version": "1.0",
    "x-build-id": "P2UhepobkfmKZcLCo"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nec~google-drive-copier/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nec-google-drive-copier",
        "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/nec~google-drive-copier/runs": {
      "post": {
        "operationId": "runs-sync-nec-google-drive-copier",
        "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/nec~google-drive-copier/run-sync": {
      "post": {
        "operationId": "run-sync-nec-google-drive-copier",
        "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": [
          "publicDriveLink",
          "destinationFolderId"
        ],
        "properties": {
          "publicDriveLink": {
            "title": "🔗 Public Drive Link",
            "pattern": "^https://drive\\.google\\.com/(drive/folders/|file/d/)[a-zA-Z0-9_-]+(/.*)?$",
            "type": "string",
            "description": "Public share link to the Google Drive folder or file you want to copy. Right-click any file or folder in Drive → Share → Copy link."
          },
          "destinationFolderId": {
            "title": "📁 Destination Folder ID",
            "pattern": "^[a-zA-Z0-9_-]+$",
            "type": "string",
            "description": "Your Google Drive destination folder ID. Open the target folder in Drive and copy the ID from the URL: drive.google.com/drive/folders/FOLDER_ID"
          },
          "conflictResolution": {
            "title": "⚡ Conflict Resolution",
            "enum": [
              "skip",
              "overwrite",
              "rename"
            ],
            "type": "string",
            "description": "What to do when a file or folder with the same name already exists in the destination. 'Rename' adds (1), (2) etc. to avoid overwriting.",
            "default": "rename"
          },
          "maxFolderDepth": {
            "title": "🗂️ Max Folder Depth",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum folder nesting level to copy. 1 = top-level items only, 10 = full depth. Increase for deeply nested folder structures.",
            "default": 10
          },
          "copyFilesOnly": {
            "title": "📄 Copy Files Only (Flatten Structure)",
            "type": "boolean",
            "description": "When enabled, all files are copied directly into the destination folder without recreating the original folder hierarchy. Useful for consolidating scattered files.",
            "default": false
          },
          "fileTypeFilter": {
            "title": "🔍 File Type Filter",
            "type": "string",
            "description": "Comma-separated file extensions to include (e.g. 'pdf,docx,xlsx'). Only files matching these extensions will be copied. Leave empty to copy all file types."
          },
          "maxFilesPerRun": {
            "title": "🛑 Max Files Per Run",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Safety limit: stop after copying this many files. Useful for testing or controlling costs on large folders. Set lower for a trial run.",
            "default": 10000
          },
          "googleClientId": {
            "title": "🔑 Google Client ID",
            "type": "string",
            "description": "Optional: Your own Google OAuth 2.0 Client ID. Only needed if you want to use your own Google Cloud project instead of the built-in credentials. Create one at console.cloud.google.com/apis/credentials."
          },
          "googleClientSecret": {
            "title": "🔒 Google Client Secret",
            "type": "string",
            "description": "Optional: Your own Google OAuth 2.0 Client Secret. Required only when providing a custom Google Client ID above."
          },
          "googleRedirectUri": {
            "title": "↩️ Google Redirect URI",
            "type": "string",
            "description": "OAuth redirect URI. Only change this if using your own Google Cloud credentials and a custom redirect URI."
          },
          "oauthRefreshToken": {
            "title": "🤖 OAuth Refresh Token (Headless Auth)",
            "type": "string",
            "description": "Optional: A pre-obtained Google OAuth refresh token. When provided (and googleClientId/googleClientSecret are not set), this token authenticates the Actor directly — no browser sign-in required. Ideal for scheduled or API-triggered runs. Get a token from developers.google.com/oauthplayground using the drive scope."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}