Some top level API resoueces support retrieval with search API methods.
You can use the search APIs to retrieve your Stripe objects in a flexible manner.
Using search is a faster alternative to paginating through all resources.
To create a search query, review the Search query language and reference the query fields of the sub-resource:
Examples
Here are some examples of search queries you can use with the search API methods:
Debt metadata search
curl -G https://api.ophelos.com/debts \
-u sk_prod_H4x0rN0t4R3alAPiK3y: \
--data-urlencode "query=metadata['case_id']:'3012345'"
Customer email search
Lookup customers matching an email.
curl -G https://api.ophelos.com/customers \
-u sk_prod_H4x0rN0t4R3alAPiK3y: \
--data-urlencode "query=customer.email:'[email protected]'"
Numeric filter
Filter payments with a amount
greater than 1000
in cents.'
curl -G https://api.ophelos.com/payments \
-u sk_prod_H4x0rN0t4R3alAPiK3y: \
--data-urlencode "query=amount>1000"
Combining multiple filters
Lookup debts updated on or after 1st July 2024 and a status
of paid
.
curl -G https://api.ophelos.com/debts \
-u sk_prod_H4x0rN0t4R3alAPiK3y: \
--data-urlencode "query=updated_at>=2024-07-01 AND status:paid"
Search query language
Query structure and terminology
A query clause
consists of a field
followed by an operator
followed by a value
:
clause | email="[email protected]" |
field | email |
operator | = |
value | "[email protected]" |
You can combine multiple query clauses in a search by either separating them with a space, or using the AND
or OR
keywords (case-insensitive).
You can't combine AND
and OR
in the same query. Furthermore, there's no option to use parentheses to give priority to certain logic operators.
By default, the API combines clauses with AND
logic.
The example query email:"[email protected]" metadata["key"]:"value"
matches records where both the email address is [email protected]
, and the metadata in the record includes key
with a value of value
.
Supported query fields for each resource
Query fields for customers
Field | Usage | Type |
---|---|---|
email | [email protected] | string |
phone | phone=+447500000000 | string |
mobile | mobile=+447500000000 | string |
country_code | country_code=GB | string |
postal_code | postal_code=FA5 3KE | string |
updated_at | updated_at>=2024-07-01 | string |
metadata | metadata["key"]:"value" | token |
Query fields for debts
Field | Usage | Type |
---|---|---|
status | status:"paying" | string |
account_number | account_number="A-1234567890" | string |
reference_code | reference_code="a1b2c3" | string |
updated_at | updated_at>=2024-07-01 | string |
created_at | created_at=2024-07 | string |
metadata | metadata["key"]:"value" | token |
Query fields for Payments
Field | Usage | Type |
---|---|---|
status | status:"succeeded" | string |
updated_at | updated_at>=2024-07-01 | string |
created_at | created_at=2024-07 | string |
metadata | metadata["key"]:"value" | token |