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

# Invite User by Magic Link

> Create an email Magic Link to the provided email for invite verification. If no user account exists, a new user will be created and Magic Link sent.
## Returns

A successful response returns an object with `user_id` and `email_id` properties.

<Warning>
  **Deprecated:** Magic Links are deprecated and will be removed in a future version. Please use [One-time Passcodes (OTP)](/methods/otp/overview) or [OAuth](/methods/oauth/overview) for passwordless authentication instead.
</Warning>


## OpenAPI

````yaml post /v1/auth/magic_links/email/invite
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/magic_links/email/invite:
    parameters: []
    post:
      tags:
        - Magic Links
      summary: Invite User by Magic Link
      description: >-
        Create an email Magic Link to the provided email for invite
        verification. If no user account exists, a new user will be created and
        Magic Link sent.

        ## Returns


        A successful response returns an object with `user_id` and `email_id`
        properties.
      operationId: InviteUserByMagicLink
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InviteUserByMagicLinkRequest'
            examples:
              InviteUserByMagicLinkReq:
                value:
                  first_name: John
                  last_name: Smith
                  email: sandbox@moonkey.fun
                  invite_expires_in: 180
        description: ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  user_id:
                    type: string
                    minLength: 1
                  status:
                    type: string
                  user_created:
                    type: boolean
                  email_id:
                    type: string
                    minLength: 1
                required:
                  - user_id
                  - status
                  - user_created
                  - email_id
              examples:
                InviteUserByMagicLinkResp:
                  value:
                    user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
                    status: pending
                    user_created: true
                    email_id: email_24oXBL3PufzHkH1Jzyjc2EXYeo7
components:
  schemas:
    InviteUserByMagicLinkRequest:
      description: ''
      type: object
      properties:
        email:
          type: string
          minLength: 1
          description: '`Required` Email that uniquely identifies the user.'
        first_name:
          type: string
          description: First name of the user.
        middle_name:
          type: string
          description: Middle name of the user.
        last_name:
          type: string
          description: Last name of the user.
        invite_redirect_url:
          type: string
          description: >-
            The base url we will use to construct the final invite magic link
            and send to the user via email. If the redirect_url is
            [https://moonkey.fun/authenticate](https://moonkey.fun/authenticate),
            final url user sees in email will be
            [https://moonkey.fun/authenticate?token=autogeneratedmagictoken](https://moonkey.fun/authenticate?token=autogeneratedmagictoken).
            We will redirect to your app in this url and your app should handle
            and parse the token parameter and allow the user to accept invite.
            If no url is sent in, we will use the default redirect url set in
            the Console and if no default redirect url is available, an error
            will be returned.
        invite_expires_in:
          type: number
          description: >-
            Expiration time of the magic link in minutes for invite. Must be
            between 5 to 10080 minutes (7 days), defaults to 60 minutes.
        device_fingerprint:
          type: object
          description: >-
            Device fingerprinting metadata for fraud detection during
            verification step. This is useful to ensure that the user who
            originated the request matches the user that verifies the token.
            Verification requirements can be enabled in the `Verify Token` step
            by matching fields in the `device_fingerprint` such as IP, User
            Agent or the combination of them (more fraud detection features
            **coming soon**!)
          properties:
            ip:
              type: string
              description: IP of the user originating the request.
            user_agent:
              type: string
              description: User Agent of the browser originating the request.
      required:
        - email
  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"
        ```

````