Skip to content

Customers Search

Uses the same sample dataset as the other customers examples.

At least one of email or mobile is required. When both are given, a customer matching either one is included — it’s not an AND filter. customerType narrows the result set afterwards; it never widens what counts as a match on email/mobile.


Request

GET /customers/v1?email=ada.lovelace%40example.com
Authorization: ******
Ocp-Apim-Subscription-Key: <subscription_key>

Response — 200 OK

{
"customers": [
{
"customerId": "11111111-1111-1111-1111-111111111111",
"name": "Ada Lovelace",
"email": "ada.lovelace@example.com",
"mobile": "91234567",
"customerType": "Person",
"isB2B": false,
"isPublic": true,
"country": "NO",
"primaryAddress": {
"streetLine1": "Enigmavegen 1",
"postalCode": "0001",
"city": "Oslo",
"country": "NO"
}
}
],
"continuationToken": null
}

The mobile query value must be digits only — no +, spaces, or dashes (enforced by this API; see validation rules below). How that value is matched against the stored customer record is handled by the underlying customer data store, not by this API layer.

Request

GET /customers/v1?mobile=91234567
Authorization: ******
Ocp-Apim-Subscription-Key: <subscription_key>

Response — 200 OK

{
"customers": [
{
"customerId": "11111111-1111-1111-1111-111111111111",
"name": "Ada Lovelace",
"email": "ada.lovelace@example.com",
"mobile": "91234567",
"customerType": "Person",
"isB2B": false,
"isPublic": true,
"country": "NO",
"primaryAddress": {
"streetLine1": "Enigmavegen 1",
"postalCode": "0001",
"city": "Oslo",
"country": "NO"
}
}
],
"continuationToken": null
}

Request

GET /customers/v1?mobile=91234567&pageSize=1
Authorization: ******
Ocp-Apim-Subscription-Key: <subscription_key>

Response — 200 OK

{
"customers": [
{
"customerId": "11111111-1111-1111-1111-111111111111",
"name": "Ada Lovelace",
"customerType": "Person",
"isB2B": false,
"isPublic": true,
"country": "NO"
}
],
"continuationToken": "eyJwYWdlIjogMn0="
}

Repeat the same request with continuationToken=eyJwYWdlIjogMn0= added to fetch the next page. Keep following continuationToken until a response comes back with null — see Pagination for the full rules, including why an empty page doesn’t necessarily mean you’re done.


customerType=Organization is applied after the email/mobile match — it doesn’t change which customers are found, only which of the matches are returned. Searching by an organization contact’s own email with customerType=Organization returns an empty customers array, not the contact’s parent organization.

Request

GET /customers/v1?email=ada.lovelace%40example.com&customerType=Organization
Authorization: ******
Ocp-Apim-Subscription-Key: <subscription_key>

Response — 200 OK

{
"customers": [],
"continuationToken": null
}

Key points:

  • Ada is a Person. Filtering for Organization drops her from the results entirely — it does not redirect to the organization she buys under. Use Get Organization for Contact for that relationship instead

Searching for an email or mobile that isn’t on record returns 200 OK with an empty customers array, not 404.

Request

GET /customers/v1?email=nobody%40example.com
Authorization: ******
Ocp-Apim-Subscription-Key: <subscription_key>

Response — 200 OK

{
"customers": [],
"continuationToken": null
}

{
"type": "<docs-base-url>/errors/validation-failed",
"title": "Validation Failed",
"detail": "Some fields have validation errors",
"status": 400,
"instance": "/customers/v1",
"code": "ERR_VALIDATION_0001",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"errors": [
{ "fieldName": "Email", "message": "At least one of Email or Mobile must be set." }
]
}

email is present but not a valid email address.

{
"type": "<docs-base-url>/errors/validation-failed",
"title": "Validation Failed",
"detail": "Some fields have validation errors",
"status": 400,
"instance": "/customers/v1",
"code": "ERR_VALIDATION_0001",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"errors": [
{ "fieldName": "Email", "message": "Email must be a valid email address of at most 254 characters." }
]
}

400 — Mobile Contains Formatting Characters

Section titled “400 — Mobile Contains Formatting Characters”

mobile must be 5–14 digits with no +, spaces, or dashes.

Request

GET /customers/v1?mobile=%2B47+912+34+567

Response — 400 Bad Request

{
"type": "<docs-base-url>/errors/validation-failed",
"title": "Validation Failed",
"detail": "Some fields have validation errors",
"status": 400,
"instance": "/customers/v1",
"code": "ERR_VALIDATION_0001",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"errors": [
{
"fieldName": "Mobile",
"message": "Mobile must consist of 5 to 14 digits."
}
]
}

pageSize must be between 1 and 100.

GET /customers/v1?mobile=91234567&pageSize=500
{
"type": "<docs-base-url>/errors/validation-failed",
"title": "Validation Failed",
"detail": "Some fields have validation errors",
"status": 400,
"instance": "/customers/v1",
"code": "ERR_VALIDATION_0001",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"errors": [
{ "fieldName": "PageSize", "message": "PageSize must be between 1 and 100." }
]
}

No response body. The request is missing or has an invalid Authorization header.

No response body. The token is valid but does not include the customer:read scope.