{
  "openapi": "3.0.1",
  "info": {
    "title": "Tender & Procurement Feed Normalizer",
    "description": "Normalize CSV/JSON tender records, flag ambiguous values and duplicates, preserve source data, and sort clean rows by deadline.",
    "version": "0.2",
    "x-build-id": "urHDwEfwJA4TUSvQR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ultrathink-labs~tender-feed-normalizer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ultrathink-labs-tender-feed-normalizer",
        "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/ultrathink-labs~tender-feed-normalizer/runs": {
      "post": {
        "operationId": "runs-sync-ultrathink-labs-tender-feed-normalizer",
        "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/ultrathink-labs~tender-feed-normalizer/run-sync": {
      "post": {
        "operationId": "run-sync-ultrathink-labs-tender-feed-normalizer",
        "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": {
          "sourceUrl": {
            "title": "Feed URL",
            "type": "string",
            "description": "Public HTTPS URL serving UTF-8 CSV or JSON (array, single record, or {\"records\": [...]}). Clear records first: nonempty records override this URL. Maximum 5 MiB and 10,000 rows. Port 443 only; no redirects, compressed feeds, HTML/XML, credentials, or private hosts. Ignored dataset inputs are not merged."
          },
          "records": {
            "title": "Raw records (clear for URL/dataset input)",
            "type": "array",
            "description": "Paste up to 10,000 flat record objects. A title and parseable deadline are required per clean row; other fields may be missing. Nonempty records override sourceUrl, datasetId, and integration payload, so clear this fictional prefill before connecting a feed. Delivered clean rows incur the row fee; rejected rows remain in REPORT without a row fee (the start fee still applies).",
            "items": {
              "type": "object"
            }
          },
          "fieldMap": {
            "title": "Field mapping",
            "type": "object",
            "description": "Source column -> standard field, not the reverse: {\"responseDeadline\": \"deadline\", \"office\": \"buyer\", \"noticeId\": \"reference\"}. Targets must be title, deadline, value, buyer, reference, or currency. Source names ignore case/separators; only top-level keys are read (no nested paths). Matching mappings override aliases, even for empty values; unmatched sources and unknown targets are ignored. Inspect mappedFrom and REPORT on a small sample. A deadline must mean submission deadline, not contract end; fieldMap does not validate meaning. All raw fields remain in sourceFields."
          },
          "stageField": {
            "title": "Tender-stage source column (optional)",
            "type": "string",
            "description": "Exact, case-sensitive top-level column name, for example stage. If supplied, only rows whose value equals tender (case/outer whitespace ignored) can pass. Missing stage becomes missing_stage; other values become non_tender_stage in REPORT. Useful for mixed UK tender/award feeds. This checks the supplied label, not the source's truth. Omit for feeds without a stage field; never invent tender labels for award records."
          },
          "currency": {
            "title": "Expected currency",
            "pattern": "^[A-Za-z]{3}$",
            "type": "string",
            "description": "Optional supported currency code (for example USD, EUR, GBP, or INR; full list in README). Omit for a mixed-currency feed. Checks currencies already present in rows; does not fill missing currency, convert values, or make a USD 100 row into EUR. A disagreement becomes currency_mismatch_expected in REPORT. RMB is accepted as CNY."
          },
          "datasetId": {
            "title": "Dataset ID (integration)",
            "type": "string",
            "description": "Apify dataset ID only: 10-32 alphanumeric characters, not a URL or Actor ID. Clear records and sourceUrl first. Reads the first 10,000 rows only; split larger datasets upstream. In Actor-to-Actor Integrations, use {{resource.defaultDatasetId}} or omit this field to use automatic payload.resource.defaultDatasetId. Standalone/API/MCP runs need a real ID, not template braces. Access is checked without a token first, then with the run's permitted storage access on 401/403. Never paste credentials into input."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}