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

# New User

> User Creation If Not Exist 

## Endpoint Overview

**POST** `https://api.unibee.dev/merchant/user/new`

User Creation If Not Exist

***

## Authorization

All UniBee Merchant API requests require authentication via API key.

| Header          | Required | Description                           |
| --------------- | -------- | ------------------------------------- |
| `Authorization` | Yes      | Bearer `<your_api_key>`               |
| `Content-Type`  | Yes      | `application/json` (for request body) |

***

## Parameters

Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.

### Request body

| Name             | Type   | Required | Description    |
| ---------------- | ------ | -------- | -------------- |
| `address`        | string | No       | Address        |
| `email`          | string | Yes      | Email          |
| `externalUserId` | string | No       | ExternalUserId |
| `firstName`      | string | No       | First Name     |
| `language`       | string | No       | Language       |
| `lastName`       | string | No       | Last Name      |
| `password`       | string | No       | Password       |
| `phone`          | string | No       | Phone          |

***

## Request examples

### cURL

```bash theme={null}
curl -X POST "https://api.unibee.dev/merchant/user/new" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "address": "",
  "email": "user@example.com",
  "externalUserId": "id_example",
  "firstName": "",
  "language": "",
  "lastName": "",
  "password": "",
  "phone": ""
}'
```

### Sandbox

```bash theme={null}
curl -X POST "https://api-sandbox.unibee.top/merchant/user/new" \
  -H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "address": "",
  "email": "user@example.com",
  "externalUserId": "id_example",
  "firstName": "",
  "language": "",
  "lastName": "",
  "password": "",
  "phone": ""
}'
```

***

## Response

Success responses return a JSON envelope with `code`, `data`, `message`, `redirect`, and `requestId`. `code` `0` indicates success.

| Field       | Type    | Description                  |
| ----------- | ------- | ---------------------------- |
| `code`      | integer | Response code. `0` = success |
| `data`      | object  | Response payload             |
| `data.user` | object  |                              |
| `message`   | string  | Human-readable message       |
| `requestId` | string  | Request ID for support       |

***

## Error handling

| HTTP status | Meaning                                                                   |
| ----------- | ------------------------------------------------------------------------- |
| 400         | Bad request — invalid or missing parameters. Check `message` in the body. |
| 401         | Unauthorized — missing or invalid API key.                                |
| 404         | Not found — invalid path or resource.                                     |
| 500         | Server error — retry with backoff.                                        |

When `code` in the response body is non-zero, check `message` for details. Use `requestId` when contacting support.


## OpenAPI

````yaml post /merchant/user/new
openapi: 3.0.0
info:
  description: UniBee Api Server
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: OpenAPI UniBee
  version: daily,buildtime:202603161017
servers:
  - url: https://api.unibee.dev
  - url: https://api-sandbox.unibee.top
security:
  - Authorization: []
paths:
  /merchant/user/new:
    post:
      tags:
        - User
      summary: New User
      description: 'User Creation If Not Exist '
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/unibee.api.merchant.user.NewReq'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    format: int
                    properties: {}
                    type: integer
                  data:
                    properties:
                      user:
                        $ref: '#/components/schemas/unibee.api.bean.UserAccount'
                    type: object
                  merchantId:
                    format: int64
                    properties: {}
                    type: integer
                  message:
                    format: string
                    properties: {}
                    type: string
                  redirect:
                    format: string
                    properties: {}
                    type: string
                  requestId:
                    format: string
                    properties: {}
                    type: string
                type: object
          description: ''
components:
  schemas:
    unibee.api.merchant.user.NewReq:
      description: 'User Creation If Not Exist '
      properties:
        address:
          description: Address
          format: string
          properties: {}
          type: string
        email:
          description: Email
          format: string
          properties: {}
          type: string
        externalUserId:
          description: ExternalUserId
          format: string
          properties: {}
          type: string
        firstName:
          description: First Name
          format: string
          properties: {}
          type: string
        language:
          description: Language
          format: string
          properties: {}
          type: string
        lastName:
          description: Last Name
          format: string
          properties: {}
          type: string
        password:
          description: Password
          format: string
          properties: {}
          type: string
        phone:
          description: Phone
          format: string
          properties: {}
          type: string
      required:
        - email
      type: object
    unibee.api.bean.UserAccount:
      properties:
        address:
          description: address
          format: string
          properties: {}
          type: string
        avatarUrl:
          description: avator url
          format: string
          properties: {}
          type: string
        billingType:
          description: 1-recurring,2-one-time
          format: int
          properties: {}
          type: integer
        birthday:
          description: brithday
          format: string
          properties: {}
          type: string
        city:
          description: city
          format: string
          properties: {}
          type: string
        companyName:
          description: company name
          format: string
          properties: {}
          type: string
        countryCode:
          description: country_code
          format: string
          properties: {}
          type: string
        countryName:
          description: country_name
          format: string
          properties: {}
          type: string
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        custom:
          description: Custom
          format: string
          properties: {}
          type: string
        email:
          description: email
          format: string
          properties: {}
          type: string
        externalUserId:
          description: external_user_id
          format: string
          properties: {}
          type: string
        facebook:
          description: facebook
          format: string
          properties: {}
          type: string
        firstName:
          description: first name
          format: string
          properties: {}
          type: string
        gatewayId:
          description: gateway_id
          format: int64
          properties: {}
          type: integer
        gatewayPaymentType:
          format: string
          properties: {}
          type: string
        gender:
          description: gender
          format: string
          properties: {}
          type: string
        id:
          description: userId
          format: int64
          properties: {}
          type: integer
        isRisk:
          description: is risk account (deperated)
          format: int
          properties: {}
          type: integer
        isSpecial:
          description: is special account（0.no，1.yes）- deperated
          format: int
          properties: {}
          type: integer
        language:
          description: User Language, en|ru|cn|vi|bp
          format: string
          properties: {}
          type: string
        lastLoginAt:
          description: last login time, utc time
          format: int64
          properties: {}
          type: integer
        lastName:
          description: last name
          format: string
          properties: {}
          type: string
        linkedIn:
          description: linkedin
          format: string
          properties: {}
          type: string
        merchantId:
          description: merchant_id
          format: int64
          properties: {}
          type: integer
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          format: map[string]interface {}
          properties: {}
          type: object
        mobile:
          description: mobile
          format: string
          properties: {}
          type: string
        otherSocialInfo:
          format: string
          properties: {}
          type: string
        paymentMethod:
          format: string
          properties: {}
          type: string
        phone:
          description: phone
          format: string
          properties: {}
          type: string
        recurringAmount:
          description: total recurring amount, cent
          format: int64
          properties: {}
          type: integer
        registrationNumber:
          description: RegistrationNumber
          format: string
          properties: {}
          type: string
        school:
          description: school
          format: string
          properties: {}
          type: string
        state:
          description: State
          format: string
          properties: {}
          type: string
        status:
          description: 0-Active, 2-Suspend
          format: int
          properties: {}
          type: integer
        subscriptionId:
          description: subscription id
          format: string
          properties: {}
          type: string
        subscriptionName:
          description: subscription name
          format: string
          properties: {}
          type: string
        subscriptionStatus:
          description: >-
            sub status， 1-Pending｜2-Active｜3-PendingInActive | 4-Cancel |
            5-Expire | 6- Suspend| 7-Incomplete | 8-Processing | 9-Failed
          format: int
          properties: {}
          type: integer
        taxPercentage:
          description: taxPercentage，1000 = 10%
          format: int64
          properties: {}
          type: integer
        telegram:
          description: telegram
          format: string
          properties: {}
          type: string
        tikTok:
          description: tictok
          format: string
          properties: {}
          type: string
        timeZone:
          format: string
          properties: {}
          type: string
        type:
          description: User type, 1-Individual|2-Business
          format: int64
          properties: {}
          type: integer
        userName:
          description: user name
          format: string
          properties: {}
          type: string
        vATNumber:
          description: vat number
          format: string
          properties: {}
          type: string
        version:
          description: version
          format: int
          properties: {}
          type: integer
        weChat:
          description: wechat
          format: string
          properties: {}
          type: string
        whatsAPP:
          description: whats app
          format: string
          properties: {}
          type: string
        zipCode:
          description: zip_code
          format: string
          properties: {}
          type: string
      type: object
    interface:
      properties: {}
      type: object
  securitySchemes:
    Authorization:
      bearerFormat: JWT
      scheme: bearer
      type: http

````