# Search for a program membership

## Search for a Program Memberships

To search for existing program membership, you can make a **`GET`** request to the [`/v2/program-memberships/search`](https://docs.hang.com/hang-platform/api-usage/broken-reference) endpoint.

### Request Parameters

* `external_user_id` (required): The user id you use to identify a user outside of hangs system (email, shopify/square/toast id etc).

#### Example Request

```bash
curl -X GET 'https://loyalty.hang.xyz/partner-api/v2/program-memberships/search' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "external_user_id": "12345"
  }'

```

### Response

If successful, the API will return a 200 OK status along with the details of the updated program membership.

#### Example Response

```json
{
  "membership": {
    "id": "membership_id_1",
    "external_user_id": "user123",
    "created_at": 1633887337,
    "magic_link": "authenticated_url",
    "social_media_credentials": {
      "twitter_username": "user_twitter",
      "instagram_username": "user_instagram",
      "tiktok_username": "user_tiktok"
    },
    "family_member_birthdays": [
      {
        "first_name": "Anna",
        "last_name": "",
        "birth_date": "2000-02-02",
        "status": "active"
      },
      {
        "first_name": "Mason",
        "last_name": "Smith",
        "birth_date": "2002-01-01",
        "status": "active"
      }
    ]
  }
}
```

### Error Handling

If the API encounters an error, a relevant error message will be returned to guide you through the troubleshooting process. For example, if there is no program membership with the provided external user id, the API will return an error message describing the problem.
