> ## 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 Customer Email

> Endpoint is used to update customer email.

<RequestExample>
  ```bash Request Example theme={null}
  curl --request POST 'https://api.mayar.id/hl/v2/customers/update' \
  --header 'Authorization: Bearer Paste-Your-API-Key-Here' \
  --data-raw '{
      "fromEmail": "budi.santoso@example.com",
      "toEmail": "budi.santoso.new@example.com"
  }
  '
  ```
</RequestExample>

<ResponseExample>
  ```json Response Example 200 theme={null}
  {
      "statusCode": 200,
      "messages": "success"
  }
  ```
</ResponseExample>

Endpoint:

<CodeGroup>
  ```Production Production theme={null}
  https://api.mayar.id/hl/v2/customers/update
  ```

  ```Sandbox Sandbox theme={null}
  https://api.mayar.club/hl/v2/customers/update
  ```
</CodeGroup>

## Authorization

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

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

## Request Body

<ParamField path="fromEmail" type="string" required>
  The email of the customer to be updated from.
</ParamField>

<ParamField path="toEmail" type="string" required>
  The new email of the customer.
</ParamField>

## Response

Successful Response

### Main Structure (Root)

<ResponseField name="statusCode" type="integer">
  Status code form API.
</ResponseField>

<ResponseField name="messages" type="string">
  Status message that describes the status code.
</ResponseField>

## Errors

<ResponseField name="400 Validation Error" type="object">
  Returned with `messages: "Validation Error"` when the request body fails
  validation (e.g. missing `fromEmail` or `toEmail`).
</ResponseField>

<ResponseField name="404 Customer Not Found" type="object">
  Returned with `messages: "Email {fromEmail} tidak terdaftar sebagai customer"`
  when no customer matches `fromEmail`.
</ResponseField>
