> ## 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.

# Create Magic Link

> Endpoint to create magic link and send to customer email for their login in our customer portal

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

<ResponseExample>
  ```json Response Example 200 theme={null}
  {
      "statusCode": 200,
      "messages": "success",
      "data": {
          "url": "Sudah kami kirim ke email anda"
      }
  }
  ```
</ResponseExample>

Endpoint:

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

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

## Authorization

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

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

## Request Body

<ParamField path="email" type="string" required>
  Customer email. The magic link is sent to this address.
</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>

<ResponseField name="data" type="object">
  The magic-link request result.
</ResponseField>

### data Structure (Object)

<ResponseField name="url" type="string">
  Information about the magic link request that was made.
</ResponseField>

## Errors

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

<ResponseField name="404 Email Not Registered" type="object">
  Returned with `messages: "Email tidak terdaftar"` when no customer matches the
  email.
</ResponseField>
