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

# Update character details

> Update the details of an existing character. Provide any of the updatable fields such as age, description, gender, items, events, quests, role, tone, or traits.




## OpenAPI

````yaml /api-reference/openapi.yaml patch /context/characters/{game_id}/{world_id}/{character_id}
openapi: 3.0.3
info:
  title: NPC Builder - API
  description: >
    This is the latest NPC Builder API specification that defines a
    comprehensive, production-ready API for NPC Builder. The API is divided into
    three primary services:


    **Interactions Service**  
      - **Purpose:** Enables dynamic, context-aware conversations between players and NPC characters.


    **Context Service**  
      - **Purpose:** Manages in-game entities to build and maintain immersive game environments.
      - **Includes:**  
        - **Worlds:** Create, update, and delete game worlds.
        - **Regions:** Define and manage distinct regions within a world.
        - **Locations:** Handle specific locations within regions.
        - **Characters:** Manage the lifecycle (creation, updating, deletion) of NPC characters.


    **Sessions Service**  
      - **Purpose:** Manages player sessions to maintain game context and track interactions.


    Overall, this specification serves as a detailed guide to leveraging NPC
    Builder’s services—empowering developers to build rich, interactive
    experiences while efficiently managing game contexts and entities.
        _You must stick to the data structure defined, otherwise you may encounter unhandled errors_


    **Please check the schemas of each request to find the allowed values for
    certain properties.**


    _Technical Limitations: Character's knowledge and relationships updating and
    deleting are not available through the API. They must be managed through our
    app's frontend._


    Some useful links:

    - [Our website](https://npcbuilder.com)

    - [The App](https://app.npcbuilder.com)
  termsOfService: https://npcbuilder.com/terms-and-conditions/
  contact:
    email: support@npcbuilder.com
  version: 1.6.0
servers:
  - url: https://app.npcbuilder.com/api
    description: Production API for context, sessions, and non-interaction endpoints
security: []
tags:
  - name: Interactions
    description: Manage your NPCs text conversations and interactive responses.
  - name: Characters
    description: Manage characters in your game including creation, update, and deletion.
  - name: Worlds
    description: Create and manage immersive worlds for your game.
  - name: Regions
    description: Define and manage regions within your worlds.
  - name: Locations
    description: Manage specific locations within regions of your game.
  - name: Sessions
    description: Create, retrieve, and delete player sessions for enhanced game management.
paths:
  /context/characters/{game_id}/{world_id}/{character_id}:
    patch:
      tags:
        - Characters
      summary: Update character details
      description: >
        Update the details of an existing character. Provide any of the
        updatable fields such as age, description, gender, items, events,
        quests, role, tone, or traits.
      parameters:
        - name: game_id
          in: path
          required: true
          description: The unique identifier for the game.
          schema:
            type: string
            example: game123
        - name: world_id
          in: path
          required: true
          description: The unique identifier for the world.
          schema:
            type: string
            example: world456
        - name: character_id
          in: path
          required: true
          description: The unique identifier for the character.
          schema:
            type: string
            example: character789
        - name: session_id
          in: query
          description: (Optional) The player's session ID.
          required: false
          schema:
            type: string
            example: 60Z5aZjIuFlyYbjbZZKe
      requestBody:
        required: true
        description: The character data fields to update.
        content:
          application/json:
            schema:
              type: object
              properties:
                age:
                  type: string
                  description: The age category of the character.
                  enum:
                    - infant
                    - child
                    - teenager
                    - youngAdult
                    - adult
                    - middleAged
                    - elderly
                  example: adult
                description:
                  type: string
                  description: A brief description of the character.
                  example: A brave warrior with a mysterious past.
                gender:
                  type: string
                  description: The gender of the character.
                  example: Male
                model:
                  type: string
                  description: >-
                    The AI model used to power character interactions. Premium
                    models are available only for some subscriptions.
                  enum:
                    - standard
                    - premium
                  example: standard
                filters:
                  type: object
                  description: >
                    Structured content filters applied to the character's
                    responses. Provide the toggles you want to update when
                    adjusting moderation settings.
                  properties:
                    active:
                      type: boolean
                      description: Enables or disables all filters for the character.
                    violence:
                      type: boolean
                      description: >-
                        Reinforces violent or gory content in character
                        responses.
                    sexual:
                      type: boolean
                      description: >-
                        Reinforces sexual or suggestive content in character
                        responses.
                    drugs:
                      type: boolean
                      description: >-
                        Reinforces references to drug use or paraphernalia in
                        character responses.
                  example:
                    active: true
                    violence: true
                    sexual: false
                    drugs: false
                items:
                  type: array
                  description: A list of updated items for the character.
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        description: The type of item.
                        enum:
                          - trade
                          - action
                        example: trade
                    required:
                      - type
                    oneOf:
                      - description: Schema for items of type "trade"
                        properties:
                          type:
                            type: string
                            enum:
                              - trade
                            example: trade
                          itemName:
                            type: string
                            description: The name of the trade item.
                            example: sword
                          description:
                            type: string
                            description: A detailed description of the item.
                            example: A sharp sword.
                          unit:
                            type: string
                            description: The measurement unit.
                            example: Piece
                          value:
                            type: number
                            description: The cost or value of the item.
                            example: 100
                        required:
                          - itemName
                          - unit
                          - value
                      - description: Schema for items of type "action"
                        properties:
                          type:
                            type: string
                            enum:
                              - action
                            example: action
                          itemName:
                            type: string
                            description: The name of the action.
                            example: Move
                          description:
                            type: string
                            description: A description of the action.
                            example: Move to position
                        required:
                          - itemName
                          - description
                events:
                  type: array
                  description: A list of events related to the character.
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        description: The type of event.
                        enum:
                          - item
                          - action
                        example: item
                    required:
                      - type
                    oneOf:
                      - description: Schema for events of type "action"
                        properties:
                          type:
                            type: string
                            enum:
                              - action
                            example: action
                          eventName:
                            type: string
                            description: The name of the event.
                            example: Attack
                          description:
                            type: string
                            description: Detailed event description.
                            example: Act of violence against another person.
                        required:
                          - eventName
                      - description: Schema for events of type "item"
                        properties:
                          type:
                            type: string
                            enum:
                              - item
                            example: item
                          eventName:
                            type: string
                            description: The name of the event.
                            example: Give
                          description:
                            type: string
                            description: Detailed event description.
                            example: Provide an object to a person.
                        required:
                          - eventName
                name:
                  type: string
                  description: The display name of the character.
                  example: Aragorn
                quests:
                  type: array
                  description: A list of quests associated with the character.
                  items:
                    type: object
                    properties:
                      description:
                        type: string
                        description: A brief description of the quest.
                        example: Retrieve the lost artifact.
                      objective:
                        type: string
                        description: The quest's main objective.
                        example: Find and return the artifact.
                      reward:
                        type: string
                        description: The reward for quest completion.
                        example: 500 gold coins
                role:
                  type: string
                  description: The role the character plays in the game.
                  enum:
                    - noRole
                    - protagonist
                    - antagonist
                    - secondaryCharacter
                    - tertiaryCharacter
                    - mentor
                    - enemy
                    - villain
                    - rival
                    - shopkeeper
                    - healer
                    - questGiver
                    - innkeeper
                    - guard
                    - familyMember
                    - loveInterest
                    - scientist
                    - politician
                    - criminal
                    - explorer
                    - wizard
                    - ghost
                    - animalCompanion
                    - artificialIntelligence
                  example: protagonist
                tone:
                  type: string
                  description: The style or mood of the character's dialogue.
                  enum:
                    - formal
                    - casual
                    - sarcastic
                    - mysterious
                    - emotive
                  example: mysterious
                traits:
                  type: array
                  description: >-
                    Legacy/basic trait list. When provided without
                    personality_theory, the API stores the character as
                    basicTraits.
                  items:
                    type: string
                    example: brave
                personality_theory:
                  type: string
                  description: Personality framework used by interactions.
                  enum:
                    - basicTraits
                    - bigFive
                    - darkTriad
                    - dndAlignment
                    - mbti
                    - enneagram
                  default: basicTraits
                  example: basicTraits
                personality_dimensions:
                  type: object
                  description: >-
                    Dimension values for the selected personality_theory.
                    basicTraits uses traits and an empty object.
                  additionalProperties:
                    type: integer
                  example:
                    machiavellianism: 4
                    narcissism: 2
                    psychopathy: 1
                speech_pattern:
                  type: object
                  description: Optional speech style controls consumed by interactions.
                  properties:
                    vocabulary_level:
                      type: string
                      enum:
                        - simple
                        - moderate
                        - sophisticated
                        - archaic
                      example: sophisticated
                    sentence_length:
                      type: string
                      enum:
                        - terse
                        - average
                        - verbose
                      example: terse
                    verbal_quirks:
                      type: string
                      example: Always says 'dear friend'
      responses:
        '200':
          description: Character updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Confirmation message after updating the character.
                    example: >-
                      Character: character789 has been updated with the
                      following context.
                  character_id:
                    type: string
                    description: UID of the character.
                    example: character789
                  character_context:
                    type: object
                    description: Updated character context data.
                    example:
                      age: adult
                      description: A brave warrior with a mysterious past.
                      gender: Male
                      items:
                        - itemName: sword
                          unit: Piece
                          value: 100
                      name: Aragorn
                      quests:
                        - description: Retrieve the lost artifact.
                          objective: Find and return the artifact.
                          reward: 500 gold coins
                      role: protagonist
                      tone: mysterious
                      traits:
                        - brave
                      personality_theory: basicTraits
                      personality_dimensions: {}
        '400':
          description: |
            Validation error – Request payload did not meet schema requirements.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: |
            Not Found – The specified character or context does not exist.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message with potential reasons.
                    example: |
                      Possible reasons:
                      - Character not found
        '500':
          description: >
            Internal Server Error – An error occurred while updating the
            character.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - npcbuilder_auth: []
components:
  schemas:
    ErrorResponse:
      type: object
      description: Standard error response schema.
      properties:
        message:
          type: string
          description: Detailed error message.
          example: An error occurred
  securitySchemes:
    npcbuilder_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````