# Retrieving Created or Updated Program Memberships

### Request Parameters

* `filter`- a Hash consisting of
  * `created`- a Hash consisting of
    * `start`- Epoch timestamp (must be before end)
    * `end`- Epoch timestamp
  * `updated`- a Hash consisting of
    * `start`- Epoch timestamp (must be before end)
    * `end`-Epoch timestamp
* `page_size`- the number of records to return at a time (max 1000)
* `page`- the current page

### Response Structure

* `memberships`- an array of `Members` (outlined below)
  * `id`- the Id of the program membership
  * `phone`- phone number
  * `external_user_id`- external id
  * `magic_link`- a magic link to authorize the user, if available
  * `created_at`- when the record was created, as an Epoch timestamp
  * `updated_at`- when the record was last updated, as an Epoch timestamp
* `total_records`- the total number of records present

### Sample Request

```bash
curl -X POST 'https://loyalty.hang.xyz/partner-api/v2/program-memberships/bulk-search' \
-H 'X-API-KEY: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{ 
  "filter": {
    "created": {
      "start": 1735862400,
      "end": 1735948800
    }
  },
  "page_size": 100,
  "page": 2
}'

```

### Sample Response

```json
{
    "memberships":
    [
        {
            "id":"some_guid",
            "phone":"+15555551234",
            "external_user_id":"some_id",
            "magic_link":"https://domain.hang.xyz/direct-auth?auth_code=111111\u0026verification_token=<some_guid>",
            "created_at":1736106812,
            "updated_at":1736366012}
        }
    ],
    "total_records":158
}
```
