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

> Endpoint used to create customer

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

<ResponseExample>
  ```json Response Example 200 theme={null}
  {
      "statusCode": 200,
      "messages": "success",
      "data": {
          "name": "Budi Santoso",
          "email": "budi.santoso@example.com",
          "mobile": "081234567890",
          "userId": "348e083d-315a-4e5c-96b1-5a2a98c48413",
          "customerId": "a1b2c3d4-e5f6-4789-a012-3456789abcde"
      }
  }
  ```
</ResponseExample>

Endpoint:

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

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

## Authorization

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

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

## Request Body

<ParamField path="name" type="string" required>
  Customer Name.
</ParamField>

<ParamField path="email" type="string" required>
  Customer email.
</ParamField>

<ParamField path="mobile" type="string" required>
  Customer telephone number.
</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 created customer data (echoes the submitted body and appends `customerId`).
</ResponseField>

### data Structure (Object)

<ResponseField name="name" type="string">
  Customer name.
</ResponseField>

<ResponseField name="email" type="string">
  Customer email address.
</ResponseField>

<ResponseField name="mobile" type="string">
  Customer phone number.
</ResponseField>

<ResponseField name="userId" type="string<uuid>">
  Unique ID for the user (the account owner).
</ResponseField>

<ResponseField name="customerId" type="string<uuid>">
  Unique ID for the customer associated with the user.
</ResponseField>

## Errors

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