v4

latestOpenAPI 3.1.1Apache 2.02026-07-31107278570.4 KB
Users

Update user information

Modifies user account information including profile details, metadata, and external ID. Use this endpoint to update a user's personal information, contact details, or custom metadata. You can update the user's profile, phone number, and metadata fields. Note that fields like user ID, email address, environment ID, and creation time cannot be modified.

patch/api/v1/users/{id}

Path parameters

idstring required

System-generated user ID. Must start with 'usr_' and be 19-25 characters long.

Request body

external_idstring

Your application's unique identifier for this user, used to link Scalekit with your system.

metadataobject

Custom key-value pairs for storing additional user context. Keys (3-25 chars), values (1-256 chars).

Example request

{
  "external_id": "ext_12345a67b89c",
  "metadata": {
    "department": "engineering",
    "location": "nyc-office"
  },
  "user_profile": {
    "custom_attributes": {
      "department": "engineering",
      "security_clearance": "level2"
    },
    "family_name": "Doe",
    "first_name": "John",
    "gender": "male",
    "given_name": "John",
    "groups": [
      "engineering",
      "managers"
    ],
    "last_name": "Doe",
    "locale": "en-US",
    "metadata": {
      "account_status": "active",
      "signup_source": "mobile_app"
    },
    "name": "John Doe",
    "phone_number": "+14155552671",
    "picture": "https://example.com/avatar.jpg",
    "preferred_username": "John Michael Doe"
  }
}

Response

User updated successfully. Returns the modified user object with updated timestamps.

Example response

{
  "user": {
    "email": "user@example.com",
    "external_id": "ext_12345a67b89c",
    "id": "usr_1234abcd5678efgh",
    "memberships": [
      {
        "display_name": "Acme Corporation",
        "metadata": {
          "department": "engineering",
          "location": "nyc-office"
        },
        "name": "AcmeCorp",
        "organization_id": "org_1234abcd5678efgh",
        "permissions": [
          "read_projects",
          "write_tasks",
          "manage_users"
        ],
        "roles": [
          {
            "display_name": "Dev Team",
            "id": "role_79643236410327240",
            "name": "team_dev"
          }
        ]
      }
    ],
    "metadata": {
      "department": "engineering",
      "location": "nyc-office"
    },
    "user_profile": {
      "custom_attributes": {
        "department": "engineering",
        "security_clearance": "level2"
      },
      "email_verified": true,
      "external_identities": [
        {
          "connection_id": "conn_1234abcd5678efgh",
          "connection_type": "OAUTH",
          "connection_user_id": "ext_user_12345",
          "is_social": true
        }
      ],
      "family_name": "Doe",
      "gender": "male",
      "given_name": "John",
      "groups": [
        "admin",
        "developer"
      ],
      "id": "usr_profile_1234abcd5678efgh",
      "locale": "en-US",
      "metadata": {
        "department": "engineering",
        "employee_type": "full-time",
        "idp_user_id": "12345"
      },
      "name": "John Michael Doe",
      "phone_number": "+14155552671",
      "phone_number_verified": true,
      "picture": "https://example.com/avatar.jpg",
      "preferred_username": "johndoe"
    }
  }
}