> ## Documentation Index
> Fetch the complete documentation index at: https://developer.fabric.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Search for customer

> Using this endpoint, you can search for customers based on filter conditions. By specifying `offset` and `limit`, you can narrow down your search results. In addition, using the `isDelete` property in the request body, you can filter for either deleted or non-deleted customers.



## OpenAPI

````yaml customers.openapi post /customers/search
openapi: 3.0.0
info:
  title: Customers
  description: >-
    The fabric **Customers** API is used to create and manage details of
    storefront customers, also referred to as shoppers. The `Customers` or
    `Customer Address` APIs provide features for store admins to manage their
    customers' details and addresses. The `Customer Self' API provide features
    for customers or shoppers to independently manage their own details.
  version: 3.0.0
  x-audience: external-public
  contact:
    name: fabric Support
    email: support@fabric.inc
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
  termsOfService: https://fabric.inc/terms-of-use
servers:
  - url: https://api.fabric.inc/v3
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Customer Profile
    description: >-
      These endpoints provide the features for store admins to create and manage
      customers' details.
  - name: Customer Address
    description: >-
      These endpoints provide the features for store admins to create and manage
      customers' addresses.
  - name: Customer Self
    description: >-
      These endpoints provide the feature for customers or shoppers to
      independently manage their details in the storefront.
paths:
  /customers/search:
    parameters:
      - $ref: '#/components/parameters/xFabricTenantId'
      - $ref: '#/components/parameters/xFabricRequestId'
    post:
      tags:
        - Customer Profile
      summary: Search for customer
      description: >-
        Using this endpoint, you can search for customers based on filter
        conditions. By specifying `offset` and `limit`, you can narrow down your
        search results. In addition, using the `isDelete` property in the
        request body, you can filter for either deleted or non-deleted
        customers.
      operationId: searchCustomer
      requestBody:
        description: A sample request to search for customers.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/customerSearchRequest'
        required: true
      responses:
        '200':
          description: OK
          headers:
            x-fabric-request-id:
              $ref: dae96e30-e72e-4091-be69-ce7f63e78aa2
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/listCustomerResponse'
        '400':
          $ref: '#/components/responses/searchBadRequest'
        '403':
          $ref: '#/components/responses/forbidden'
        '500':
          $ref: '#/components/responses/internalServerError'
components:
  parameters:
    xFabricTenantId:
      name: x-fabric-tenant-id
      in: header
      description: >-
        A header used by fabric to identify the tenant making the request. You
        must include tenant id in the authentication header for an API request
        to access any of fabric’s endpoints. You can retrieve the tenant id ,
        which is also called account id, from
        [Copilot](/v3/platform/settings/account-details/getting-the-account-id).
        This header is required.
      schema:
        type: string
        example: 517fa9dfd42d8b00g1o3k312
    xFabricRequestId:
      name: x-fabric-request-id
      in: header
      description: A UUID of the request.
      schema:
        type: string
      example: 263e731c-45c8-11ed-b878-0242ac120002
      required: false
  schemas:
    customerSearchRequest:
      type: object
      description: The criteria to search for customers.
      required:
        - match
      properties:
        sort:
          type: string
          description: >-
            The criteria to sort results, where `-` indicates a descending order
            and `+` indicates an ascending order. You can sort the following
            fields - `createdAt`, `updatedAt`, `firstName`, `lastName`,
            `status`, and `emailAddress`.
          example: +firstName,-createdAt
        match:
          description: match
          allOf:
            - $ref: '#/components/schemas/customerMatch'
        offset:
          type: number
          description: >-
            The number of records to skip before returning records. For example,
            when offset is 20 and limit's 10, this endpoint returns records from
            21 to 30.
          default: 0
          example: 0
        limit:
          type: number
          description: The maximum number of records in a single page.
          example: 10
          default: 20
    listCustomerResponse:
      description: The list of customers.
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        data:
          type: array
          items:
            $ref: '#/components/schemas/createCustomerResponse'
    customerMatch:
      type: object
      description: The criteria to search for customers.
      properties:
        id:
          $ref: '#/components/schemas/searchId'
        firstName:
          $ref: '#/components/schemas/searchFirstName'
        lastName:
          $ref: '#/components/schemas/searchLastName'
        emailAddress:
          $ref: '#/components/schemas/searchEmailAddress'
        externalId:
          $ref: '#/components/schemas/searchExternalId'
        createdAt:
          $ref: '#/components/schemas/searchCreatedAt'
        updatedAt:
          $ref: '#/components/schemas/searchUpdatedAt'
        deletedAt:
          $ref: '#/components/schemas/searchDeletedAt'
        status:
          $ref: '#/components/schemas/searchStatus'
        additionalAttributes:
          $ref: '#/components/schemas/searchAdditionalAttribute'
        isDeleted:
          $ref: '#/components/schemas/searchIsDeleted'
    Query:
      type: object
      description: The pagination criteria.
      properties:
        offset:
          type: number
          description: >-
            The number of records to skip before returning records. For example,
            when offset is 20 and limit's 10, you get records from 21 to 30.
            When they're not specified, you get up to 10 records.
          example: 0
        limit:
          type: number
          description: The maximum number of records per page.
          example: 20
        count:
          type: number
          description: The total number of records in the response.
          example: 100
    createCustomerResponse:
      required:
        - id
        - isDeleted
        - createdAt
        - updatedAt
        - name
        - emailAddress
      type: object
      properties:
        id:
          type: string
          description: A 24-character system-generated customer ID.
          uniqueItems: true
          example: 61df41892bf06d00092d0d8a
        name:
          $ref: '#/components/schemas/commonName'
        status:
          description: The status of the customer.
          type: string
          enum:
            - ACTIVE
            - INACTIVE
            - BLOCKED
          example: ACTIVE
        emailAddress:
          type: string
          description: The customer's email.
          format: email
          example: test@example.com
        phone:
          $ref: '#/components/schemas/phone'
        externalId:
          type: string
          description: A UUID of the customer.
          example: 1231012312-312-31231asda
        additionalAttributes:
          description: A placeholder for additional info, in key-value pairs.
          type: object
          example:
            middleName: user
        isDeleted:
          type: boolean
          description: >-
            A flag indicating whether the customer data is deleted. `true`
            indicates the customer data is deleted and `false` indicates
            otherwise.
          example: false
        deletedAt:
          description: The time when the customer data was deleted, in UTC format.
          type: string
          format: date-time
          example: '2023-08-30T23:20:42.822Z'
          nullable: true
        createdAt:
          description: The time when the customer was added, in UTC format.
          type: string
          format: date-time
          example: '2023-08-30T23:20:42.822Z'
        updatedAt:
          description: The time when the customer details were last updated, in UTC format.
          type: string
          format: date-time
          example: '2023-08-30T23:20:42.822Z'
          nullable: true
    message:
      description: The response message.
      type: object
      properties:
        type:
          description: A machine-readable code.
          type: string
          example: SUCCESS
        message:
          description: A human-friendly message corresponding to the `type`.
          type: string
          example: Success message
      required:
        - type
        - message
    searchId:
      type: object
      description: A unique identifier of the search criteria.
      properties:
        op:
          type: string
          enum:
            - IN
            - EQUALS
          description: The type of search operation.
          example: IN
        value:
          type: string
          description: A 24-character system-generated ID of the given search criteria.
          example: 61df41892bf06d00092d0d8a
      required:
        - op
        - value
    searchFirstName:
      type: object
      description: The criteria to search for customers based on their first name.
      properties:
        op:
          type: string
          description: >-
            The type of search operation. Multiple values, separated by commas,
            can be used for the IN and NOT_IN operations, while only a single
            value can be used for the EQUALS, CONTAINS, and NOT_EQUALS
            operations.
          enum:
            - IN
            - NOT_IN
            - EQUALS
            - CONTAINS
            - NOT_EQUALS
          example: IN
        value:
          description: The customer's first name.
          type: string
          example: Pat
      required:
        - op
        - value
    searchLastName:
      type: object
      description: The criteria to search for customers based on their last name.
      properties:
        op:
          type: string
          description: >-
            The type of search operation. Multiple values, separated by commas,
            can be used for the IN and NOT_IN operations, while only a single
            value can be used for the EQUALS, CONTAINS, and NOT_EQUALS
            operations.
          enum:
            - IN
            - NOT_IN
            - EQUALS
            - CONTAINS
            - NOT_EQUALS
          example: IN
        value:
          description: The customer's last name.
          type: string
          example: Kake
      required:
        - op
        - value
    searchEmailAddress:
      type: object
      description: The criteria to search for customers based on their email.
      properties:
        op:
          type: string
          description: >-
            The type of search operation. Multiple values, separated by commas,
            can be used for the IN and NOT_IN operations, while only a single
            value can be used for the EQUALS, CONTAINS, and NOT_EQUALS
            operations.
          enum:
            - IN
            - NOT_IN
            - EQUALS
            - CONTAINS
            - NOT_EQUALS
          example: IN
        value:
          type: string
          description: The customer's email address.
          example: pat.kake@example.com
      required:
        - op
        - value
    searchExternalId:
      type: object
      description: The criteria to search for customers based on their `externalId`.
      properties:
        op:
          type: string
          enum:
            - IN
            - EQUALS
          description: The type of search operation.
          example: IN
        value:
          type: string
          description: The value of the `externalId`.
          example: 1231012312-312-31231asda
      required:
        - op
        - value
    searchCreatedAt:
      type: object
      description: >-
        The criteria to search for customers or their addresses based on a
        specific creation date or within a creation date range.
      properties:
        op:
          type: string
          description: >-
            The type of search operation, such as equals, less than (LT),
            greater than (GT), less than or equal to (LTE), greater than or
            equal to (GTE), or within a specified range.
          enum:
            - EQUALS
            - LTE
            - GTE
            - GT
            - LT
            - RANGE
          example: LTE
        value:
          type: string
          description: The time of creation, in UTC format.
          example: '2023-08-30T23:20:42.822Z'
        startCreatedAt:
          type: string
          description: >-
            The starting value of the creation date range. This is used with the
            `endCreatedAt` property.
          example: '2023-08-30T23:20:42.822Z'
        endCreatedAt:
          type: string
          description: >-
            The ending value of the creation date range. This is used with the
            `startCreatedAt` property.
          example: '2023-08-31T23:20:42.822Z'
      example:
        op: LTE
        value: '2023-08-30T23:20:42.822Z'
      required:
        - op
    searchUpdatedAt:
      type: object
      description: >-
        The criteria to search for customers or their addresses based on a
        specific date or date range in which the record was updated.
      properties:
        op:
          type: string
          description: >-
            The type of search operation, such as equals, less than (LT),
            greater than (GT), less than or equal to (LTE), greater than or
            equal to (GTE), or within a specified range.
          enum:
            - EQUALS
            - LTE
            - GTE
            - GT
            - LT
            - RANGE
          example: LTE
        value:
          type: string
          description: The time of last update, in UTC format.
          example: '2023-08-30T23:20:42.822Z'
        startUpdatedAt:
          type: string
          description: >-
            The starting value of the `updatedAt` date range. This is used with
            the `endUpdatedAt` property.
          example: '2023-08-30T23:20:42.822Z'
        endUpdatedAt:
          type: string
          description: >-
            The ending value of the `updatedAt` date range. This is used with
            the `startUpdatedAt` property.
          example: '2023-08-31T23:20:42.822Z'
      example:
        op: LTE
        value: '2023-08-30T23:20:42.822Z'
      required:
        - op
    searchDeletedAt:
      type: object
      description: >-
        The criteria to search for customers or their addresses based on a
        specific deletion date or within a deletion date range.
      properties:
        op:
          type: string
          description: >-
            The type of search operation, such as equals, less than (LT),
            greater than (GT), less than or equal to (LTE), greater than or
            equal to (GTE), or within a specified range.
          enum:
            - EQUALS
            - LTE
            - GTE
            - GT
            - LT
            - RANGE
          example: LTE
        value:
          type: string
          description: The time of deletion, in UTC format.
          example: '2023-08-30T23:20:42.822Z'
        startDeletedAt:
          type: string
          description: >-
            The starting value of the `deletedAt` date range. This is used with
            the `endDeletedAt` property.
          example: '2023-08-30T23:20:42.822Z'
        endDeletedAt:
          type: string
          description: >-
            The ending value of the `deletedAt` date range. This is used with
            the `startDeletedAt` property.
          example: '2023-08-31T23:20:42.822Z'
      example:
        op: LTE
        value: '2023-08-30T23:20:42.822Z'
      required:
        - op
    searchStatus:
      type: object
      description: The criteria to search for customers based on their account status.
      properties:
        op:
          type: string
          description: >-
            The type of search operation. Multiple values, separated by commas,
            can be used for the IN and NOT_IN operations, while only a single
            value can be used for the EQUALS, CONTAINS, and NOT_EQUALS
            operations.
          enum:
            - IN
            - NOT_IN
            - EQUALS
            - CONTAINS
            - NOT_EQUALS
          example: IN
        value:
          type: string
          description: The customer's account status.
          enum:
            - ACTIVE
            - INACTIVE
            - BLOCKED
          example: ACTIVE
      required:
        - op
        - value
    searchAdditionalAttribute:
      type: object
      description: >-
        The criteria to search for customers or their addresses based on
        additional attributes.
      properties:
        key:
          type: string
          description: >-
            The key for the additional attribute. This should be the field name
            given in the `additionalAttributes` schema.
          example: gps
      anyOf:
        - $ref: '#/components/schemas/searchStringOperation'
        - $ref: '#/components/schemas/searchNumberOrDateOperation'
      required:
        - key
        - op
    searchIsDeleted:
      type: boolean
      description: >-
        A flag indicating whether the search results should include only deleted
        addresses. Set to `true` to include only deleted addresses and `false`
        to exclude deleted addresses.
      enum:
        - false
        - true
      example: false
    commonName:
      type: object
      description: The full name of the customer.
      required:
        - firstName
        - lastName
      properties:
        title:
          description: The customer's title, such as Mr., Mrs, and Dr.
          type: string
          example: Dr.
        firstName:
          description: The customer's first name.
          type: string
          example: Pat
        middleName:
          description: The customer's middle name.
          type: string
          example: E
        lastName:
          description: The customer's last name.
          type: string
          example: Doe
        suffix:
          description: The suffix for the customer's name, such as Jr., PhD, and more.
          type: string
          example: Jr.
    phone:
      type: object
      properties:
        number:
          type: string
          description: The customer's phone number.
          example: 15555551234
        type:
          type: string
          description: The type of phone number.
          example: MOBILE
          nullable: true
          enum:
            - MOBILE
            - HOME
            - BUSINESS
    searchStringOperation:
      type: object
      description: The criteria to search by a string value.
      properties:
        op:
          type: string
          description: >-
            The type of search operation. Multiple values, separated by commas,
            can be used for the IN and NOT_IN operations, while only a single
            value can be used for the EQUALS, CONTAINS, and NOT_EQUALS
            operations.
          enum:
            - IN
            - NOT_IN
            - EQUALS
            - CONTAINS
            - NOT_EQUALS
          example: IN
        value:
          type: string
          description: The value of the string.
          example: beach
    searchNumberOrDateOperation:
      type: object
      description: >-
        The criteria to search for records by number, date, range of numbers, or
        range of dates.
      properties:
        op:
          type: string
          description: >-
            The type of search operation, such as equals, less than (LT),
            greater than (GT), less than or equal to (LTE), greater than or
            equal to (GTE), or within a specified range.
          enum:
            - EQUALS
            - LTE
            - GTE
            - GT
            - LT
            - RANGE
          example: LTE
        value:
          type: string
          description: The value of the number or the date.
          example: '2023-08-30T23:20:42.822Z'
        fromValue:
          type: string
          description: >-
            The starting value of the number or date range. This is used with
            the `toValue` property.
          example: '2023-08-30T23:20:42.822Z'
        toValue:
          type: string
          description: >-
            The ending value of the number or date range. This is used with the
            `fromValue` property.
          example: '2023-08-31T23:20:42.822Z'
      example:
        op: LTE
        value: '2023-08-30T23:20:42.822Z'
  responses:
    searchBadRequest:
      description: Bad request
      headers:
        x-fabric-request-id:
          $ref: dae96e30-e72e-4091-be69-ce7f63e78aa2
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/message'
          examples:
            invalidAccountProvided:
              value:
                type: INVALID_ACCOUNT_PROVIDED
                message: Invalid account provided for the request.
            invalidSearchOperation:
              value:
                type: INVALID_SEARCH_OPERATION
    forbidden:
      description: Forbidden Request
      headers:
        x-fabric-request-id:
          description: Unique request ID
          schema:
            type: string
            example: 263e731c-45c8-11ed-b878-0242ac120002
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/message'
          example:
            type: REQUEST_DENIED
            message: Forbidden
    internalServerError:
      description: The request is received but an internal error occurred
      headers:
        x-fabric-request-id:
          $ref: dae96e30-e72e-4091-be69-ce7f63e78aa2
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/message'
          example:
            type: INTERNAL_SERVER_ERROR
            message: Internal server error
  securitySchemes:
    bearerAuth:
      description: The access token.
      type: http
      scheme: bearer
      bearerFormat: JWT

````