{
  "openapi": "3.0.1",
  "info": {
    "title": "Contratos a Vencer — PNCP",
    "description": "Contratos públicos do PNCP cuja vigência termina entre hoje+X e hoje+Y dias, com fornecedor atual (CNPJ) e valor. Base incremental local, filtros por UF, objeto, valor, órgão e fornecedor.",
    "version": "0.1",
    "x-build-id": "a9p4NSRJdKwgTT05S"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kman-br~contratos-a-vencer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kman-br-contratos-a-vencer",
        "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/kman-br~contratos-a-vencer/runs": {
      "post": {
        "operationId": "runs-sync-kman-br-contratos-a-vencer",
        "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/kman-br~contratos-a-vencer/run-sync": {
      "post": {
        "operationId": "run-sync-kman-br-contratos-a-vencer",
        "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": {
          "venceEmDiasMin": {
            "title": "Vence em, no mínimo (dias)",
            "minimum": 0,
            "maximum": 730,
            "type": "integer",
            "description": "Início da janela: contratos cuja vigência termina daqui a pelo menos N dias.",
            "default": 30
          },
          "venceEmDiasMax": {
            "title": "Vence em, no máximo (dias)",
            "minimum": 0,
            "maximum": 730,
            "type": "integer",
            "description": "Fim da janela: contratos cuja vigência termina daqui a no máximo N dias.",
            "default": 180
          },
          "ufs": {
            "title": "UFs",
            "type": "array",
            "description": "Estados da unidade compradora. Vazio = todo o Brasil.",
            "items": {
              "type": "string",
              "enum": [
                "AC",
                "AL",
                "AM",
                "AP",
                "BA",
                "CE",
                "DF",
                "ES",
                "GO",
                "MA",
                "MG",
                "MS",
                "MT",
                "PA",
                "PB",
                "PE",
                "PI",
                "PR",
                "RJ",
                "RN",
                "RO",
                "RR",
                "RS",
                "SC",
                "SE",
                "SP",
                "TO"
              ]
            }
          },
          "palavrasChave": {
            "title": "Palavras-chave no objeto",
            "type": "array",
            "description": "Retorna contratos cujo objeto contenha QUALQUER uma das palavras (sem diferenciar acentos e maiúsculas).",
            "items": {
              "type": "string"
            }
          },
          "valorMin": {
            "title": "Valor global mínimo (R$)",
            "minimum": 0,
            "type": "integer",
            "description": "Ignora contratos com valor global menor que este."
          },
          "cnpjOrgao": {
            "title": "CNPJ do órgão",
            "type": "string",
            "description": "14 dígitos (pontuação é ignorada). Padrão: Universidade Federal da Paraíba, órgão com muitos contratos, para que o run sem configuração sempre traga itens. Apague o campo para a busca nacional (o backfill leva vários runs). Ativa o modo por órgão: o backfill usa o filtro da própria API.",
            "default": "24098477000110"
          },
          "cnpjFornecedor": {
            "title": "CNPJ do fornecedor",
            "type": "string",
            "description": "14 dígitos. Busca por CPF (11 dígitos) não é suportada."
          },
          "maxItems": {
            "title": "Máximo de contratos",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Para ao atingir este número de contratos retornados (cada um é um evento cobrado).",
            "default": 50
          },
          "somenteNovidades": {
            "title": "Só novidades",
            "type": "boolean",
            "description": "Se ligado, retorna apenas contratos novos ou alterados desde o último run com o mesmo filtro (use em execuções agendadas para não pagar duas vezes pelo mesmo contrato). Desligado por padrão: todo run devolve a lista inteira da janela.",
            "default": false
          },
          "fornecedorPessoaFisica": {
            "title": "Fornecedor pessoa física",
            "enum": [
              "omitir",
              "excluir"
            ],
            "type": "string",
            "description": "LGPD. omitir = mantém o contrato sem CPF nem nome do fornecedor; excluir = remove o contrato.",
            "default": "omitir"
          },
          "verificarAditivos": {
            "title": "Verificar aditivos",
            "type": "boolean",
            "description": "Consulta os termos aditivos de cada contrato retornado (1 chamada à fonte por contrato).",
            "default": false
          },
          "baseStoreName": {
            "title": "Nome da base (key-value store)",
            "type": "string",
            "description": "Key-value store nomeado que guarda a base incremental. Use o mesmo nome entre runs para não refazer o backfill.",
            "default": "contratos-a-vencer-base"
          },
          "mesesBackfill": {
            "title": "Meses de backfill",
            "minimum": 1,
            "maximum": 60,
            "type": "integer",
            "description": "Quanto histórico de publicação carregar na base (máx. 60). Padrão 3 meses: basta para a janela padrão e roda em poucos minutos. Contratos publicados antes disso ficam de fora até aumentar o valor.",
            "default": 3
          },
          "maxPaginasPorRun": {
            "title": "Máximo de páginas de backfill por run",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Páginas de 500 registros lidas por run para montar a base; o backfill continua de onde parou no run seguinte.",
            "default": 300
          },
          "intervaloMs": {
            "title": "Intervalo entre requisições (ms)",
            "minimum": 250,
            "maximum": 10000,
            "type": "integer",
            "description": "Ritmo mínimo entre chamadas ao PNCP, que limita rajadas (HTTP 429).",
            "default": 1200
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}