Query Parameters
What Are Query Parameters?
Query parameters are optional key-value inputs added to a URL to refine a website or API request. They follow ?; each item is a parameter, while the full portion after it is the query string.
Query Parameter Syntax and Example
For /products?category=shoes&sort=price_asc&page=2:
?begins the query string.=joins a name and value.&separates parameters.- The server uses these inputs to shape its response.
Query Parameters vs. Path Parameters
Use a path for identity and query parameters for optional controls.
| Type | Example | Use |
|---|---|---|
| Path | /products/42 | One identified resource |
| Query | /products?color=blue | Filter a collection |
Common Uses in Websites and APIs
REST endpoints often use optional URL parameters to shape a response.
- Search, filtering, and sorting
- Pagination, meaning results split into pages
- Feature settings and campaign tracking
Benefits of Query Parameters
Well-designed query params make read views easier to reuse.
- Shareable, bookmarkable filtered pages
- Flexible API requests without new endpoints
- Consistent URLs that can support caching
Practical Limits and Security Risks
URLs may appear in browser history, logs, analytics, and referrer data.
- Never include passwords, tokens, or sensitive personal data.
- URL-length limits vary across browsers, servers, and proxies.
Encoding and Naming Best Practices
Encode values so reserved characters are not mistaken for URL syntax.
- Spaces may appear as
%20or+. - Encode
#,?,&, and'inside values. - Use consistent lowercase names, validation, defaults, and documented repeated values.
- Define case sensitivity explicitly in your API.
Building Query-Driven App Features with Emergent
Emergent can help build search, filter, sort, and pagination features that keep URL state shareable. Explore the query glossary entry and Emergent learning resources when planning these app interactions.
Frequently Asked Questions
Your Questions, Answered
Don't change this element unless you know what you are doing
How long can a query parameter be?
There is no universal limit. Browsers, servers, proxies, and frameworks set different URL-length limits, so keep URLs reasonably short and use a request body for large or complex input.
What is %20 in a query string?
%20 is the percent-encoded form of a space character.
What is %27 in a URL?
%27 is the percent-encoded form of an apostrophe, or single quote.
Are query parameters case sensitive?
HTTP does not impose one universal rule. An API should document whether names and values are case sensitive, then handle them consistently.
Are query string parameters encrypted in HTTPS?
HTTPS encrypts the URL during transit between browser and server, but query strings can still be stored in logs, history, bookmarks, and application records.
Can a POST request have query parameters?
Yes. A POST request can include query parameters and a request body. Use query parameters for URL-level options and the body for submitted data.
on Emergent today


