{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Data Formatter & Schema Converter",
    "description": "Transform messy CSV or JSON data into a validated custom schema with clean JSON and Excel-ready CSV outputs.",
    "version": "0.1",
    "x-build-id": "ppGF84cWLr20mE09s"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pearlescent_idiom~ai-data-formatter-schema-converter/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pearlescent_idiom-ai-data-formatter-schema-converter",
        "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/pearlescent_idiom~ai-data-formatter-schema-converter/runs": {
      "post": {
        "operationId": "runs-sync-pearlescent_idiom-ai-data-formatter-schema-converter",
        "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/pearlescent_idiom~ai-data-formatter-schema-converter/run-sync": {
      "post": {
        "operationId": "run-sync-pearlescent_idiom-ai-data-formatter-schema-converter",
        "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": [
          "targetSchema"
        ],
        "properties": {
          "records": {
            "title": "Source records",
            "maxItems": 500,
            "type": "array",
            "description": "Paste a JSON array of objects. Field names and value formats can be inconsistent.",
            "items": {
              "type": "object"
            },
            "default": [
              {
                "Customer ID": "C-001",
                "Full Name": "  Ada Yilmaz ",
                "Mail": "ADA@EXAMPLE.COM",
                "Spent": "1,250.50",
                "Newsletter": "yes"
              },
              {
                "id": "C-001",
                "name": "Ada Yilmaz",
                "email": "ada@example.com",
                "total": 1250.5,
                "subscribed": true
              },
              {
                "customer_no": "C-002",
                "customer": "Mert Kaya",
                "email_address": "mert@example.com",
                "amount": "850",
                "newsletter": "no"
              }
            ]
          },
          "files": {
            "title": "Or upload CSV or JSON files",
            "maxItems": 5,
            "type": "array",
            "description": "Upload up to five UTF-8 CSV or JSON files.",
            "items": {
              "type": "string"
            }
          },
          "dataText": {
            "title": "Or paste CSV/JSON text",
            "maxLength": 500000,
            "type": "string",
            "description": "Automatic detection supports standard JSON arrays/objects and comma-separated CSV."
          },
          "inputFormat": {
            "title": "Pasted/uploaded data format",
            "enum": [
              "auto",
              "json",
              "csv"
            ],
            "type": "string",
            "description": "Use automatic detection unless the source has an unusual extension or structure.",
            "default": "auto"
          },
          "targetSchema": {
            "title": "Target JSON Schema",
            "type": "object",
            "description": "Define one output object. Missing required non-null values are reported as failed records instead of invented.",
            "default": {
              "type": "object",
              "properties": {
                "customer_id": {
                  "type": "string"
                },
                "full_name": {
                  "type": "string"
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "total_spent": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "subscribed": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                }
              },
              "required": [
                "customer_id",
                "full_name",
                "email",
                "total_spent",
                "subscribed"
              ],
              "additionalProperties": false
            }
          },
          "instructions": {
            "title": "Transformation instructions",
            "maxLength": 4000,
            "type": "string",
            "description": "Optional field mappings, locale rules, date formats, units, or naming conventions.",
            "default": "Normalize email addresses to lowercase and trim surrounding whitespace."
          },
          "removeDuplicates": {
            "title": "Remove duplicate records",
            "type": "boolean",
            "description": "Keep the first matching formatted record and report how many duplicates were found.",
            "default": true
          },
          "deduplicateBy": {
            "title": "Duplicate field paths",
            "maxItems": 10,
            "type": "array",
            "description": "Optional target fields such as email or customer_id. Leave empty to compare the complete formatted record.",
            "items": {
              "type": "string"
            },
            "default": [
              "email"
            ]
          },
          "retryCount": {
            "title": "Validation retries",
            "minimum": 0,
            "maximum": 4,
            "type": "integer",
            "description": "Number of model correction attempts for invalid output.",
            "default": 2
          },
          "continueOnError": {
            "title": "Continue after a failed batch",
            "type": "boolean",
            "description": "Save failed rows with an error message and continue processing later batches.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}