{
  "openapi": "3.0.1",
  "info": {
    "title": "Download Files from URLs - Images, PDFs, Videos & ZIP",
    "description": "Bulk download files from a list of URLs or a dataset column: images, PDFs, videos, audio and documents, streamed to a key-value store and optionally packed into ZIP files. Each row gives the file URL, name, type, size and SHA-256. Failed URLs come back free with the reason.",
    "version": "0.1",
    "x-build-id": "XhfJIajEL6rSgnivO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/neverempty~download-files-from-urls/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-neverempty-download-files-from-urls",
        "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/neverempty~download-files-from-urls/runs": {
      "post": {
        "operationId": "runs-sync-neverempty-download-files-from-urls",
        "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/neverempty~download-files-from-urls/run-sync": {
      "post": {
        "operationId": "run-sync-neverempty-download-files-from-urls",
        "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",
        "properties": {
          "urls": {
            "title": "File URLs",
            "type": "array",
            "description": "Direct links to the files to download: images, PDFs, videos, audio, documents, archives or any other file. One URL per line. Only these URLs are downloaded; links inside pages are not followed. If this and the dataset field are both left out, one example photo from Wikimedia Commons is downloaded and the log says so.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset with file URLs (optional)",
            "type": "string",
            "description": "An Apify dataset, for example the results of a scraper run, whose rows hold file URLs. Use it together with the field name below. URLs from here are added to the URLs above."
          },
          "datasetField": {
            "title": "Field that holds the URLs",
            "type": "string",
            "description": "The field of each dataset row that holds the file URL, for example url, imageUrl or images. A field that holds a list of URLs, or objects with url, src or href, is read in full. Use dots for nested fields, for example media.0.url. Default: url."
          },
          "saveAs": {
            "title": "Save as",
            "enum": [
              "files",
              "zip",
              "both"
            ],
            "type": "string",
            "description": "files = each file is saved as its own record in a key-value store with its own URL. zip = all files are packed into files.zip (no compression, so it is fast and files stay byte-for-byte the same). both = separate files and the ZIP; each file is then stored twice, so the size charge for files over 10 MB (each further 10 MB) is counted twice. Files under 10 MB cost the same in every mode.",
            "default": "files"
          },
          "fileTypes": {
            "title": "Only these file types (optional)",
            "type": "array",
            "description": "Keep only files of these kinds: image, video, audio, pdf, document, archive, other, or file extensions such as jpg, png, mp4 or docx. The type is read from the file itself, not only from the URL. Other files come back as free rows. Empty = keep every type.",
            "items": {
              "type": "string"
            }
          },
          "skipWebPages": {
            "title": "Skip web pages",
            "type": "boolean",
            "description": "On (default): an address that returns an HTML web page instead of a file is not saved and comes back as a free row. Off: the HTML is saved like any other file.",
            "default": true
          },
          "outputKeyValueStoreId": {
            "title": "Save files to this key-value store (optional)",
            "type": "string",
            "description": "By default the files go to this run's own key-value store, which is deleted with the run after your plan's data retention period. Choose a key-value store here to keep the files (and their URLs) for good."
          },
          "maxFileMegabytes": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 4000,
            "type": "integer",
            "description": "A file larger than this is not saved and comes back as a free too-large row. Files are streamed to storage, so large files do not need more memory; very large files need more disk space, which grows with the run's memory.",
            "default": 500
          },
          "requestTimeoutSecs": {
            "title": "Stall timeout (seconds)",
            "minimum": 5,
            "maximum": 600,
            "type": "integer",
            "description": "A download that receives no data for this long is stopped and tried again. A slow but moving download of a large file is not stopped.",
            "default": 60
          },
          "maxConcurrency": {
            "title": "Downloads at the same time",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "How many files to download at the same time. Lower it if a site answers 429 (too many requests).",
            "default": 4
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}