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

# Update User

Update an existing user's data. This endpoint allows you to modify user-specific information and settings.


## OpenAPI

````yaml put /api/v1/users/{user_id}
openapi: 3.1.0
info:
  title: Memobase API
  summary: APIs for Memobase, a user memory system for LLM Apps
  version: 0.0.40
servers:
  - url: https://api.memobase.dev
  - url: https://api.memobase.cn
security:
  - BearerAuth: []
paths:
  /api/v1/users/{user_id}:
    put:
      tags:
        - user
      summary: Update User
      operationId: update_user_api_v1_users__user_id__put
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            anyOf:
              - type: string
                format: uuid4
              - type: string
                format: uuid5
            description: The ID of the user to update
            title: User Id
          description: The ID of the user to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              description: Updated user data
              title: User Data
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IdResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-code-samples:
        - lang: python
          source: >+
            # To use the Python SDK, install the package:

            # pip install memobase


            from memobase import MemoBaseClient


            client = MemoBaseClient(project_url='PROJECT_URL',
            api_key='PROJECT_TOKEN')


            client.update_user(uid, {"ANY": "NEW_DATA"})

          label: Python
        - lang: javascript
          source: >+
            // To use the JavaScript SDK, install the package:

            // npm install @memobase/memobase


            import { MemoBaseClient } from '@memobase/memobase';


            const client = new MemoBaseClient(process.env.MEMOBASE_PROJECT_URL,
            process.env.MEMOBASE_API_KEY);


            await client.updateUser(userId, {ANY: "NEW_DATA"});

          label: JavaScript
        - lang: go
          source: >+
            // To use the Go SDK, install the package:

            // go get
            github.com/memodb-io/memobase/src/client/memobase-go@latest


            import (
                "fmt"
                "log"

                "github.com/memodb-io/memobase/src/client/memobase-go/core"
            )


            func main() {
                projectURL := "YOUR_PROJECT_URL"
                apiKey := "YOUR_API_KEY"
                // Initialize the client
                client, err := core.NewMemoBaseClient(
                    projectURL,
                    apiKey,
                )
                if err != nil {
                    log.Fatalf("Failed to create client: %v", err)
                }

                // Update a user
                userID := "EXISTING_USER_ID" // Replace with an actual user ID
                newData := map[string]interface{}{"ANY": "NEW_DATA"}
                _, err = client.UpdateUser(userID, newData)
                if err != nil {
                    log.Fatalf("Failed to update user: %v", err)
                }
                fmt.Printf("Successfully updated user with ID: %s
            ", userID)

            }

          label: Go
components:
  schemas:
    IdResponse:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/IdData'
            - type: 'null'
          description: Response containing a single ID
        errno:
          $ref: '#/components/schemas/CODE'
          description: Error code, 0 means success
          default: 0
        errmsg:
          type: string
          title: Errmsg
          description: Error message, empty when success
          default: ''
      type: object
      title: IdResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    IdData:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid4
            - type: string
              format: uuid5
          title: Id
          description: The UUID identifier
      type: object
      required:
        - id
      title: IdData
    CODE:
      type: integer
      enum:
        - 0
        - 400
        - 401
        - 403
        - 404
        - 405
        - 409
        - 422
        - 500
        - 501
        - 502
        - 503
        - 504
        - 520
      title: CODE
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````