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

# Create User

> Creates a user in an App that requires authentication. Each user will have a default wallet created for the wallet_type sent in.
## Returns

A successful response returns a `User` object with `email_id` and `phone_number_id` properties.



## OpenAPI

````yaml post /v1/auth/users/create
openapi: 3.1.0
info:
  title: MoonKey Auth API
  description: >-
    Explore all the details of MoonKey Auth API. All of our APIs are RESTful and
    accept and return JSON.
  version: v1
servers:
  - url: https://api.moonkey.fun
    description: Production
    variables: {}
security:
  - Authorization: []
tags:
  - name: Users
    description: User management API
  - name: Magic Links
    description: ''
  - name: OTPs
    description: >-
      Send OTP (One-time passcodes) by all the supported delivery methods such
      as SMS, email.
  - name: OAuth
    description: ''
  - name: Wallets Login
    description: ''
  - name: Managed Wallets
    description: ''
  - name: Wallet Import
    description: >-
      Import existing wallets into the platform using secure HPKE encryption.
      This flow ensures raw entropy (seed phrases or private keys) never touches
      the server in plaintext.
externalDocs:
  url: ''
  description: ''
paths:
  /v1/auth/users/create:
    post:
      tags:
        - Users
      summary: Create User
      description: >-
        Creates a user in an App that requires authentication. Each user will
        have a default wallet created for the wallet_type sent in.

        ## Returns


        A successful response returns a `User` object with `email_id` and
        `phone_number_id` properties.
      operationId: CreateUser
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserRequest'
            examples:
              CreateUserReq:
                value:
                  first_name: John
                  last_name: Smith
                  email: sandbox@moonkey.fun
                  phone_number: '+14152222222'
                  requires_verification: true
      responses:
        '200':
          description: Create User response
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  user_id:
                    type: string
                    minLength: 1
                  status:
                    type: string
                  email_id:
                    type: string
                    minLength: 1
                  phone_number_id:
                    type: string
                    minLength: 1
                  user:
                    $ref: '#/components/schemas/User'
                required:
                  - user_id
                  - status
                  - email_id
                  - phone_number_id
              examples:
                CreateUserResp:
                  value:
                    user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
                    status: pending
                    email_id: email_24oXBL3PufzHkH1Jzyjc2EXYeo7
                    phone_number_id: pn_24oXBLRv6BoHXbNZoTAZkAFlRsy
components:
  schemas:
    CreateUserRequest:
      description: ''
      type: object
      properties:
        email:
          type: string
          minLength: 1
          description: >-
            `Required if phone_number not present` Email that uniquely
            identifies the user.
        phone_number:
          type: string
          minLength: 1
          description: >-
            `Required if email not present` E.164 formatted mobile phone number
            that uniquely identifies the user.
        first_name:
          type: string
          minLength: 1
          description: First name of the user.
        middle_name:
          type: string
          description: Middle name of the user.
        last_name:
          type: string
          description: Middle name of the user.
          minLength: 0
        requires_verification:
          type: boolean
          description: >-
            Determines if verification for the authentication method (email,
            phone_number) is required before marking the user as active.
        wallet_type:
          type: string
          description: >-
            Determines what type of wallet login. If the user does not have a
            default wallet of the same wallet_type, a new default wallet will be
            created for the user. If left blank, the default will be ethereum.
            Possible values: ethereum, solana, bitcoin, DOT, XLM (more wallets
            coming soon).
        include_user:
          type: boolean
          description: >-
            Determines if the full user object should be returned. Defaults to
            false.
        metadata:
          $ref: '#/components/schemas/Metadata'
    User:
      description: ''
      type: object
      x-examples:
        User:
          user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
          first_name: John
          middle_name: ''
          last_name: Smith
          active: true
          updated_at: 1639873806
          created_at: 1639873806
          emails:
            - id: email_24oXBL3PufzHkH1Jzyjc2EXYeo7
              verified: false
              email: sandbox@moonkey.fun
              updated_at: 1639873806
              created_at: 1639873806
          phone_numbers:
            - id: pn_24oXBLRv6BoHXbNZoTAZkAFlRsy
              verified: true
              phone_number: '+14152222222'
              updated_at: 1643004687
              created_at: 1639873806
          wallets:
            - id: wallet_24tdfcVDSJQpK5huDnZaqPP2aiI
              public_address: '0xd3EfC42956c546Cf27B5f18062c63B4BF6d72D7c'
              wallet_type: ethereum
              is_default: true
              updated_at: 1640133104
              created_at: 1640133104
          idp_providers:
            - id: idpuser_28SRho5nbD045LGq2btZWXhkdjN
              provider: google
              provider_subject: '100157402424066154830'
              idp_type: oauth
              method_id: email_26AjWpEcss2YyqFh1san6Wjjs7o
              method_type: email
              updated_at: 1651208121
              created_at: 1651208121
          totps:
            - id: totp_284EPXPYI5zZoh4pp2mpAQ2PnuY
              verified: false
              updated_at: 1650467433
              created_at: 1650467433
          webauthn_credentials: []
          metadata:
            custom_field: custom_value
            user_tier: premium
      title: User
      properties:
        user_id:
          type: string
          minLength: 1
        first_name:
          type: string
          minLength: 0
        middle_name:
          type: string
        last_name:
          type: string
          minLength: 0
        active:
          type: boolean
        updated_at:
          type: number
        created_at:
          type: number
        emails:
          type: array
          uniqueItems: true
          minItems: 0
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              verified:
                type: boolean
              email:
                type: string
                minLength: 1
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - verified
              - email
              - updated_at
              - created_at
        phone_numbers:
          type: array
          uniqueItems: true
          minItems: 10
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              verified:
                type: boolean
              phone_number:
                type: string
                minLength: 1
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - verified
              - phone_number
              - updated_at
              - created_at
        wallets:
          type: array
          uniqueItems: true
          minItems: 0
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              app_id:
                type: string
                minLength: 1
              user_id:
                type: string
                minLength: 1
              public_address:
                type: string
                minLength: 1
              wallet_type:
                type: string
                minLength: 1
              is_default:
                type: boolean
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - app_id
              - user_id
              - public_address
              - wallet_type
              - is_default
              - updated_at
              - created_at
        idp_providers:
          type: array
          uniqueItems: true
          minItems: 10
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              provider:
                type: string
                minLength: 1
              provider_subject:
                type: string
                minLength: 1
              idp_type:
                type: string
                minLength: 1
              method_id:
                type: string
                minLength: 1
              method_type:
                type: string
                minLength: 1
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - provider
              - provider_subject
              - idp_type
              - method_id
              - method_type
              - updated_at
              - created_at
        totps:
          type: array
          uniqueItems: true
          minItems: 0
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              verified:
                type: boolean
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - verified
              - updated_at
              - created_at
        metadata:
          $ref: '#/components/schemas/Metadata'
      required:
        - user_id
        - first_name
        - middle_name
        - last_name
        - active
        - updated_at
        - created_at
        - emails
        - phone_numbers
        - wallets
    Metadata:
      type: object
      additionalProperties: true
      description: >
        A flexible JSON object for storing custom data about a user. 

        You can store any arbitrary data as key-value pairs.


        **Update Behavior:**

        - By default, metadata updates are merged at the top level only

        - Send `null` values for specific fields to delete those fields (merge
        mode only)

        - Send `{}` (empty object) to clear all metadata

        - Send `null` for the metadata field itself will be ignored (as if
        metadata was not sent)

        - Deeply nested objects and arrays are NOT merged - they replace the
        entire top-level key

        - Set `replace_metadata: true` to replace all metadata without merging
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: >-
        Auth Platform API includes all the Auth related features. All Users,
        Phone Numbers, Emails, and OTPs are associated with an `App` as the
        container.


        Endpoints only accept App's `Secret API keys` other than certain
        endpoints that are used client side or via SDK that accept the
        `public_token`.


        ## Authentication using App Api Key


        ## Header:


        ```

        Authorization: Bearer {api_key}

        ```


        ## Authenticated Request


        ```curl

        curl \
          -X GET https://api.moonkey.fun/v1/auth/users/user_24wFP9pDa9YiMJLun94iKykoZs2 \
          -H "Authorization: Bearer sk_test_pRqweh3wvWmJAAVYv7Z0T5iPLzFM4ql0muoyQcjOxGeN3p1r"
        ```

````