Skip to main content
PUT
/
v1
/
auth
/
users
/
{user_id}
/
update
Update User
curl --request PUT \
  --url https://api.moonkey.fun/v1/auth/users/{user_id}/update \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "first_name": "John",
  "middle_name": "",
  "last_name": "Smith",
  "emails": [
    {
      "email": "sandbox@moonkey.fun"
    }
  ],
  "phone_numbers": [
    {
      "phone_number": "+14152222222"
    }
  ]
}'
{
  "user_id": "user_24wFP9pDa9YiMJLun94iKykoZs2",
  "phone_numbers": [
    {
      "id": "pn_24oXBLRv6BoHXbNZoTAZkAFlRsy",
      "verified": false,
      "phone_number": "+14152222222",
      "updated_at": 1642703333,
      "created_at": 1642703333
    }
  ],
  "emails": [
    {
      "id": "email_24oXBL3PufzHkH1Jzyjc2EXYeo7",
      "verified": false,
      "email": "sandbox@moonkey.fun",
      "updated_at": 1642703333,
      "created_at": 1642703333
    }
  ],
  "user": {
    "user_id": "user_24wFP9pDa9YiMJLun94iKykoZs2",
    "first_name": "",
    "middle_name": "",
    "last_name": "",
    "status": "active",
    "active": true,
    "updated_at": 1646873318,
    "created_at": 1646873318,
    "emails": [
      {
        "id": "email_26AjWpEcss2YyqFh1san6Wjjs7o",
        "verified": true,
        "email": "hello@moonkey.fun",
        "updated_at": 1646957196,
        "created_at": 1646873318
      },
      {
        "id": "email_24oXBL3PufzHkH1Jzyjc2EXYeo7",
        "verified": false,
        "email": "sandbox@moonkey.fun",
        "updated_at": 1642703333,
        "created_at": 1642703333
      }
    ],
    "phone_numbers": [
      {
        "id": "pn_24oXBLRv6BoHXbNZoTAZkAFlRsy",
        "verified": false,
        "phone_number": "+14152222222",
        "updated_at": 1642703333,
        "created_at": 1642703333
      }
    ],
    "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
      }
    ],
    "wallets": [
      {
        "id": "wallet_26AjWu075gRWMnjfPglcdoD2PAQ",
        "public_address": "0x863c381a56a58370f435b0100faba94e6462b6d1",
        "wallet_type": "ethereum",
        "verified": true,
        "is_default": true,
        "is_read_only": false,
        "is_imported": false,
        "updated_at": 1646873319,
        "created_at": 1646873319
      }
    ],
    "totps": [],
    "webauthn_credentials": []
  }
}

Authorizations

Authorization
string
header
required

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 \
-X GET https://api.moonkey.fun/v1/auth/users/user_24wFP9pDa9YiMJLun94iKykoZs2 \
-H "Authorization: Bearer sk_test_pRqweh3wvWmJAAVYv7Z0T5iPLzFM4ql0muoyQcjOxGeN3p1r"

Path Parameters

user_id
string
required

Unique User ID of the user to update.

Body

application/json
first_name
string

First name of the user.

Minimum length: 1
middle_name
string

Middle name of the user.

Minimum length: 1
last_name
string

Last name of the user.

Minimum length: 1
emails
object[]

List of Emails to attach to the user.

Minimum length: 1
phone_numbers
object[]

List of E.164 formatted mobile phone numbers to attach to the user.

Minimum length: 1
metadata
object

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
replace_metadata
boolean
default:false

Controls how metadata is updated:

  • If false (default): Merges provided metadata with existing metadata at the top level only
  • If true: Completely replaces all existing metadata (fields not in the request are removed)
Examples:

false

Response

200 - application/json

OK

user_id
string
required
Minimum length: 1
phone_numbers
object[]
required
Minimum length: 1
emails
object[]
required
Minimum length: 1
user
object