Customers

Customer Segments

A CustomerSegment is a named group of customers within a site that can be targeted for marketing campaigns. Segments may have optional filters based on labels or memberships to drive automatic membership.

The CustomerSegment object

Attributes

  • iduuidrequired

    The unique identifier of the customer segment.

  • namestringrequired

    The display name of the segment.

  • site_iduuidrequired

    The ID of the site this segment belongs to.

  • filtersobjectrequirednullable

    Optional filters that define automatic membership criteria for this segment. null indicates no filters are applied.

{
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "Premium Members",
  "site_id": "00000000-0000-0000-0000-000000000000",
  "filters": {
    "all_customers": false,
    "label_ids": [
      "00000000-0000-0000-0000-000000000000"
    ],
    "membership_type_ids": [
      "00000000-0000-0000-0000-000000000000"
    ]
  }
}
get/shop/customers/customer-segments

List CustomerSegments

listCustomerSegments

Returns a paginated list of CustomerSegments for the given site.

Query parameters

  • site_iduuidrequired

    Filters segments that belong to the given site ID.

  • querystringoptional

    Filters segments whose name contains the given value.

  • pageintegeroptional

    The page to retrieve results from

  • per_pageintegeroptional

    The number of results to return per page

Responses

  • 200

    The customer segments were successfully retrieved.

  • 401

    The user is unauthenticated

post/shop/customers/customer-segments

Create CustomerSegment

createCustomerSegment

Creates a new CustomerSegment for the given site.

Request body

  • namestringrequired

    The display name of the segment.

  • site_iduuidrequired

    The ID of the site this segment belongs to.

  • filtersobjectoptionalnullable

    Optional filters that define automatic membership criteria for the segment.

Responses

  • 201

    The customer segment was successfully retrieved.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 422

    The request didn't pass validation

get/shop/customers/customer-segments/{customerSegmentId}

Get CustomerSegment

getCustomerSegment

Returns the CustomerSegment with the given ID.

Path parameters

Responses

  • 200

    The customer segment was successfully retrieved.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

put/shop/customers/customer-segments/{customerSegmentId}

Update CustomerSegment

updateCustomerSegment

Updates the given CustomerSegment.

Path parameters

Request body

  • namestringoptional

    The display name of the segment.

  • filtersobjectoptionalnullable

    Filters that define automatic membership criteria for the segment.

Responses

  • 200

    The customer segment was successfully retrieved.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

  • 422

    The request didn't pass validation

delete/shop/customers/customer-segments/{customerSegmentId}

Delete CustomerSegment

deleteCustomerSegment

Soft-deletes the given CustomerSegment. Existing segment members are unaffected, but the segment can no longer be used for campaigns. Use the companion restoreCustomerSegment endpoint to undo.

Path parameters

Responses

  • 204

    The CustomerSegment was successfully soft-deleted.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found

post/shop/customers/customer-segments/{customerSegmentId}/restore

Restore CustomerSegment

restoreCustomerSegment

Restores a soft-deleted CustomerSegment so it can once again be used for campaigns. Partner to deleteCustomerSegment.

Path parameters

Responses

  • 200

    The customer segment was successfully retrieved.

  • 401

    The user is unauthenticated

  • 403

    The authenticated user does not have permission.

  • 404

    The resource couldn't be found