CharacterAI
  • 👋Welcome
  • 🧑‍💻Quick Start
  • 🛠️API
    • 🔑 Values
    • ⚠️ Errors
    • connect
    • ping
    • user
      • info
      • get_profile
      • followers
      • following
      • recent
      • update
    • post
      • get_post
      • my_posts
      • get_posts
      • upvote
      • undo_upvote
      • send_comment
      • delete_comment
      • create
      • delete
      • get_topics
      • feed
    • character
      • create
      • update
      • trending
      • recommended
      • categories
      • info
      • search
      • voices
    • chat
      • create_room
      • rate
      • next_message
      • get_histories
      • get_history
      • get_chat
      • send_message
      • delete_message
      • new_chat
    • chat2
      • next_message
      • send_message
      • get_histories
      • new_chat
      • get_chat
      • get_history
      • rate
      • delete_message
  • 📚Examples
    • Chatting
    • Parse Chat
  • ⚠️Issues
Powered by GitBook
On this page
  • key / token
  • char / char_external_id
  • history_external_id / external_id
  • topic_external_id / topic
  • tgt / username
  • creator_id
  1. API

🔑 Values

To use the library, you need to know how to get some values. Also, some values will be described here, it is not necessary to know them, I decided to explain them for general understanding

PreviousAPINext⚠️ Errors

Last updated 1 year ago

key / token

DO NOT SHARE IT

The token is needed for authorization and operation of requests from your account. There are 3 ways to get a token:

Local Storage

  1. Open DevTools in your browser

  2. Go to Storage -> Local Storage -> char_token

  3. Copy value

Console

  1. Open DevTools in your browser

  2. Go to Console tab and enter this code:

  3. JSON.parse(localStorage.getItem('char_token')).value

Tampermonkey

  1. Download userscript

  2. Go to cAI Profile Settings and look down

char / char_external_id

Unique ID for characters

  1. Open the chat page with the character

  2. Copy char value from URL

history_external_id / external_id

Unique ID for character history

if you look at the responce of character.get_histories(), then you will see that each story has its own external_id

topic_external_id / topic

The ID of the feed, I don't know where it comes from and how to get it. Also, community feed have their topic_external_id, you can get them in post.get_topics()

tgt / username

It is also a character identifier. It would be more correct to call it the nickname of the character

creator_id

Your account ID. Needed for functions with chat2, stored in your account information

user = await client.user.info()
print(user['user']['user']['id'])
🛠️
this