Universal search
Searches a scope of data based on input parameters. Use this endpoint to perform full-text search and filtered queries across charges, customers, disputes, recipients, and other resources.
API Credentials
Request Parametersโ
Required - 1 fieldRequired Parameters
`scope`STRING(required)
Data type to search. Determines which resource type is searched and what filters are available.
Recommended - 4 fieldsRecommended Parameters
`query`STRING(optional)
Search query text for full-text search. Searches across IDs, descriptions, metadata, emails, and names depending on scope.
`filters`OBJECT(optional)
Search filters to narrow results. Available filters depend on the scope. Common filters include status, amount, created date ranges.
`order`STRING(optional)
Results ordering based on creation time.
`page`INTEGER(optional)
Page number for pagination (1-indexed).
Additional - 1 fieldAdditional Parameters
Responsesโ
200
Successful searchReturns a search object containing paginated results in the data array.
Response structure:
object- String value "search"data- Array of objects matching the scope (reverse chronological by default)page- Current page numberper_page- Records per pagetotal- Total records matching querytotal_pages- Total number of pagesfilters- Applied search filtersquery- Search query usedscope- Resource type searchedlocation- API endpoint pathorder- Results ordering applied
- Uses
pageandper_page(different from standard list endpoints) - Results delivered in reverse chronological order by default
- Supports up to 100 results per page
400
Bad requestRequest validation failed. Check the error message for details.
Common causes:
- Missing required
scopeparameter - Invalid scope value
- Malformed filters object
- Invalid date format in filters
401
UnauthorizedAuthentication 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
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/search \
-X GET \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "scope=charge" \
-d "query=thb" \
-d "filters[created]=2019/01/01..2019/12/31"
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
search = Omise::Search.execute(
'charge',
query: 'thb',
filters: { created: '2019/01/01..2019/12/31' }
)
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
search = omise.Search.execute(
'charge',
query='thb',
filters={'amount': '1000..2000', 'captured': 'true'}
)
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const search = await omise.search.list({
scope: 'charge',
query: 'thb',
filters: {
created: '2019/01/01..2019/12/31'
}
});
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$search = OmiseSearch::execute([
'scope' => 'charge',
'query' => 'thb',
'filters' => [
'created' => '2019/01/01..2019/12/31'
]
]);
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
SearchResult<Charge> search = client.search()
.scope(SearchScope.Charge)
.query("thb")
.filter("created", "2019/01/01..2019/12/31")
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var search = await client.Search.Execute(new SearchRequest
{
Scope = "charge",
Query = "thb",
Filters = new Dictionary<string, object>
{
{ "created", "2019/01/01..2019/12/31" }
}
});
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
search, _ := client.Search(&operations.SearchOptions{
Scope: "charge",
Query: "thb",
Filters: map[string]interface{}{
"created": "2019/01/01..2019/12/31",
},
})
Error and result codesโ
Common Filter Patternsโ
| Filter Syntax | Description | Example |
|---|---|---|
field=value | Exact match | status=successful |
field=val1..val2 | Range | amount=1000..5000 |
field=date..date | Date range | created=2019/01/01..2019/12/31 |
field=true/false | Boolean | captured=true |
Available Filters by Scopeโ
Charge scope:
status- successful, failed, pending, expiredamount- Exact amount or range (1000..5000)captured- true/falsecreated- Date range (2019/01/01..2019/12/31)
Customer scope:
created- Date range
Dispute scope:
status- open, pending, won, lostcreated- Date range
Recipient scope:
active- true/falseverified- true/false
Try it outโ
Required - 1 fields
Recommended - 4 fields
Additional - 1 fields