Search
Search allows a program to look-up profiles and their associated accounts. Search only returns profiles having at least one Account with an OPEN
status.
The following fields can be used to search for a profile.
- Name
- Username
- Phone number
In order for a profile to be searchable, it must first consent to search. This can be done by executing a PUT
to update the profile's consent.
PUT /profiles/:profile_id/consents/:consent_id
{
"has_consented": true
}
Response:
{
"id": "12a5c58f-125d-4284-9d60-b5fe09c358f9",
"consent_type": "SEARCH",
"has_consented": true,
"program_consent_definition_id": null,
"document_id": null,
"created_dt": "2022-05-12T20:44:52.702822Z",
"updated_dt": "2022-05-12T21:23:04.538479Z"
}
The consent_id
can be found by querying the consents associated with the profile and finding the "SEARCH" consent_type
.
GET /profiles/:profile_id/consents
Response:
{
"consents": [
{
"id": "12a5c58f-125d-4284-9d60-b5fe09c358f9",
"consent_type": "SEARCH",
"has_consented": false,
"program_consent_definition_id": null,
"document_id": null,
"created_dt": "2022-08-05T11:01:56.421139-07:00",
"updated_dt": "2022-08-05T11:01:56.421139-07:00"
}
]
}
Search by querying
The GET
endpoint can be used for search as-you-type. The query parameter search
must be provided and can include any search term. You may restrict the search to just your program by
setting the query parameter self
to true.
GET /search/profiles?search=John
Response:
{
"profiles": [
{
"id": "a151dd2e-0d90-4ef6-bf08-eae35dd2f7bd",
"username": "jdoe-123",
"full_name": "John Doe",
"phone_number": "1234567890",
"email": "jdoe@jdoe.com",
"program_name": "test-program",
"network": "usdf",
"program_id": "bcc3e4bc-6de3-4ee1-a216-7433786092bc",
"accounts": [
{
"id": "5bb82488-6761-4cfc-bb93-5473885ead19",
"blockchain_address": "tp258ldkgj0345830rjifjaoiu205982jlsaiwspo",
"account_name": "test-account"
}
]
}
],
"count": 1,
"offset": 0,
"limit": 20
}
Search for multiple profiles
Search for multiple profiles at once by executing a POST
with the email
or phone_number
field.
POST /search/profiles
{
"contacts": [
{
"email": "jdoe@jdoe.com",
"phone_number": "1234567890"
}
]
}
Response:
{
"profiles": [
{
"id": "a151dd2e-0d90-4ef6-bf08-eae35dd2f7bd",
"username": "jdoe-123",
"full_name": "John Doe",
"phone_number": "1234567890",
"email": "jdoe@jdoe.com",
"program_name": "test-program",
"network": "usdf",
"program_id": "bcc3e4bc-6de3-4ee1-a216-7433786092bc",
"accounts": [
{
"id": "5bb82488-6761-4cfc-bb93-5473885ead19",
"blockchain_address": "tp258ldkgj0345830rjifjaoiu205982jlsaiwspo",
"account_name": "test-account"
}
]
}
],
"count": 1,
"offset": 0,
"limit": 20
}