{
  "openapi": "3.1.0",
  "info": {
    "title": "Delta Registry — Tucuman Argentina Licitaciones - Tender Delta API",
    "description": "Monitors the Province of Tucuman, Argentina's official procurement portal for public tenders - licitaciones publicas, privadas, concursos de precios and contrataciones directas - across upcoming, in-adjudication and awarded stages, with full renglon detail, montos and direct pliego PDF links.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/TdJtze8dfyykMj2qA/runs": {
      "post": {
        "operationId": "startTucumanComprasMonitorRun",
        "summary": "Start an async run of: Monitors the Province of Tucuman, Argentina's official procurement portal for public tenders - licitaciones publicas, privadas, concursos de precios and contrataciones directas - across upcoming, in-adjudication and awarded stages, with full renglon detail, montos and direct pliego PDF links.",
        "x-async-pattern-reason": "No production run history exists for this actor — defaulting to the async run+poll pattern as a precaution, not a measurement. Re-run this generator once real telemetry exists to potentially switch it to sync.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "estados": {
                    "type": "array",
                    "description": "Which procurement states to fetch (estado_compra on the portal). 1 = upcoming opening, 2 = in adjudication, 3 = already awarded.",
                    "default": [
                      "1"
                    ],
                    "items": {
                      "type": "string",
                      "enum": [
                        "1",
                        "2",
                        "3"
                      ]
                    },
                    "minItems": 1
                  },
                  "maxItems": {
                    "type": "integer",
                    "description": "Hard cap on the number of tenders returned this run, across all selected states. The portal lists only 5 tenders per page, so a high value across multiple states means many sequential requests - estado 2 alone has 3700+ historical records. Start small.",
                    "default": 100,
                    "minimum": 1
                  },
                  "onlyNew": {
                    "type": "boolean",
                    "description": "Delta mode for recurring/scheduled monitoring: returns only tenders that are new, changed to a different estado_compra (a real lifecycle transition, e.g. upcoming -> awarded) or amended (a changed monto, renglon or date) since a previous run. Tracked cross-estado, per idCompra, in this actor's own named key-value store (tucuman-compras-monitor-delta-state), so it survives between scheduled runs - unlike the run's default key-value store, which is created fresh per run. Implemented as a POST-FILTER: this actor still fetches up to maxItems as usual and only then drops unchanged already-seen ids, rather than stopping pagination early once N pages come back with nothing new. Early-stop is NOT...",
                    "default": false
                  },
                  "eventTypes": {
                    "type": "array",
                    "description": "Which kinds of change to deliver when 'Only new' is on (ignored, everything delivered, when it is off). NEW_LISTING = never seen before. STATUS_CHANGE = seen before under a different estado_compra (a real lifecycle transition). UPDATED = seen before, same estado, but a monto, renglon, date or other field changed.",
                    "default": [
                      "NEW_LISTING",
                      "STATUS_CHANGE",
                      "UPDATED"
                    ],
                    "items": {
                      "type": "string",
                      "enum": [
                        "NEW_LISTING",
                        "STATUS_CHANGE",
                        "UPDATED"
                      ]
                    }
                  },
                  "dateRange": {
                    "type": "string",
                    "description": "Filters results to tenders whose fechaAperturaSobres (bid-opening date - the only per-tender date this source publishes) falls within the last 24 hours / 7 days / 30 days. Independent of onlyNew - combine both for 'new to me AND recently opened'. Gotcha: for estado 1 (apertura proxima) this date is always in the FUTURE, since the opening has not happened yet, so it can never fall inside this backward-looking window - dateRange only has a real effect on estado 2/3 tenders, whose opening has already occurred. See README.md 'Delta mode'.",
                    "enum": [
                      "24h",
                      "7d",
                      "30d"
                    ]
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Run started. Poll GET /actor-runs/{runId} with the returned run id until status is SUCCEEDED, then fetch its dataset items.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-openai-isConsequential": false
      }
    },
    "/actor-runs/{runId}": {
      "get": {
        "operationId": "getTucumanComprasMonitorRunStatus",
        "summary": "Poll the status of a previously started run.",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current run status. When status is SUCCEEDED, fetch the dataset via GET /datasets/{datasetId}/items, passing this response's defaultDatasetId field as {datasetId}.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "defaultDatasetId": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-openai-isConsequential": false
      }
    },
    "/datasets/{datasetId}/items": {
      "get": {
        "operationId": "getTucumanComprasMonitorDatasetItems",
        "summary": "Fetch the dataset items produced by a completed run.",
        "parameters": [
          {
            "name": "datasetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of normalized records from the actor run.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$schema": "https://json-schema.org/draft/2020-12/schema",
                    "actorSpecification": 1,
                    "title": "Dataset Schema",
                    "fields": {
                      "type": "object",
                      "properties": {
                        "idCompra": {
                          "title": "ID Compra",
                          "type": "string"
                        },
                        "estadoCompra": {
                          "title": "Estado Compra",
                          "type": "string",
                          "description": "1, 2 or 3"
                        },
                        "estadoCompraLabel": {
                          "title": "Estado",
                          "type": "string"
                        },
                        "reparticion": {
                          "title": "Reparticion",
                          "type": "string"
                        },
                        "tipoCompra": {
                          "title": "Tipo de Compra",
                          "type": "string"
                        },
                        "rubro": {
                          "title": "Rubro",
                          "type": "string"
                        },
                        "numeroExpediente": {
                          "title": "Numero de Expediente",
                          "type": "string"
                        },
                        "numeroConvocatoria": {
                          "title": "Numero de Convocatoria",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "primerRenglon": {
                          "title": "Primer Renglon",
                          "type": "string"
                        },
                        "valorPliego": {
                          "title": "Valor del Pliego",
                          "type": "string"
                        },
                        "presupuestoOficial": {
                          "title": "Presupuesto Oficial",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "garantiaOfertaExigida": {
                          "title": "Garantia de Oferta Exigida",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "fechaAperturaSobres": {
                          "title": "Fecha de Apertura de Sobres",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "fechaAdjudicacion": {
                          "title": "Fecha de Adjudicacion",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "lugarApertura": {
                          "title": "Lugar de Apertura",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "informesAdquisicionPliegos": {
                          "title": "Informes / Adquisicion de Pliegos",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "autorizadoPor": {
                          "title": "Autorizado Por",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "objetoLibre": {
                          "title": "Objeto (texto libre)",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "renglones": {
                          "title": "Renglones",
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "renglon": {
                                "type": "string"
                              },
                              "descripcion": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "pliegoPdfUrl": {
                          "title": "Pliego PDF URL",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "record_id": {
                          "title": "Record ID",
                          "type": "string",
                          "description": "Same value as idCompra, standardized across this portfolio's actors."
                        },
                        "event_type": {
                          "title": "Event Type",
                          "type": "string",
                          "description": "NEW_LISTING (never seen before), STATUS_CHANGE (moved to a different estado_compra since last seen), UPDATED (amended within the same estado) or UNCHANGED (only ever delivered when Only new is off)."
                        },
                        "scraped_at": {
                          "title": "Scraped At",
                          "type": "string",
                          "description": "ISO-8601 timestamp of this run's extraction, same for every record from one run."
                        },
                        "is_new": {
                          "title": "Is New",
                          "type": "boolean",
                          "description": "True if this record's id was not already returned by a previous run at all, under any estado (computed even when onlyNew=false)."
                        },
                        "previousEstado": {
                          "title": "Previous Estado",
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Set only when event_type=STATUS_CHANGE: the estado_compra this id was last seen under."
                        },
                        "contentHash": {
                          "title": "Content Hash",
                          "type": "string",
                          "description": "sha1 fingerprint of this record's changeable fields as of this run - used to detect UPDATED between runs."
                        },
                        "source_url": {
                          "title": "Source URL",
                          "type": "string",
                          "description": "The listing page this record was read from, with a fragment identifying its own modal."
                        }
                      }
                    },
                    "views": {
                      "overview": {
                        "title": "Overview",
                        "transformation": {
                          "fields": [
                            "idCompra",
                            "tipoCompra",
                            "reparticion",
                            "rubro",
                            "numeroExpediente",
                            "fechaAperturaSobres",
                            "estadoCompraLabel",
                            "is_new",
                            "pliegoPdfUrl"
                          ]
                        },
                        "display": {
                          "component": "table",
                          "columns": [
                            {
                              "label": "ID",
                              "format": "text",
                              "field": "idCompra"
                            },
                            {
                              "label": "Tipo",
                              "format": "text",
                              "field": "tipoCompra"
                            },
                            {
                              "label": "Reparticion",
                              "format": "text",
                              "field": "reparticion"
                            },
                            {
                              "label": "Rubro",
                              "format": "text",
                              "field": "rubro"
                            },
                            {
                              "label": "Expediente",
                              "format": "text",
                              "field": "numeroExpediente"
                            },
                            {
                              "label": "Apertura",
                              "format": "text",
                              "field": "fechaAperturaSobres"
                            },
                            {
                              "label": "Estado",
                              "format": "text",
                              "field": "estadoCompraLabel"
                            },
                            {
                              "label": "Nuevo",
                              "format": "text",
                              "field": "is_new"
                            },
                            {
                              "label": "Pliego",
                              "format": "link",
                              "field": "pliegoPdfUrl"
                            }
                          ]
                        }
                      },
                      "changes": {
                        "title": "Status changes & amendments",
                        "transformation": {
                          "fields": [
                            "idCompra",
                            "event_type",
                            "previousEstado",
                            "estadoCompraLabel",
                            "reparticion",
                            "presupuestoOficial",
                            "fechaAperturaSobres",
                            "pliegoPdfUrl",
                            "scraped_at"
                          ]
                        },
                        "display": {
                          "component": "table",
                          "columns": [
                            {
                              "label": "ID",
                              "format": "text",
                              "field": "idCompra"
                            },
                            {
                              "label": "Evento",
                              "format": "text",
                              "field": "event_type"
                            },
                            {
                              "label": "Estado anterior",
                              "format": "text",
                              "field": "previousEstado"
                            },
                            {
                              "label": "Estado actual",
                              "format": "text",
                              "field": "estadoCompraLabel"
                            },
                            {
                              "label": "Reparticion",
                              "format": "text",
                              "field": "reparticion"
                            },
                            {
                              "label": "Presupuesto oficial",
                              "format": "text",
                              "field": "presupuestoOficial"
                            },
                            {
                              "label": "Apertura",
                              "format": "text",
                              "field": "fechaAperturaSobres"
                            },
                            {
                              "label": "Pliego",
                              "format": "link",
                              "field": "pliegoPdfUrl"
                            },
                            {
                              "label": "Detectado",
                              "format": "date",
                              "field": "scraped_at"
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-openai-isConsequential": false
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApifyBearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "security": [
    {
      "ApifyBearerAuth": []
    }
  ]
}