{
  "openapi": "3.1.0",
  "info": {
    "title": "bidfeed",
    "version": "1.0.0",
    "description": "Public tender and grant notices from TED and Grants.gov as one JSON feed. Every answer is an envelope with ok, data, error and meta. Calls without a key run in sample mode: the latest rows only, no paging, and a daily limit per caller address. The same data is also offered to agent clients as a tool endpoint at POST /mcp, which is not a REST route; see /docs.html.",
    "contact": {
      "name": "B4Battle LLC",
      "email": "bidfeed@b4battle.com"
    }
  },
  "servers": [
    {
      "url": "https://feed.b4battle.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    },
    {}
  ],
  "paths": {
    "/v1/opportunities": {
      "get": {
        "operationId": "listOpportunities",
        "summary": "List notices, newest first",
        "description": "Counts one call against the daily limit.",
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": false,
            "description": "Only notices from this source.",
            "schema": {
              "type": "string",
              "enum": [
                "ted",
                "grants"
              ]
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "3 letter country code, like DEU.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{3}$"
            }
          },
          {
            "name": "code",
            "in": "query",
            "required": false,
            "description": "Start of a classification code, like 45 or 93.224.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9.]{1,12}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Text in the title or the buyer name.",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Published on or after this date, like 2026-01-31. A date-time with an offset also works.",
            "schema": {
              "type": "string",
              "maxLength": 30
            }
          },
          {
            "name": "deadline_after",
            "in": "query",
            "required": false,
            "description": "Deadline after this date.",
            "schema": {
              "type": "string",
              "maxLength": 30
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page. Capped by the plan. Default 25, or the plan cap when that is lower.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9999
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Value of meta.nextCursor from the page before. Ignored in sample mode.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of notices.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Opportunity"
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "count",
                        "limit",
                        "nextCursor",
                        "mode",
                        "credit"
                      ],
                      "properties": {
                        "count": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "Pass as cursor to get the next page. null on the last page and in sample mode."
                        },
                        "mode": {
                          "type": "string",
                          "description": "Plan id of the key, or sample for calls without a key."
                        },
                        "credit": {
                          "type": "string",
                          "description": "Source credit line."
                        }
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "x-ratelimit-limit": {
                "$ref": "#/components/headers/x-ratelimit-limit"
              },
              "x-ratelimit-remaining": {
                "$ref": "#/components/headers/x-ratelimit-remaining"
              },
              "x-ratelimit-reset": {
                "$ref": "#/components/headers/x-ratelimit-reset"
              }
            }
          },
          "400": {
            "description": "A filter is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "401": {
            "description": "The API key is not valid, or it has expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "429": {
            "description": "Daily limit reached. It resets at 00:00 UTC.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          }
        }
      }
    },
    "/v1/opportunities/{id}": {
      "get": {
        "operationId": "getOpportunity",
        "summary": "One notice by id",
        "description": "Counts one call against the daily limit.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Notice id, like ted:123456-2026 or grants:123456.",
            "schema": {
              "type": "string",
              "pattern": "^(ted:[0-9]{1,12}-[0-9]{4}|grants:[0-9]{1,12})$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The notice.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Opportunity"
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "mode",
                        "credit"
                      ],
                      "properties": {
                        "mode": {
                          "type": "string",
                          "description": "Plan id of the key, or sample for calls without a key."
                        },
                        "credit": {
                          "type": "string",
                          "description": "Source credit line."
                        }
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "x-ratelimit-limit": {
                "$ref": "#/components/headers/x-ratelimit-limit"
              },
              "x-ratelimit-remaining": {
                "$ref": "#/components/headers/x-ratelimit-remaining"
              },
              "x-ratelimit-reset": {
                "$ref": "#/components/headers/x-ratelimit-reset"
              }
            }
          },
          "400": {
            "description": "The notice id is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "401": {
            "description": "The API key is not valid, or it has expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "403": {
            "description": "The notice is older than the plan allows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "404": {
            "description": "No notice with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "429": {
            "description": "Daily limit reached. It resets at 00:00 UTC.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          }
        }
      }
    },
    "/v1/plans": {
      "get": {
        "operationId": "listPlans",
        "summary": "Plans and their limits",
        "description": "Not counted. Needs no key.",
        "security": [
          {}
        ],
        "responses": {
          "200": {
            "description": "Plans and the sample mode limits.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "plans",
                        "sample",
                        "paidKeyDays"
                      ],
                      "properties": {
                        "paidKeyDays": {
                          "type": "integer",
                          "description": "How many days a key from a paid plan works."
                        },
                        "plans": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "id",
                              "name",
                              "priceUsdMonth",
                              "callsPerDay",
                              "maxPageSize",
                              "windowDays"
                            ],
                            "properties": {
                              "id": {
                                "type": "string",
                                "enum": [
                                  "free",
                                  "starter",
                                  "pro"
                                ]
                              },
                              "name": {
                                "type": "string"
                              },
                              "priceUsdMonth": {
                                "type": "number"
                              },
                              "callsPerDay": {
                                "type": "integer"
                              },
                              "maxPageSize": {
                                "type": "integer"
                              },
                              "windowDays": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "description": "How far back rows are visible. null means the full history."
                              }
                            }
                          }
                        },
                        "sample": {
                          "type": "object",
                          "required": [
                            "callsPerDay",
                            "maxPageSize",
                            "windowDays"
                          ],
                          "properties": {
                            "callsPerDay": {
                              "type": "integer"
                            },
                            "maxPageSize": {
                              "type": "integer"
                            },
                            "windowDays": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "type": "null"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Your plan and calls today",
        "description": "Not counted.",
        "responses": {
          "200": {
            "description": "Plan and usage of the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "data",
                    "error",
                    "meta"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "plan",
                        "callsToday",
                        "callsPerDay",
                        "maxPageSize",
                        "windowDays",
                        "expires"
                      ],
                      "properties": {
                        "plan": {
                          "type": "string",
                          "description": "Plan id of the key, or sample for calls without a key."
                        },
                        "callsToday": {
                          "type": "integer"
                        },
                        "callsPerDay": {
                          "type": "integer"
                        },
                        "maxPageSize": {
                          "type": "integer"
                        },
                        "windowDays": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "expires": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time",
                          "description": "When the key stops working. A key from a paid plan works for 30 days. null for a key with no end date and for calls without a key."
                        }
                      }
                    },
                    "error": {
                      "type": "null"
                    },
                    "meta": {
                      "type": "null"
                    }
                  }
                }
              }
            },
            "headers": {
              "x-ratelimit-limit": {
                "$ref": "#/components/headers/x-ratelimit-limit"
              },
              "x-ratelimit-remaining": {
                "$ref": "#/components/headers/x-ratelimit-remaining"
              },
              "x-ratelimit-reset": {
                "$ref": "#/components/headers/x-ratelimit-reset"
              }
            }
          },
          "401": {
            "description": "The API key is not valid, or it has expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Your bidfeed key. Authorization: Bearer YOUR_KEY also works. Without a key the call runs in sample mode."
      }
    },
    "headers": {
      "x-ratelimit-limit": {
        "description": "Calls allowed per day.",
        "schema": {
          "type": "integer"
        }
      },
      "x-ratelimit-remaining": {
        "description": "Calls left today.",
        "schema": {
          "type": "integer"
        }
      },
      "x-ratelimit-reset": {
        "description": "Unix time in seconds of the next reset, 00:00 UTC.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "schemas": {
      "Failure": {
        "type": "object",
        "required": [
          "ok",
          "data",
          "error",
          "meta"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "data": {
            "type": "null"
          },
          "error": {
            "type": "string",
            "description": "One plain line."
          },
          "meta": {
            "type": "null"
          }
        }
      },
      "Opportunity": {
        "type": "object",
        "required": [
          "id",
          "source",
          "title",
          "buyer",
          "country",
          "codes",
          "valueAmount",
          "valueCurrency",
          "publishedAt",
          "deadlineAt",
          "url",
          "lang"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "ted",
              "grants"
            ]
          },
          "title": {
            "type": "string"
          },
          "buyer": {
            "type": "string"
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "valueAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "valueCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "publishedAt": {
            "type": "string"
          },
          "deadlineAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": "string",
            "description": "Official notice page."
          },
          "lang": {
            "type": "string"
          }
        }
      }
    }
  }
}
