{
  "openapi": "3.0.1",
  "info": {
    "title": "Transpose Table: swap rows and columns of CSV",
    "description": "Swaps the rows and columns of a table: Apify dataset, CSV or JSON file, or pasted CSV text. Pick a column to become the new headers. Works from the Console form. Empty input = free demo.",
    "version": "0.1",
    "x-build-id": "ZxiV46uPiPaTu2CKb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ucchiii~transpose-table/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ucchiii-transpose-table",
        "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/ucchiii~transpose-table/runs": {
      "post": {
        "operationId": "runs-sync-ucchiii-transpose-table",
        "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/ucchiii~transpose-table/run-sync": {
      "post": {
        "operationId": "run-sync-ucchiii-transpose-table",
        "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": {
          "datasetIds": {
            "title": "Apify datasets",
            "type": "array",
            "description": "Datasets to transpose (the 'defaultDatasetId' of a finished run). You can paste a dataset URL from Apify Console too. Each dataset is transposed as its own table. Up to 20 tables per run in total. Leave this, 'File URLs' and 'CSV text' empty to run a free demo on a built-in sample (not charged)."
          },
          "fileUrls": {
            "title": "File URLs",
            "type": "array",
            "description": "Public http(s) links to CSV, TSV, JSON or NDJSON files (up to 50 MB each). Each file is transposed as its own table. Links to internal networks are blocked.",
            "items": {
              "type": "string"
            }
          },
          "csvText": {
            "title": "CSV text",
            "type": "string",
            "description": "A table pasted as text: CSV, TSV, or JSON. The first line is the header unless 'First row is a header' is off. Example: 'metric,q1,q2' on the first line, then 'revenue,120,135'."
          },
          "inputFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "json",
              "ndjson",
              "csv",
              "tsv"
            ],
            "type": "string",
            "description": "Format of the files in 'File URLs' and of the 'CSV text'. 'auto' uses the file extension, content type and content. Ignored for datasets. Default: auto.",
            "default": "auto"
          },
          "recordsPath": {
            "title": "Records path (JSON files)",
            "type": "string",
            "description": "For a JSON file whose rows sit inside an object, the dot path to the array of rows, e.g. 'products' or 'data.items'. Empty = the file is an array, or the only array of objects in it is used."
          },
          "inputHasHeader": {
            "title": "First row is a header",
            "type": "boolean",
            "description": "CSV, TSV and JSON arrays of arrays: whether the first row holds the column names. Turn off and the columns are named column_1, column_2 ... and the first row is data. Ignored for datasets and JSON objects, which carry their own names. Default: on.",
            "default": true
          },
          "headerColumn": {
            "title": "Header column",
            "type": "string",
            "description": "Name of the column whose values become the new column names (for example 'region' or 'metric'). That column is not repeated as a row. Empty = the new columns are named row_1, row_2 ... in the order of your rows. Nested names use the flatten separator (owner.name)."
          },
          "firstColumnName": {
            "title": "Name of the first output column",
            "type": "string",
            "description": "The first column of the result holds the old column names. This is its name (for example 'month' or 'metric'). Default: field.",
            "default": "field"
          },
          "maxRows": {
            "title": "Max input rows",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Rows of your table become columns of the result, so only this many input rows are read. When there are more, 'inputTruncated' is true in the run summary. Maximum 10,000. Default: 1,000.",
            "default": 1000
          },
          "flattenSeparator": {
            "title": "Flatten separator",
            "type": "string",
            "description": "Text that joins nested key names of datasets and JSON files, e.g. '.' gives owner.name and '_' gives owner_name. Max 5 characters. Default: '.'.",
            "default": "."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}