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

> Update the real-time user profiles for long term memory

Update a specific profile in a user's long-term memory.


## OpenAPI

````yaml put /api/v1/users/profile/{user_id}/{profile_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/profile/{user_id}/{profile_id}:
    put:
      tags:
        - profile
      summary: Update User Profile
      description: Update the real-time user profiles for long term memory
      operationId: update_user_profile_api_v1_users_profile__user_id___profile_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
            title: User Id
          description: The ID of the user
        - name: profile_id
          in: path
          required: true
          schema:
            anyOf:
              - type: string
                format: uuid4
              - type: string
                format: uuid5
            description: The ID of the profile to update
            title: Profile Id
          description: The ID of the profile to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProfileDelta'
              description: The content of the profile to update
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseResponse'
        '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')


            user = client.get_user('user_id')

            user.update_profile(profile_id="profile_id", content="I am a
            software engineer", topic="career", sub_topic="job")

          label: Python
        - 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)
                }

                // Get a user
                userID := "EXISTING_USER_ID" // Replace with an actual user ID
                user, err := client.GetUser(userID, false)
                if err != nil {
                    log.Fatalf("Failed to get user: %v", err)
                }

                // Update a profile
                profileID := "EXISTING_PROFILE_ID" // Replace with an actual profile ID
                err = user.UpdateProfile(profileID, "value2", "topic2", "sub_topic2")
                if err != nil {
                    log.Fatalf("Failed to update profile: %v", err)
                }
                fmt.Printf("Successfully updated profile with ID: %s
            ", profileID)

            }

          label: Go
components:
  schemas:
    ProfileDelta:
      properties:
        content:
          type: string
          title: Content
          description: The profile content
        attributes:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Attributes
          description: User profile attributes in JSON, containing 'topic', 'sub_topic'
      type: object
      required:
        - content
        - attributes
      title: ProfileDelta
    BaseResponse:
      properties:
        data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Data
          description: Response data payload
        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: BaseResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````