Webhook Authentication: What Integrators Need to Know
When a provider sends an HTTP request to your service because an event occurred, your receiver has to decide whether to accept…
A collection API returns multiple records, such as orders or comments. Clients use filters to request only the records that meet a condition, such as orders with a paid status. Your API documentation should explain how clients name filters, format values, combine conditions, handle uppercase and lowercase letters, and read error responses. It should also explain how the server sorts the records that match those filters.
Together, these rules form the endpoint contract that tells clients what a request means and how the server will respond. Because APIs handle filter syntax and behavior differently, clear examples help clients build requests that return predictable results.
Start by listing the exact query parameter names the endpoint accepts and the fields each parameter filters. A query parameter is a named value in the URL that comes after ?. In status=paid, status is the parameter name and paid is the value. State each field’s data type, allowed values, and supported comparison operators. If clients can filter on nested fields or call built-in functions, document those too.
APIs generally take one of two approaches to filter syntax. You can give each simple filter its own parameter, as in ?status=paid®ion=west, or you can accept a single filter parameter that holds an expression combining multiple conditions. Google AIP-160 describes the single-parameter approach and notes that APIs using it should document which fields an unqualified search term checks. SPS Commerce’s collection guidance also uses a dedicated filter parameter for more complex expressions. Because these conventions use different syntax, spell out which one your endpoint accepts.
Back up the rules with valid examples. If the endpoint only accepts exact status values, show ?status=paid and list every allowed value. If it supports comparisons, explain the operators and show how clients quote or encode values. Formal grammars like OData’s set strict rules for expressions, functions, and encoding. If your API adopts one, point readers to the relevant syntax, since filter parameters vary widely from one API to another.
Tell clients what the server does when they filter on multiple fields or repeat the same parameter. For instance, state whether:
GET /orders?status=paid®ion=west
returns orders that are both paid and in the west, and whether:
GET /orders?status=paid&status=held
returns orders in either status, requires both values at once, or triggers an error.
One common contract applies AND across different fields, so a record must match every condition, and applies OR to repeated values of the same field, so any listed value can match. SPS Commerce’s standard follows this rule for simple filters. Other APIs accept comma-separated alternatives, as shown in JSON:API’s filtering recommendations. JSON:API leaves the filtering rules to each implementation, so its example is one option rather than a universal standard.
When an endpoint accepts filter expressions, document its operator precedence so clients know how the server groups conditions when parentheses are missing. AIP-160’s profile gives OR higher precedence than AND, which is the opposite of what many programmers expect. Clients can use parentheses to make the grouping explicit, as in status = "paid" AND (region = "west" OR region = "north").
If clients send an array using repeated query keys or comma-separated values, document both the URL format and what the server does with those values. OpenAPI’s parameter guidance covers array formats like ids=1,2,3 and ids=1&ids=2&ids=3. That format only tells clients how to serialize the values in the URL. Your documentation still needs to state whether the server treats them as alternatives, requires all of them to match, or rejects the request.
State separately whether parameter names, field names, operators, and string values are case-sensitive, meaning uppercase and lowercase letters have to match exactly. A rule for one part of the query does not automatically apply to the rest. OpenAPI treats parameter names as case-sensitive. OData 4.01 requires its system query-option names and logical operators to be case-insensitive, yet string comparisons in functions like contains remain case-sensitive.
An API might match status=Paid only when the stored value is Paid, while treating AND and and as the same operator. If your API supports case-insensitive text matching, list which fields and operators allow it and show how clients ask for it. OData 4.01, for instance, lets clients call tolower or toupper to normalize string case before comparing values. Do not assume or imply that case-insensitivity applies to every filter.
Explain what the server does when a client sends an unknown field, an unsupported operator, broken syntax, or a value of the wrong type. State clearly whether the server rejects the request or ignores the bad condition, because each choice changes the records the client gets back.
AIP-160 recommends returning an INVALID_ARGUMENT error when a filter breaks its syntax rules or resource schema, such as naming an unknown field or passing text to an integer field. That rule only applies to APIs that follow AIP-160, and it does not dictate a universal HTTP status code or response body. Document your endpoint’s exact status codes and error payloads. Cover how the server handles invalid enum values, malformed timestamps, empty values, and repeated parameters that are only allowed once. If the server accepts or silently ignores any invalid input, say so explicitly.
Explain how a sort parameter orders the records that pass the filters, and show both in the same request:
GET /orders?status=paid&sort=createdAt|desc
List the accepted sort fields and directions. Tell clients what happens when they request an unsupported sort field, and state the default order the server uses when they omit sorting. If clients rely on consistent ordering when multiple records share the same sort value, document how the server breaks ties. Standards allow filtering and sorting in the same request, but the endpoint contract has to spell out how they interact.
Keep your parameter descriptions aligned with what each endpoint supports. Microsoft Graph’s query-parameter documentation notes that support varies by operation and API version. If you publish an OpenAPI description, specify how clients should format array-valued parameters so generated SDKs send them in the form the server expects, and document separately how the server interprets those multiple values.
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com