Search

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:

clauseemail="[email protected]"
fieldemail
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

FieldUsageType
email[email protected]string
phonephone=+447500000000string
mobilemobile=+447500000000string
country_codecountry_code=GBstring
postal_codepostal_code=FA5 3KEstring
updated_atupdated_at>=2024-07-01string
metadatametadata["key"]:"value"token

Query fields for debts

FieldUsageType
statusstatus:"paying"string
account_numberaccount_number="A-1234567890"string
reference_codereference_code="a1b2c3"string
updated_atupdated_at>=2024-07-01string
created_atcreated_at=2024-07string
metadatametadata["key"]:"value"token

Query fields for Payments

FieldUsageType
statusstatus:"succeeded"string
updated_atupdated_at>=2024-07-01string
created_atcreated_at=2024-07string
metadatametadata["key"]:"value"token