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

# Update Membership Member

> Endpoint to update an existing membership member.

<RequestExample>
  ```bash Request Example theme={null}
  curl --request POST 'https://api.mayar.id/hl/v2/memberships/members/MBR8X2QK/update' \
  --header 'Authorization: Bearer Paste-Your-API-Key-Here' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "productId": "7c9d2e1f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
      "membershipTierId": "9b2d4f6a-8c1e-4a3b-bd5c-6e7f8a9b0c1d",
      "membershipMonthlyPeriod": 1,
      "status": "active",
      "nextPayment": "2026-08-20T09:10:57.994Z",
      "expiredAt": "2026-09-20T09:10:57.994Z"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response Example 200 theme={null}
  {
      "statusCode": 200,
      "message": "success",
      "data": {
          "membershipCustomer": {
              "id": "c4d5e6f7-a8b9-4c0d-8e1f-2a3b4c5d6e7f",
              "memberId": "MBR8X2QK",
              "userId": "348e083d-315a-4e5c-96b1-5a2a98c48413",
              "customerId": "a1b2c3d4-e5f6-4789-a012-3456789abcde",
              "membershipTierId": "9b2d4f6a-8c1e-4a3b-bd5c-6e7f8a9b0c1d",
              "paymentLinkId": "7c9d2e1f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
              "monthlyPaymentPeriod": 1,
              "status": "active",
              "nextPayment": "2026-08-20T09:10:57.994Z",
              "expiredAt": "2026-09-20T09:10:57.994Z",
              "createdAt": "2026-06-20T09:10:57.994Z",
              "updatedAt": "2026-06-23T10:30:00.000Z"
          }
      }
  }
  ```
</ResponseExample>

Endpoint:

<CodeGroup>
  ```Production Production theme={null}
  https://api.mayar.id/hl/v2/memberships/members/(memberId)/update
  ```

  ```Sandbox Sandbox theme={null}
  https://api.mayar.club/hl/v2/memberships/members/(memberId)/update
  ```
</CodeGroup>

## Authorization

<ResponseField name="Authorization" type="string" required>
  Example:

  `Authorization | Bearer Paste-Your-API-Key-Here`
</ResponseField>

## Path Parameters

<ParamField path="memberId" type="string" required>
  The public membership code of the member to update.

  Example:

  `MBR8X2QK`
</ParamField>

## Request Body

`productId` is the only required field. The remaining fields are optional — send
only the ones you want to change.

<ParamField body="productId" type="string" required>
  The unique identifier of the product the member belongs to. The product must
  belong to the authenticated user.

  Example:

  `7c9d2e1f-4a5b-4c6d-8e9f-0a1b2c3d4e5f`
</ParamField>

<ParamField body="membershipTierId" type="string">
  The unique identifier of the membership tier to move the member to.
</ParamField>

<ParamField body="membershipMonthlyPeriod" type="integer">
  The monthly billing period for the membership.
</ParamField>

<ParamField body="status" type="string">
  The new status for the member (for example `active`, `stopped`, `inactive`,
  `finished`).
</ParamField>

<ParamField body="nextPayment" type="string">
  The member's next scheduled payment, as a **UTC ISO 8601 string** (for example
  `2026-08-20T09:10:57.994Z`) — not an epoch-millisecond value.
</ParamField>

<ParamField body="expiredAt" type="string">
  The membership expiry time, as a **UTC ISO 8601 string** (for example
  `2026-09-20T09:10:57.994Z`).
</ParamField>

## Response

Successful Response — HTTP `200`

### Main Structure (Root Object)

<ResponseField name="statusCode" type="integer">
  Status code from the API. `200` on success.
</ResponseField>

<ResponseField name="message" type="string">
  Status message that describes the status code. Note the **singular** `message` key
  (write endpoints use `message`; read/list endpoints use the plural `messages`).
</ResponseField>

<ResponseField name="data" type="object">
  The update result wrapper.
</ResponseField>

<ResponseField name="data.membershipCustomer" type="object">
  The updated membership customer record.
</ResponseField>

## Errors

All errors use the envelope `{ "statusCode": <code>, "message": "<reason>" }` (singular `message`).

```json Error Example 400 theme={null}
{
    "statusCode": 400,
    "message": "Invalid request body"
}
```

<ResponseField name="statusCode" type="integer">
  The HTTP status code of the error.
</ResponseField>

<ResponseField name="message" type="string">
  A human-readable description of the error.
</ResponseField>

Common errors:

| Status | `message`                                      | When                                                             |
| ------ | ---------------------------------------------- | ---------------------------------------------------------------- |
| `400`  | `Invalid path parameter`                       | `memberId` is missing or malformed in the path.                  |
| `400`  | `Invalid request body`                         | The request body is missing required fields or fails validation. |
| `400`  | `You are not authorized to edit this product!` | The `productId` does not belong to the authenticated user.       |
