Skip to main content
PATCH
/
context
/
characters
/
{game_id}
/
{world_id}
/
{character_id}
Update character details
curl --request PATCH \
  --url https://app.npcbuilder.com/api/context/characters/{game_id}/{world_id}/{character_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "age": "adult",
  "description": "A brave warrior with a mysterious past.",
  "gender": "Male",
  "model": "standard",
  "filters": true,
  "items": [
    {
      "type": "trade",
      "itemName": "sword",
      "description": "A sharp sword.",
      "unit": "Piece",
      "value": 100
    }
  ],
  "events": [
    {
      "type": "item",
      "eventName": "Attack",
      "description": "Act of violence against another person."
    }
  ],
  "name": "Aragorn",
  "quests": [
    {
      "description": "Retrieve the lost artifact.",
      "objective": "Find and return the artifact.",
      "reward": "500 gold coins"
    }
  ],
  "role": "protagonist",
  "tone": "mysterious",
  "traits": [
    "brave"
  ]
}'
{
  "message": "Character: character789 has been updated with the following context.",
  "character_id": "character789",
  "character_context": {
    "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"
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

game_id
string
required

The unique identifier for the game.

Example:

"game123"

world_id
string
required

The unique identifier for the world.

Example:

"world456"

character_id
string
required

The unique identifier for the character.

Example:

"character789"

Query Parameters

session_id
string

(Optional) The player's session ID.

Example:

"60Z5aZjIuFlyYbjbZZKe"

Body

application/json

The character data fields to update.

age
enum<string>

The age category of the character.

Available options:
infant,
child,
teenager,
youngAdult,
adult,
middleAged,
elderly
Example:

"adult"

description
string

A brief description of the character.

Example:

"A brave warrior with a mysterious past."

gender
string

The gender of the character.

Example:

"Male"

model
enum<string>

The AI model used to power character interactions. Premium models are available only for some subscriptions.

Available options:
standard,
premium
Example:

"standard"

filters
boolean

A flag indicating whether to apply filters to the character's responses. Filters can be used to restrict certain types of content or language.

Example:

true

items
object[]

A list of updated items for the character.

  • Option 1
  • Option 2
events
object[]

A list of events related to the character.

  • Option 1
  • Option 2
name
string

The display name of the character.

Example:

"Aragorn"

quests
object[]

A list of quests associated with the character.

role
enum<string>

The role the character plays in the game.

Available options:
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
enum<string>

The style or mood of the character's dialogue.

Available options:
formal,
casual,
sarcastic,
mysterious,
emotive
Example:

"mysterious"

traits
string[]

A list of personality traits of the character.

Response

Character updated successfully.

message
string

Confirmation message after updating the character.

Example:

"Character: character789 has been updated with the following context."

character_id
string

UID of the character.

Example:

"character789"

character_context
object

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"]
}
I