Search
PhantomJSON supports full-text search across multiple fields using the q query parameter.
Syntax
Section titled “Syntax”?q=searchtermExample
Section titled “Example”curl "https://api.phantomjson.app/v1/users?q=john"Behavior
Section titled “Behavior”- Case-insensitive substring match
- Searches across multiple fields per resource
- Matches partial words
Searchable Fields
Section titled “Searchable Fields”| Resource | Searchable Fields |
|---|---|
| Users | firstName, lastName, email |
| Posts | title, body |
| Comments | name, body |
| Todos | title |
| Albums | title |
| Photos | title |
| Products | name, description |
Examples
Section titled “Examples”Search Users
Section titled “Search Users”# Search by namecurl "https://api.phantomjson.app/v1/users?q=john"
# Search by emailcurl "https://api.phantomjson.app/v1/users?q=example"Search Posts
Section titled “Search Posts”curl "https://api.phantomjson.app/v1/posts?q=react"Search Products
Section titled “Search Products”curl "https://api.phantomjson.app/v1/products?q=iphone"Combining with Other Parameters
Section titled “Combining with Other Parameters”Search works with pagination, filtering, and sorting:
# Search + paginationcurl "https://api.phantomjson.app/v1/users?q=john&page=1&limit=10"
# Search + filtercurl "https://api.phantomjson.app/v1/products?q=phone&category=smartphones"
# Search + sortcurl "https://api.phantomjson.app/v1/users?q=john&sort=firstName:asc"