{
  "openapi": "3.0.1",
  "info": {
    "title": "REST API to Dataset: Auto Pagination, Auth & Retries",
    "description": "Fetch any JSON REST or GraphQL API into a clean dataset: auto pagination (next links, cursors, pages, offsets), API key auth, retries, rate limits, records extraction and per-row enrichment. Failed requests are free.",
    "version": "1.0",
    "x-build-id": "8nXbp0aeMdyHPS7Ok"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/genesis.labs.co~rest-api-to-dataset/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-genesis.labs.co-rest-api-to-dataset",
        "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/genesis.labs.co~rest-api-to-dataset/runs": {
      "post": {
        "operationId": "runs-sync-genesis.labs.co-rest-api-to-dataset",
        "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/genesis.labs.co~rest-api-to-dataset/run-sync": {
      "post": {
        "operationId": "run-sync-genesis.labs.co-rest-api-to-dataset",
        "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": {
          "url": {
            "title": "API URL",
            "type": "string",
            "description": "The JSON API endpoint to fetch, e.g. https://api.example.com/v1/items?status=active. With an Input dataset this is a template: https://api.example.com/users/{{id}}, or {{url}} to call a URL stored in each row. Leave empty to run a free demo."
          },
          "urls": {
            "title": "More API URLs",
            "type": "array",
            "description": "Optional extra endpoints, fetched with the same settings. Each one is paginated on its own.",
            "items": {
              "type": "string"
            }
          },
          "method": {
            "title": "HTTP method",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE",
              "HEAD"
            ],
            "type": "string",
            "description": "GET for most APIs; POST for GraphQL and search endpoints.",
            "default": "GET"
          },
          "queryParams": {
            "title": "Query parameters",
            "type": "object",
            "description": "Added to every first request, e.g. {\"per_page\": 100, \"state\": \"open\"}. Values can use {{field}} placeholders."
          },
          "headers": {
            "title": "Headers",
            "type": "object",
            "description": "Extra request headers, e.g. {\"Accept\": \"application/vnd.github+json\"}. Put API keys in \"API key / token\" below instead, which is stored encrypted."
          },
          "body": {
            "title": "Request body (JSON)",
            "type": "object",
            "description": "For POST/PUT/PATCH, e.g. a GraphQL {\"query\": \"...\", \"variables\": {}} or a search filter. Values can use {{field}} placeholders (a value that is exactly \"{{field}}\" keeps its type)."
          },
          "bodyFormat": {
            "title": "Body format",
            "enum": [
              "json",
              "form"
            ],
            "type": "string",
            "description": "How the request body is encoded.",
            "default": "json"
          },
          "authType": {
            "title": "Auth type",
            "enum": [
              "none",
              "bearer",
              "header",
              "query",
              "basic"
            ],
            "type": "string",
            "description": "How your API key or token is sent.",
            "default": "none"
          },
          "authToken": {
            "title": "API key / token",
            "type": "string",
            "description": "The token or API key. For Basic auth use username:password."
          },
          "authName": {
            "title": "Header or parameter name",
            "type": "string",
            "description": "Header name for \"API key in a header\" (default X-API-Key) or query parameter for \"API key in the query string\" (default api_key). For Bearer, overrides the Authorization header name."
          },
          "recordsPath": {
            "title": "Records path",
            "type": "string",
            "description": "Where the list of records is in the response, as a dot path, e.g. data.items or results. Leave empty to auto-detect (top-level arrays, data, results, items, hits.hits, GraphQL edges/nodes...). Use . to save the whole response as one record."
          },
          "outputMode": {
            "title": "Output",
            "enum": [
              "records",
              "responses"
            ],
            "type": "string",
            "description": "Records: the record list is split into rows (best for CSV/Excel). Per response: one item per HTTP response, for non-JSON or when you want the raw body.",
            "default": "records"
          },
          "fields": {
            "title": "Keep only these fields",
            "type": "array",
            "description": "Optional. Dot paths like id, name, price.amount. Leave empty to keep every field.",
            "items": {
              "type": "string"
            }
          },
          "renameFields": {
            "title": "Rename fields",
            "type": "object",
            "description": "Optional map of old name or dot path to new name, e.g. {\"price.amount\": \"price\"}."
          },
          "flatten": {
            "title": "Flatten nested objects",
            "type": "boolean",
            "description": "Turn {\"a\": {\"b\": 1}} into {\"a.b\": 1} for spreadsheets. Arrays of values are joined with commas.",
            "default": false
          },
          "includeRequestInfo": {
            "title": "Add source URL and page number",
            "type": "boolean",
            "description": "Adds _sourceUrl and _page (and _inputIndex with an Input dataset) to every record.",
            "default": false
          },
          "includeResponseHeaders": {
            "title": "Include response headers (per-response output)",
            "type": "boolean",
            "description": "Per-response output only: adds the response headers to each item.",
            "default": false
          },
          "pagination": {
            "title": "Pagination",
            "enum": [
              "auto",
              "none",
              "nextUrl",
              "linkHeader",
              "cursor",
              "page",
              "offset"
            ],
            "type": "string",
            "description": "How to find the next page. Auto-detect works for most APIs.",
            "default": "auto"
          },
          "nextUrlPath": {
            "title": "Next URL path",
            "type": "string",
            "description": "For \"Next URL\": dot path of the next page's URL, e.g. links.next or paging.next."
          },
          "cursorPath": {
            "title": "Cursor path",
            "type": "string",
            "description": "For \"Cursor\": dot path of the next cursor in the response, e.g. meta.next_cursor or data.search.pageInfo.endCursor."
          },
          "cursorParam": {
            "title": "Cursor parameter",
            "type": "string",
            "description": "For \"Cursor\": the query parameter (or body path, e.g. variables.after) that receives the cursor."
          },
          "pageParam": {
            "title": "Page parameter",
            "type": "string",
            "description": "For \"Page number\". Default page."
          },
          "startPage": {
            "title": "First page number",
            "minimum": 0,
            "type": "integer",
            "description": "For \"Page number\". Default 1 (use 0 for zero-based APIs)."
          },
          "offsetParam": {
            "title": "Offset parameter",
            "type": "string",
            "description": "For \"Offset\". Default offset (e.g. skip, start)."
          },
          "startOffset": {
            "title": "First offset",
            "minimum": 0,
            "type": "integer",
            "description": "For \"Offset\". Default 0."
          },
          "limitParam": {
            "title": "Page size parameter",
            "type": "string",
            "description": "For \"Page number\" or \"Offset\": the parameter that sets page size, e.g. limit or per_page. Sent with Page size."
          },
          "pageSize": {
            "title": "Page size",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Records per page. When set, a shorter page means it was the last one."
          },
          "paginationParamIn": {
            "title": "Send pagination parameter in",
            "enum": [
              "query",
              "body"
            ],
            "type": "string",
            "description": "Where the page, offset or cursor parameter is sent.",
            "default": "query"
          },
          "hasMorePath": {
            "title": "Has-more path",
            "type": "string",
            "description": "Optional dot path of a true/false flag; false stops paging (e.g. has_more, pageInfo.hasNextPage)."
          },
          "totalPagesPath": {
            "title": "Total pages path",
            "type": "string",
            "description": "Optional, for \"Page number\": dot path of the page count, e.g. meta.total_pages or nbPages."
          },
          "totalPath": {
            "title": "Total records path",
            "type": "string",
            "description": "Optional, for \"Offset\": dot path of the total record count, e.g. total or numFound."
          },
          "stopOnEmptyPage": {
            "title": "Stop on an empty page",
            "type": "boolean",
            "description": "Stop paging when a page has no records.",
            "default": true
          },
          "maxPagesPerUrl": {
            "title": "Max pages per URL",
            "minimum": 1,
            "type": "integer",
            "description": "Safety limit per endpoint (or per input row).",
            "default": 1000
          },
          "datasetId": {
            "title": "Input dataset (one request per row)",
            "type": "string",
            "description": "Optional. Calls the API once per row, filling {{field}} placeholders in the URL, query, headers and body from that row. In an integration use {{resource.defaultDatasetId}}."
          },
          "inputFields": {
            "title": "Copy fields from the input row",
            "type": "array",
            "description": "Fields of the input row to add to every output record, e.g. id or email, so you can join results back.",
            "items": {
              "type": "string"
            }
          },
          "maxInputItems": {
            "title": "Max input rows",
            "minimum": 0,
            "type": "integer",
            "description": "0 = all rows."
          },
          "maxRecords": {
            "title": "Max records",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many records in total. 0 = no limit."
          },
          "maxRequests": {
            "title": "Max requests",
            "minimum": 1,
            "type": "integer",
            "description": "Safety limit on API requests per run (retries not counted).",
            "default": 10000
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Endpoints or input rows fetched in parallel. Pages of one endpoint are always fetched in order.",
            "default": 5
          },
          "requestsPerSecond": {
            "title": "Requests per second",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Global rate limit across all parallel requests. 0 = no limit. A 429 pauses everyone for the Retry-After time.",
            "default": 10
          },
          "timeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 1,
            "maximum": 600,
            "type": "integer",
            "description": "Per request, including reading the body.",
            "default": 30
          },
          "maxRetries": {
            "title": "Max retries",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Retries for timeouts, connection errors, 408, 425, 429 and 5xx, with exponential backoff and Retry-After.",
            "default": 3
          },
          "maxResponseMB": {
            "title": "Max response size (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger responses fail with TOO_LARGE instead of exhausting memory.",
            "default": 20
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Most APIs don't need one. Use it for APIs that block datacenter IPs or need a specific country.",
            "default": {
              "useApifyProxy": false
            }
          },
          "failOnRequestError": {
            "title": "Fail the run on any error",
            "type": "boolean",
            "description": "By default the run succeeds if at least one request worked, and failures are listed in the ERRORS record. Turn on to fail the run instead (useful in pipelines).",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}