{
 "openapi": "3.1.0",
 "info": {
  "title": "BidHatch Federal Contract Opportunities API",
  "version": "1.0.0",
  "description": "Search open U.S. federal contract opportunities built from SAM.gov's public Contract Opportunities data file, refreshed daily. Pay per call with x402 (USDC on Base). No account or API key. Not a government service; always read the official notice. Also: federal contract award history (USAspending.gov public data) for trade-service NAICS codes.",
  "contact": {
   "url": "https://bidhatch.pages.dev/api/",
   "email": "bidhatch@agentmail.to",
   "name": "BidHatch"
  },
  "x-guidance": "Use GET /api/v1/stats (free) to see how many open opportunities match a state/type/set-aside, and GET /api/v1/sample (free) to see the record shape. Then call GET /api/v1/bids with filters (naics, state, setaside, psc, trade, type, agency, q, posted_since, due_after, due_before, limit<=100, offset, sort). Each call costs 0.02 USDC on Base via x402 v2 (exact scheme). Invalid parameters return 400 before payment. Data is SAM.gov public Contract Opportunities data refreshed daily; always confirm details on the linked SAM.gov notice. For incumbents and past prices, call GET /api/v1/awards (0.03 USDC) with naics/psc/state/agency/recipient/q/since/until/min_amount/limit/offset/sort; free shape preview at GET /api/v1/awards-sample."
 },
 "servers": [
  {
   "url": "https://bidhatch.pages.dev"
  }
 ],
 "paths": {
  "/api/v1/bids": {
   "get": {
    "operationId": "searchBids",
    "summary": "Search open federal contract opportunities ($0.02 per call)",
    "description": "Filter ~9,000+ open opportunities by NAICS, state, set-aside, PSC, agency, keyword and dates. Returns up to 100 records with contacts, description excerpt and SAM.gov link. Paid via x402: $0.02 USDC on Base (eip155:8453), exact scheme.",
    "parameters": [
     {
      "name": "naics",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "NAICS code or prefix, comma-separated (max 10), e.g. 561720 or 5617"
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "2-letter place-of-performance state(s), comma-separated, e.g. TX,OK"
     },
     {
      "name": "setaside",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Set-aside code prefix: SBA, 8A, SDVOSBC, WOSB, EDWOSB, HZC, VSA; or ANY / NONE"
     },
     {
      "name": "psc",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Product/Service Code or prefix, e.g. S201"
     },
     {
      "name": "trade",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "BidHatch trade tag: janitorial, landscaping-snow, pest-control, hvac, plumbing, electrical, freight-hauling, courier, moving, facility-maintenance"
     },
     {
      "name": "type",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "solicitation | combined | presolicitation | sources-sought | special-notice (comma-separated)"
     },
     {
      "name": "agency",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Substring of department, agency or office name"
     },
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Keywords (all must match) in title or description"
     },
     {
      "name": "posted_since",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "YYYY-MM-DD"
     },
     {
      "name": "due_after",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "YYYY-MM-DD"
     },
     {
      "name": "due_before",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "YYYY-MM-DD"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "1-100, default 50"
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "0-10000, default 0"
     },
     {
      "name": "sort",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "deadline (default, soonest first) | posted (newest first)"
     }
    ],
    "x-payment-info": {
     "protocols": [
      {
       "x402": {
        "version": 2,
        "scheme": "exact",
        "network": "eip155:8453",
        "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "payTo": "0x0a56c3405674A582514989ba0ecBAf9aA1Bc9E35"
       }
      }
     ],
     "price": {
      "mode": "fixed",
      "currency": "USD",
      "amount": "0.02"
     }
    },
    "responses": {
     "200": {
      "description": "Matching opportunities",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "source": {
           "type": "string"
          },
          "data_updated": {
           "type": "string"
          },
          "total": {
           "type": "integer"
          },
          "count": {
           "type": "integer"
          },
          "limit": {
           "type": "integer"
          },
          "offset": {
           "type": "integer"
          },
          "results": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "title": {
              "type": "string"
             },
             "sol": {
              "type": "string"
             },
             "department": {
              "type": "string"
             },
             "agency": {
              "type": "string"
             },
             "office": {
              "type": "string"
             },
             "type": {
              "type": "string"
             },
             "posted": {
              "type": "string"
             },
             "deadline": {
              "type": "string"
             },
             "naics": {
              "type": "string"
             },
             "psc": {
              "type": "string"
             },
             "setaside_code": {
              "type": "string"
             },
             "setaside": {
              "type": "string"
             },
             "pop_city": {
              "type": "string"
             },
             "pop_state": {
              "type": "string"
             },
             "pop_zip": {
              "type": "string"
             },
             "office_state": {
              "type": "string"
             },
             "contact_name": {
              "type": "string"
             },
             "contact_email": {
              "type": "string"
             },
             "contact_phone": {
              "type": "string"
             },
             "link": {
              "type": "string"
             },
             "description": {
              "type": "string"
             },
             "trades": {
              "type": "array",
              "items": {
               "type": "string"
              }
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad parameters (checked before payment; you are not charged)"
     },
     "402": {
      "description": "Payment required. x402 v2 PaymentRequired object in the PAYMENT-REQUIRED header (base64) and the JSON body."
     }
    }
   }
  },
  "/api/v1/sample": {
   "get": {
    "operationId": "sampleBids",
    "summary": "Free sample: 3 recent open opportunities in the paid response shape",
    "responses": {
     "200": {
      "description": "Sample"
     }
    },
    "security": []
   }
  },
  "/api/v1/stats": {
   "get": {
    "operationId": "bidStats",
    "summary": "Free: counts of open opportunities by state, type and set-aside",
    "responses": {
     "200": {
      "description": "Counts"
     }
    },
    "security": []
   }
  },
  "/api/v1/awards": {
   "get": {
    "operationId": "searchAwards",
    "summary": "Federal contract award history: incumbents, past prices, competitors ($0.03 per call)",
    "description": "Search federal prime contract awards (USAspending.gov public FPDS data, mirrored daily) for trade-service NAICS codes, awards with activity since 2024-10-01. Filter by NAICS, PSC, state, agency, contractor name/UEI, keyword, start date and amount. Returns up to 100 awards (recipient, UEI, amount, outlays, dates, agency, description, NAICS, PSC, place of performance, USAspending link) plus total count, total and average amount for the filter. With no filters it returns the largest covered awards. Paid via x402: $0.03 USDC on Base (eip155:8453), exact scheme. Bad parameters return 400 before payment; query failures are not charged.",
    "parameters": [
     {
      "name": "naics",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "NAICS code(s) or prefix, comma-separated (max 10). Covered: 484110,484121,484122,484220,484230,488510,492110,492210,561720,561740,561790,561730,561710,484210,238220,811310,238210,238990. Uncovered codes return 400 before payment."
     },
     {
      "name": "psc",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "PSC code(s), comma-separated, e.g. S201"
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Place-of-performance state(s), 2-letter, comma-separated"
     },
     {
      "name": "recipient",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Contractor name or UEI text (3-100 chars), for incumbent/competitor research"
     },
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Keyword(s) in the award description (3-100 chars)"
     },
     {
      "name": "agency",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Awarding top-tier agency name, e.g. Department of Veterans Affairs"
     },
     {
      "name": "since",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Award start date on/after YYYY-MM-DD"
     },
     {
      "name": "until",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Award start date on/before YYYY-MM-DD"
     },
     {
      "name": "min_amount",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Minimum award amount in whole dollars"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "1-100, default 25"
     },
     {
      "name": "sort",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "amount (largest first, default) | date (most recently modified first)"
     },
     {
      "name": "offset",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "0-10000"
     }
    ],
    "responses": {
     "200": {
      "description": "Matching opportunities",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "source": {
           "type": "string"
          },
          "data_updated": {
           "type": "string"
          },
          "total": {
           "type": "integer"
          },
          "count": {
           "type": "integer"
          },
          "limit": {
           "type": "integer"
          },
          "offset": {
           "type": "integer"
          },
          "results": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "title": {
              "type": "string"
             },
             "sol": {
              "type": "string"
             },
             "department": {
              "type": "string"
             },
             "agency": {
              "type": "string"
             },
             "office": {
              "type": "string"
             },
             "type": {
              "type": "string"
             },
             "posted": {
              "type": "string"
             },
             "deadline": {
              "type": "string"
             },
             "naics": {
              "type": "string"
             },
             "psc": {
              "type": "string"
             },
             "setaside_code": {
              "type": "string"
             },
             "setaside": {
              "type": "string"
             },
             "pop_city": {
              "type": "string"
             },
             "pop_state": {
              "type": "string"
             },
             "pop_zip": {
              "type": "string"
             },
             "office_state": {
              "type": "string"
             },
             "contact_name": {
              "type": "string"
             },
             "contact_email": {
              "type": "string"
             },
             "contact_phone": {
              "type": "string"
             },
             "link": {
              "type": "string"
             },
             "description": {
              "type": "string"
             },
             "trades": {
              "type": "array",
              "items": {
               "type": "string"
              }
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad parameters (no payment requested)"
     },
     "402": {
      "description": "Payment required. x402 v2 PaymentRequired object in the PAYMENT-REQUIRED header (base64) and the JSON body."
     }
    },
    "x-payment-info": {
     "protocols": [
      {
       "x402": {
        "version": 2,
        "scheme": "exact",
        "network": "eip155:8453",
        "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "payTo": "0x0a56c3405674A582514989ba0ecBAf9aA1Bc9E35"
       }
      }
     ],
     "price": {
      "mode": "fixed",
      "currency": "USD",
      "amount": "0.03"
     }
    }
   }
  },
  "/api/v1/awards-sample": {
   "get": {
    "operationId": "awardsSample",
    "summary": "Free: 3 recent janitorial awards in the paid response shape",
    "responses": {
     "200": {
      "description": "Sample awards"
     }
    },
    "security": []
   }
  }
 }
}