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

# Import Wallet

> Completes the wallet import process by submitting the HPKE-encrypted wallet entropy.

This endpoint receives the encrypted entropy (either HD seed or private key) that was encrypted using the public key obtained from the `/v1/wallets/import/begin` endpoint.
## Security Model

- The wallet entropy is encrypted client-side using HPKE with the server's public key.
- The ciphertext and encapsulated key are submitted to this endpoint.
- Raw entropy never touches the server in plaintext.
- If an existing wallet of the given wallet type has been created for that user, it will be returned.

## Returns

A successful response returns a `Wallet` object with `is_imported` set to `true`.



## OpenAPI

````yaml post /v1/wallets/import
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/wallets/import:
    parameters: []
    post:
      tags:
        - Wallet Import
      summary: Import Wallet
      description: >-
        Completes the wallet import process by submitting the HPKE-encrypted
        wallet entropy.


        This endpoint receives the encrypted entropy (either HD seed or private
        key) that was encrypted using the public key obtained from the
        `/v1/wallets/import/begin` endpoint.

        ## Security Model


        - The wallet entropy is encrypted client-side using HPKE with the
        server's public key.

        - The ciphertext and encapsulated key are submitted to this endpoint.

        - Raw entropy never touches the server in plaintext.

        - If an existing wallet of the given wallet type has been created for
        that user, it will be returned.


        ## Returns


        A successful response returns a `Wallet` object with `is_imported` set
        to `true`.
      operationId: ImportWallet
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user_id:
                  type: string
                  minLength: 1
                  description: >-
                    `Required` Unique User ID of the user to import the wallet
                    for.
                wallet:
                  type: object
                  description: '`Required` Wallet import data containing encrypted entropy.'
                  properties:
                    public_address:
                      type: string
                      minLength: 1
                      description: '`Required` Public address of the wallet being imported.'
                    wallet_type:
                      type: string
                      enum:
                        - solana
                        - ethereum
                      description: '`Required` Blockchain type.'
                    encryption_type:
                      type: string
                      enum:
                        - HPKE
                      description: '`Required` Must be `HPKE`.'
                    entropy_type:
                      type: string
                      enum:
                        - hd
                        - private_key
                      description: >-
                        `Required` One of: `hd` (HD-derived entropy) or
                        `private_key` (raw private key).
                    ciphertext:
                      type: string
                      minLength: 1
                      description: >-
                        `Required` Base64-encoded HPKE ciphertext containing the
                        encrypted entropy.
                    encapsulated_key:
                      type: string
                      minLength: 1
                      description: '`Required` Base64-encoded HPKE encapsulated key.'
                    account_index:
                      type: integer
                      minimum: 0
                      description: >-
                        `Required only when entropy_type = "hd"` Account
                        derivation index. Must be >= 0.
                  required:
                    - public_address
                    - wallet_type
                    - encryption_type
                    - entropy_type
                    - ciphertext
                    - encapsulated_key
              required:
                - user_id
                - wallet
            examples:
              ImportWalletPrivateKeySolana:
                summary: Import Private Key Wallet (Solana)
                value:
                  user_id: user_2sfOL5Kwoymy8KdtzWrhZQY5V6s
                  wallet:
                    public_address: HJkpTBbR7Q5dg3cuuXgrFptyftGB5gDFqs5BvnVaHRr8
                    wallet_type: solana
                    encryption_type: HPKE
                    entropy_type: private_key
                    ciphertext: >-
                      YRl6RRq7En6SoxR9GfAh7nre7ubQBpMoeIHGzcfviw8VCcfwl9+b6vtRJm3ESIGm11n++09AfZoqspogSvDIw5LHZgbNEyTHj6VV/xTTikY9D3Btlz9UqqtW5NLYNBPHx+xD6Y5zQ80=
                    encapsulated_key: KYWtb3Q4IOm2iMespNPMm/n691cxE2vJoFE7wLDe1gI=
              ImportWalletHDEthereum:
                summary: Import HD Wallet (Ethereum)
                value:
                  user_id: user_2sfOL5Kwoymy8KdtzWrhZQY5V6s
                  wallet:
                    public_address: 0xA1b2c3d4E5f...
                    wallet_type: ethereum
                    encryption_type: HPKE
                    entropy_type: hd
                    account_index: 0
                    ciphertext: base64EncodedCiphertext...
                    encapsulated_key: base64EncodedEncapsulatedKey...
      responses:
        '200':
          description: Import Wallet response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique wallet ID.
                  app_id:
                    type: string
                    description: App ID the wallet belongs to.
                  user_id:
                    type: string
                    description: User ID the wallet belongs to.
                  public_address:
                    type: string
                    description: Public address of the imported wallet.
                  wallet_type:
                    type: string
                    description: Blockchain type of the wallet.
                  wallet_client_type:
                    type: string
                    nullable: true
                    description: Client type of the wallet, if applicable.
                  wallet_pk_id:
                    type: string
                    description: Wallet private key ID.
                  verified:
                    type: boolean
                    description: Whether the wallet is verified.
                  is_default:
                    type: boolean
                    description: Whether this is the default wallet for the user.
                  is_read_only:
                    type: boolean
                    description: Whether the wallet is read-only.
                  is_imported:
                    type: boolean
                    description: >-
                      Whether the wallet was imported. Always `true` for
                      imported wallets.
                  delegated:
                    type: boolean
                    description: Whether the wallet is delegated.
                  account_index:
                    type: integer
                    nullable: true
                    description: >-
                      Account derivation index for HD-derived wallets. Returns
                      the index used during wallet generation or import, null if
                      the wallet was created from a private key.
                  updated_at:
                    type: integer
                    description: Unix timestamp of last update.
                  created_at:
                    type: integer
                    description: Unix timestamp of creation.
                required:
                  - id
                  - app_id
                  - user_id
                  - public_address
                  - wallet_type
                  - verified
                  - is_default
                  - is_read_only
                  - is_imported
                  - delegated
                  - updated_at
                  - created_at
              examples:
                ImportWalletResp:
                  value:
                    id: wallet_36l2o0DBM2fSGozFKrVxgNWdKYW
                    app_id: 6e7c9f1b-5e66-400c-99a7-783411e03aac
                    user_id: user_2sfOL5Kwoymy8KdtzWrhZQY5V6s
                    public_address: HJkpTBbR7Q5dg3cuuXgrFptyftGB5gDFqs5BvnVaHRr8
                    wallet_type: solana
                    wallet_client_type: null
                    wallet_pk_id: walletpk_36l2o1Q0L2H3mnfGZJ51O2cgqv6
                    verified: true
                    is_default: false
                    is_read_only: false
                    is_imported: true
                    delegated: false
                    account_index: null
                    updated_at: 1765567007
                    created_at: 1765567007
components:
  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"
        ```

````