{
  "openapi": "3.1.0",
  "info": {
    "title": "NextBid Data API",
    "version": "0.9.36",
    "summary": "Federal, state and local government opportunities, one record per bid with the posted documents converted to text, for people and their AI.",
    "description": "AI agents are welcome. Your own assistants and agents may use NextBid through the API and MCP under your account. No separate agent seats. NextBid is an independent company, not a government agency; the issuing agency's official notice always controls. Search by trade, set-aside program, agency, source and deadline; read the full record; read the converted documents as text when the source makes them available. Every record links to its official notice and carries the time its source was last checked. A set-aside program match is set-aside language on the solicitation, not an eligibility determination. One call = one request to a metered endpoint or one MCP tool call.",
    "termsOfService": "https://nextbid.us/terms",
    "contact": {
      "email": "keys@nextbid.us",
      "url": "https://nextbid.us/ai"
    },
    "x-agent-permission": "AI agents are welcome. Your own assistants and agents may use NextBid through the API and MCP under your account. No separate agent seats.",
    "x-trust": {
      "how-it-works": "https://nextbid.us/trust",
      "data-sources": "https://nextbid.us/trust/data-sources",
      "ai": "https://nextbid.us/trust/ai",
      "api-terms": "https://nextbid.us/legal/api-terms",
      "acceptable-use": "https://nextbid.us/legal/acceptable-use",
      "status": "https://nextbid.us/status",
      "llms": "https://nextbid.us/llms.txt"
    }
  },
  "servers": [
    {
      "url": "https://api.nextbid.us",
      "description": "NextBid REST API and MCP (machine surface)"
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "BearerKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "BearerKey": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "parameters": {
      "nb_id": {
        "name": "nb_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^NB\\d{8}$"
        },
        "description": "NextBid opportunity id"
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "No key, or an unknown key"
      },
      "PaymentRequired": {
        "description": "Allowance used; body lists the plan options"
      },
      "TooMany": {
        "description": "Rate or concurrency limit; honour Retry-After"
      }
    },
    "schemas": {
      "OpportunitySummary": {
        "type": "object",
        "properties": {
          "nb_id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "agency": {
            "type": [
              "string",
              "null"
            ]
          },
          "solicitation_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "set_aside": {
            "type": [
              "string",
              "null"
            ]
          },
          "response_deadline": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "posted_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lifecycle_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "tradelines": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "naics": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "states": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "document_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "source_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "last_updated": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      }
    }
  },
  "paths": {
    "/v1/account": {
      "get": {
        "summary": "My Account: the numbers, the business profile and recorded pursuits (free)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/account/profile": {
      "get": {
        "summary": "The business profile: what work the customer is looking for (free)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Update the business profile: company, website, tradelines, specialties, service_areas, target_markets, certifications, products, notes (free)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "summary": "Service health and replica freshness",
        "security": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/opportunities": {
      "get": {
        "summary": "Search open opportunities",
        "parameters": [
          {
            "name": "tradelines",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "comma list of trade ids or aliases (badge readers -> lowvoltage)"
          },
          {
            "name": "set_asides",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "comma list of program ids or aliases: small_business, 8a, hubzone, sdvosb, wosb, isbee, california_sb_dvbe, open"
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "keywords over title and description"
          },
          {
            "name": "agencies",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sources",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "states",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "open",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "due_within_days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "deadline_from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "deadline_to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "deadline",
                "relevance"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 5,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "total, page, results[], facets, query (with tradelines_unresolved and set_aside_programs)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OpportunitySummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "unknown_tradeline or parameter too long"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        }
      }
    },
    "/v1/opportunities/{nb_id}": {
      "get": {
        "summary": "The full record: description, AI summary, contacts, amendments, documents, source link",
        "parameters": [
          {
            "$ref": "#/components/parameters/nb_id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/v1/opportunities/{nb_id}/documents": {
      "get": {
        "summary": "Filed documents and the portal's attachment list",
        "parameters": [
          {
            "$ref": "#/components/parameters/nb_id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/opportunities/{nb_id}/documents/{sha256}/download": {
      "get": {
        "summary": "Time-limited download link for one stored original document",
        "description": "Use a sha256 from GET /v1/opportunities/{nb_id}/documents where stored is true. One request. Returns 409 not_yet_available when the original is not yet verified in NextBid's object store. The file itself is served by the object store, not through this API.",
        "parameters": [
          {
            "name": "nb_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^NB\\d{8}$"
            }
          },
          {
            "name": "sha256",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Download link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "API key required"
          },
          "404": {
            "description": "No such opportunity or document"
          },
          "409": {
            "description": "Original not yet available"
          }
        }
      }
    },
    "/v1/opportunities/{nb_id}/files": {
      "get": {
        "summary": "Text artifacts stored for the bid (path, bytes, mtime, kind)",
        "parameters": [
          {
            "$ref": "#/components/parameters/nb_id"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/opportunities/{nb_id}/files/{path}": {
      "get": {
        "summary": "One artifact as text (markdown, JSON or plain text; 5 MB cap)",
        "parameters": [
          {
            "$ref": "#/components/parameters/nb_id"
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/markdown, application/json or text/plain"
          },
          "404": {
            "description": "Not found"
          },
          "413": {
            "description": "File too large"
          }
        }
      }
    },
    "/v1/opportunities/{nb_id}/pursuit": {
      "post": {
        "summary": "Record a pursuit status for an opportunity, only because the customer said so; reading a bid never counts (free)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "watching",
                      "pursuing",
                      "submitted",
                      "won",
                      "lost",
                      "dropped"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "bad status or nb_id"
          }
        }
      }
    },
    "/v1/pricing": {
      "get": {
        "summary": "Plans and how to get a key",
        "security": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/public/corpus": {
      "get": {
        "summary": "Public corpus numbers with their definitions (cached ten minutes): total_solicitations (distinct, duplicates excluded), open (listed open by the source with the deadline ahead or unstated, or deadline ahead with no status), open_source_confirmed, open_deadline_ahead_status_unstated, listed_open_past_deadline (not open), status_unknown (not open), open_with_deadline, open_no_deadline, due_7d/due_14d/due_30d (known deadline only), posted_7d, open_set_asides (distinct open solicitations designated under any supported program, each counted once, open competition excluded), open_set_aside_mentions (title language only), set_asides_by_program, unmapped_set_aside_values (for review), documents, text_artifacts, sources, as_of, replica_as_of, definitions",
        "security": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/set-asides": {
      "get": {
        "summary": "Set-aside programs with official references, aliases and open counts",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/set-asides/{id}": {
      "get": {
        "summary": "One set-aside program",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Unknown program"
          }
        }
      }
    },
    "/v1/stats": {
      "get": {
        "summary": "The same corpus numbers as /v1/public/corpus with the same definitions, plus open_by_source, contacts and amendments",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/tradelines": {
      "get": {
        "summary": "The 21 trades with specialties, search aliases and open counts",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tradelines/{id}": {
      "get": {
        "summary": "One trade",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Unknown trade"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "summary": "The account's numbers: plan, allowance used and remaining, reset date, requests and errors this period, keys with last use, what counts as a call (free)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "MCP endpoint (Streamable HTTP, stateless). Tools: search_opportunities, get_opportunity, list_documents, list_files, read_file, list_tradelines, list_set_asides, my_account, mark_pursuit, corpus_stats, my_usage",
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "405": {
            "description": "Only POST"
          }
        },
        "description": "Remote MCP endpoint (Streamable HTTP, stateless). Public discovery: with no credential at all, the endpoint answers only initialize, notifications/initialized, ping and tools/list (the tool catalog; no data, never metered, rate-limited per IP). Every tool call needs an API key and is metered exactly like the REST call it wraps.",
        "security": [
          {},
          {
            "ApiKeyHeader": []
          },
          {
            "BearerKey": []
          }
        ]
      }
    }
  },
  "externalDocs": {
    "description": "Bring your AI: connect over MCP or REST",
    "url": "https://nextbid.us/ai"
  }
}
