Skip to main content
Version: 2019-05-29 (Current)

Search Customers

Search and filter customers to find records by email, description, metadata, and more. The Search API provides powerful full-text search capabilities across all customers.


Request Parametersโ€‹

Recommended - 2 fieldsRecommended Parameters
โ–ผ
`query`STRING(optional)
Search query string. Searches across customer email, description, and metadata. Supports multiple words (AND logic) and partial matches.
Example:"john@example.com"
`filters`OBJECT(optional)
Filter criteria to narrow search results. Common filters include email, description, created date ranges, and metadata fields.
Example:{"email":"john@example.com"}
Additional - 3 fieldsAdditional Parameters

Responsesโ€‹

200

Successful search

Search completed successfully. Returns a search result object with matching customers in the data array.

Response includes:
  • data - Array of customer objects matching the search criteria
  • total - Total number of results matching the search
  • total_pages - Number of pages available
  • page - Current page number
  • per_page - Number of results per page
  • order - Sort order applied (chronological or reverse_chronological)

400

Bad request

Request validation failed. Check the error message for details.

Common causes:
  • Invalid page number (below 1)
  • Invalid per_page value (above 100 or below 1)
  • Malformed filters object

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid secret key
  • Using public key instead of secret key
  • Incorrect HTTP Basic Auth format

404

Not found

Search endpoint not found or invalid scope.

Common causes:
  • Invalid search scope
  • Incorrect endpoint URL

5xx

Server error

Server-side error occurred. These are rare but should be handled gracefully.

How to handle:

Code samplesโ€‹

curl https://api.omise.co/customers/search \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "scope=customer" \
-d "query=john@example.com" \
-d "filters[email]=john@example.com"

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
bad_requestMissing or invalid parametersCheck that parameters are valid
authentication_failureInvalid API keyVerify your secret key is correct
invalid_scopeInvalid search scopeEnsure scope is set to "customer"

Search Filter Optionsโ€‹

FilterTypeDescription
emailstringCustomer email address
descriptionstringCustomer description or name
createdobjectDate range filter (e.g., {gte: '2025-01-01', lte: '2025-01-31'})
metadataobjectCustom metadata key-value pairs

๐Ÿ”‘API Credentials

Try it outโ€‹

Recommended - 2 fields
Additional - 3 fields
Your IP: ...Loading...