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

# Update member profile

> Updates the member's profile fields such as country code and address.

**Authentication:** Requires tenant API key or session authentication.

**Access Control:** Members can update their own profile. Admins and API keys can update any user in the tenant.

**Country Code:** Must be a 3-letter ISO 3166-1 alpha-3 code (e.g., "USA", "PHL", "GBR").

**Address:** If provided, must include a valid `countryCode` field.




## OpenAPI

````yaml api/openapi.yaml patch /api/v1/members/{userId}/profile
openapi: 3.1.0
info:
  title: MLM Platform API
  version: 1.0.0
  description: >
    The MLM Platform API enables tenant developers to integrate commission
    tracking,

    member management, and referral systems into their applications.


    ## Authentication

    All API requests require a tenant API key passed in the `x-tenant-api-key`
    header.


    ## Environments

    - **LIVE**: Production environment with real data

    - **SANDBOX**: Test environment for development and testing


    API keys are scoped to specific environments. Use sandbox keys for testing.


    The environment is derived from the API key used for the request.

    The platform returns the selected environment in the response header
    `X-Environment`.

    If you send an `X-Environment` request header, it is treated as
    optional/debug-only.
  contact:
    name: MLM Platform Support
    email: support@mlm-platform.example.com
  license:
    name: Proprietary
    url: https://mlm-platform.example.com/terms
servers:
  - url: https://app.mlm-platform.com
    description: Production API
  - url: http://localhost:3000
    description: Local Development
security:
  - TenantApiKey: []
tags:
  - name: Auth
    description: Token exchange, validation, refresh, and revocation for OIDC federation
  - name: Events
    description: Purchase and commission events
  - name: Users
    description: Member management
  - name: Leads
    description: Lead capture and tracking
  - name: Referrals
    description: Referral links and codes
  - name: Payout
    description: Payout methods metadata for dynamic payout setup forms
  - name: Payout Accounts
    description: Member payout accounts (create/list/update/delete)
  - name: KYC
    description: Member KYC start, status, and document submission
  - name: Admin KYC
    description: Admin KYC review queue, details, and actions
  - name: Widget
    description: Embeddable widget authentication
  - name: Webhooks
    description: Webhook receivers for third-party providers (Sumsub)
paths:
  /api/v1/members/{userId}/profile:
    patch:
      tags:
        - Users
      summary: Update member profile
      description: >
        Updates the member's profile fields such as country code and address.


        **Authentication:** Requires tenant API key or session authentication.


        **Access Control:** Members can update their own profile. Admins and API
        keys can update any user in the tenant.


        **Country Code:** Must be a 3-letter ISO 3166-1 alpha-3 code (e.g.,
        "USA", "PHL", "GBR").


        **Address:** If provided, must include a valid `countryCode` field.
      operationId: updateMemberProfile
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMemberProfileRequest'
            examples:
              updateIdentity:
                summary: Update identity fields for KYC/payout
                value:
                  givenName: Tai Man
                  surname: Chan
                  dateOfBirth: '1990-06-15'
                  idNumber: A1234567
              updateFullProfile:
                summary: Update full profile with identity and address
                value:
                  name: Chan Tai Man
                  givenName: Tai Man
                  surname: Chan
                  dateOfBirth: '1990-06-15'
                  idNumber: A1234567
                  countryCode: HKG
                  address:
                    countryCode: HKG
                    addressLine1: 123 Queen's Road Central
                    addressLine2: Flat 12B, Tower 1
                    city: Hong Kong
                    postalCode: '999077'
                    addressType: residential
              updateName:
                summary: Update display name only
                value:
                  name: Chan Tai Man
              updateAddress:
                summary: Update address only
                value:
                  address:
                    countryCode: PHL
                    addressLine1: 123 Rizal Avenue
                    addressLine2: Unit 4B, Sunrise Building
                    district: Barangay Poblacion
                    city: Makati City
                    state: Metro Manila
                    postalCode: '1200'
                    addressType: residential
      responses:
        '200':
          description: Updated member profile
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemberProfile'
          headers:
            X-Environment:
              $ref: '#/components/headers/X-Environment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    UpdateMemberProfileRequest:
      type: object
      description: >
        Request to update member profile fields. All fields are optional - only
        provided fields will be updated.


        Identity fields (`givenName`, `surname`, `dateOfBirth`, `idNumber`,
        `address`) are used for:

        - KYC verification (matching against uploaded documents)

        - Payout account creation (Stripe Connect requires identity
        verification)
      properties:
        name:
          type: string
          maxLength: 255
          nullable: true
          description: Member display name (full name). Set to null to clear.
          example: Chan Tai Man
        givenName:
          type: string
          maxLength: 100
          nullable: true
          description: First/given name for KYC verification. Set to null to clear.
          example: Tai Man
        surname:
          type: string
          maxLength: 100
          nullable: true
          description: Last/family name for KYC verification. Set to null to clear.
          example: Chan
        dateOfBirth:
          type: string
          format: date
          nullable: true
          description: Date of birth in YYYY-MM-DD format. Set to null to clear.
          example: '1990-06-15'
        idNumber:
          type: string
          maxLength: 50
          nullable: true
          description: |
            Government ID number for KYC verification. Country-specific format:
            - Hong Kong: HKID (e.g., "A1234567")
            - USA: Last 4 digits of SSN (e.g., "1234")
            - UK: National Insurance number (e.g., "AB123456C")
            Set to null to clear.
          example: A1234567
        countryCode:
          type: string
          minLength: 3
          maxLength: 3
          nullable: true
          description: >-
            ISO 3166-1 alpha-3 country code (e.g., "HKG", "USA", "GBR"). Set to
            null to clear.
          example: HKG
        address:
          $ref: '#/components/schemas/MemberAddress'
          nullable: true
          description: Member address for KYC verification. Set to null to clear.
    MemberProfile:
      type: object
      description: >-
        Member profile information including identity fields for KYC and payout
        accounts
      properties:
        id:
          type: string
          format: uuid
          description: Member user ID
        name:
          type: string
          nullable: true
          description: Member display name (full name)
        givenName:
          type: string
          nullable: true
          description: First/given name for KYC verification
          example: Tai Man
        surname:
          type: string
          nullable: true
          description: Last/family name for KYC verification
          example: Chan
        dateOfBirth:
          type: string
          format: date
          nullable: true
          description: Date of birth in YYYY-MM-DD format
          example: '1990-06-15'
        idNumber:
          type: string
          nullable: true
          description: Government ID number (country-specific - HKID, SSN last 4, etc.)
          example: A1234567
        email:
          type: string
          format: email
          description: Member email address
        countryCode:
          type: string
          minLength: 3
          maxLength: 3
          nullable: true
          description: ISO 3166-1 alpha-3 country code
          example: HKG
        address:
          $ref: '#/components/schemas/MemberAddress'
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message
        code:
          type: string
          description: Machine-readable error code
        details:
          type: object
          additionalProperties: true
          description: Additional error details
    MemberAddress:
      type: object
      description: Member address following international address formats
      required:
        - countryCode
      properties:
        countryCode:
          type: string
          minLength: 3
          maxLength: 3
          description: ISO 3166-1 alpha-3 country code (e.g., "USA", "PHL", "GBR")
          example: PHL
        addressLine1:
          type: string
          maxLength: 255
          description: Street address, P.O. box, company name
          example: 123 Rizal Avenue
        addressLine2:
          type: string
          maxLength: 255
          description: Apartment, suite, unit, building, floor
          example: Unit 4B, Sunrise Building
        city:
          type: string
          maxLength: 255
          description: City / Locality / Municipality
          example: Makati City
        state:
          type: string
          maxLength: 255
          description: State / Province / Region
          example: Metro Manila
        postalCode:
          type: string
          maxLength: 255
          description: Postal / ZIP code
          example: '1200'
        district:
          type: string
          maxLength: 255
          description: District / Barangay (PH) / Borough (HK)
          example: Barangay Poblacion
        neighborhood:
          type: string
          maxLength: 255
          description: Subdivision / Village
        addressType:
          type: string
          enum:
            - residential
            - business
            - postal
          description: Type of address
          example: residential
  headers:
    X-Environment:
      description: >-
        Indicates the environment (LIVE or SANDBOX) the request was processed in
        (derived from API key)
      schema:
        type: string
        enum:
          - LIVE
          - SANDBOX
  responses:
    BadRequest:
      description: Bad Request - Invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Invalid request body
            code: VALIDATION_ERROR
            details:
              field: email
              message: Invalid email format
    Unauthorized:
      description: Unauthorized - Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_api_key:
              summary: Missing API key
              value:
                error: Authentication required
                code: UNAUTHORIZED
            invalid_api_key:
              summary: Invalid API key
              value:
                error: Invalid API key
                code: INVALID_API_KEY
    InternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: An unexpected error occurred
            code: INTERNAL_ERROR
  securitySchemes:
    TenantApiKey:
      type: apiKey
      in: header
      name: x-tenant-api-key
      description: >
        Tenant API key for authentication. Keys are scoped to specific
        environments

        (LIVE or SANDBOX). Obtain keys from the admin dashboard.

````