API Documentation

PythBots API

Access PythBots features programmatically using simple HTTPS endpoints.

These APIs let you:

  • Look up users

  • Get chat staff and ranks

  • View chat statistics

  • Send and read in-system mail
  • Authentication

    Most endpoints do NOT require any key.

    Only the Mail API requires a personalkey.

    ### How to get your personal key
    1. Go to https://xat.com/pythbots
    2. Type the command:
    !link
    3. The bot will send you a private chat (PC) with your personal key.

    Endpoints

    User Info


    Get profile information for a user by xat username or numeric ID.

    Endpoint
    GET https://pythbots.com/api/userinfo.php?user=$username
    orid

    What it does
    Returns detailed user data including username, nickname, avatar, powers, chats, rank, and live online status.

    Parameters

  • user (required) — Username (example: tiro) OR user ID (example: 221192)
  • Example
    https://pythbots.com/api/userinfo.php?user=tiro

    Chat Rank Info


    Get staff members and ranks for a chat.

    Endpoint
    GET https://pythbots.com/api/crank.php?chatid=$chatid

    What it does
    Returns a list of staff members (Main Owner, Owner, Moderator) for a chat, including time held and avatar.

    The chat must be opted in for API access or this endpoint may return an error.

    Parameters

  • chatid (required) — Numeric chat ID
  • Example
    https://pythbots.com/api/crank.php?chatid=220531305

    Chat Stats


    Get message counts, user activity, and usage data for a chat.

    Endpoint
    GET https://pythbots.com/api/cstats.php?chatid=$chatid

    What it does
    Returns chat-level message totals, active users, and usage statistics.

    Parameters

  • chatid (required) — Numeric chat ID
  • Example
    https://pythbots.com/api/cstats.php?chatid=220531305

    Mail API

    The Mail API is the only API that requires a personalkey.

    Send Mail (by username)


    Send an encrypted message to another user using their username.

    Endpoint
    GET https://pythbots.com/api/mail.php?personalkey=$personalkey&user=$username&message=$message

    What it does
    Sends a private in-system message to a user by username.

    Parameters

  • personalkey (required) — Your personal key

  • user (required) — Target username

  • message (required) — Message text
  • Example
    https://pythbots.com/api/mail.php?personal
    key=YOURKEY&user=tiro&message=Hello

    Send Mail (by user ID)


    Send an encrypted message to another user using their numeric user ID.

    Endpoint
    GET https://pythbots.com/api/mail.php?personal
    key=$personalkey&id=$userid&message=$message

    What it does
    Sends a private in-system message using the target user’s numeric ID.

    Parameters

  • personalkey (required) — Your personal key

  • id (required) — Target user ID

  • message (required) — Message text
  • Example
    https://pythbots.com/api/mail.php?personalkey=YOURKEY&id=221192&message=Hello

    Get New Mail


    Retrieve all unread mail messages.

    Endpoint
    GET https://pythbots.com/api/mail.php?personalkey=$personalkey&readnew

    What it does
    Returns all unread messages for your account.

    Parameters

  • personalkey (required) — Your personal key

  • readnew (flag) — Include exactly like &readnew
  • Example
    https://pythbots.com/api/mail.php?personal
    key=YOURKEY&readnew

    Get All Mail


    Retrieve all messages (read and unread).

    Endpoint
    GET https://pythbots.com/api/mail.php?personal
    key=$personalkey&readall

    What it does
    Returns your entire mail history, including both read and unread messages.

    Parameters

  • personalkey (required) — Your personal key

  • readall (flag) — Include exactly like &readall
  • Example
    https://pythbots.com/api/mail.php?personalkey=YOURKEY&readall

    Notes

    - All endpoints return JSON
  • URL parameters must be URL-encoded

  • Avoid sending too many requests too fast to prevent rate limiting

  • Keep your personal key private — it grants access to your mail