Skip to content

SAM.gov Opportunities v2 API silently ignores unknown query parameters (e.g. naics instead of ncode) #1640

Description

@ljtyson

Summary

The Opportunities v2 search endpoint silently ignores any query parameter
it doesn't recognize, returning all results as if no filter was applied.
There is no error, warning, or indication in the response that the parameter
was dropped.

Reproduction

Query with the intuitive (but wrong) parameter name:
GET /opportunities/v2/search?naics=512110&postedFrom=...&postedTo=...
→ totalRecords: 2151 (all results, no filtering)

Query with the documented parameter name:
GET /opportunities/v2/search?ncode=512110&postedFrom=...&postedTo=...
→ totalRecords: 0 (correct — no 512110 contracts that day)

Expected behavior

The API should either:
(a) return a 400 with a list of unrecognized parameters, or
(b) accept naics as an alias for ncode (the intuitive name matches the
field name naicsCode returned in the response body)

Why this matters

The response body returns the field as naicsCode, and the concept is
universally called "NAICS code." Developers naturally try naics as the
query parameter. Silent failure means queries appear to work but return
completely unfiltered results, which is difficult to detect without comparing
total record counts against known data.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions