Skip to main content

AmongAPI

PyPi Project AmongAPI

AmongAPI is an Open-Source Python library for AmongBot, it wraps the Innersloth API and implements the Hazel Game Protocol, so the bot can verify players, join lobbies, read chat, and track game states

Features

  • Token Verification: validate Among Us Account tokens via the official Innersloth API
  • Public Profiles: look up any player by their PUID
  • Lobby Verification: Join Private lobbies using the Hazel Protocol, read lobby chat, and confirm Discord usernames
  • Game Tracking: Checks Game Phases (lobby / tasks / discussion / voting) and player states (alive / dead) for Automute

How to Contribute

Contributions are very welcomed, and we love your help :3, just fork the repoistory and make new branch and make your changes, then open a pull request

Installation

pip install amongapi

Requirements: Python 3.8+, 'requests', 'aiohttp'

Examples

Token Verification

# note: if you're using VPN, disable it, sometimes innersloth api rejects requests from VPN IP
from amongapi import verify_token

# proxies = {'http': 'http://user:pass@ip:port', 'https': 'http://user:pass@ip:port'} (optional)
result = verify_token('your token here') # if you added proxies then rewrite this line to = result = verify_token('your token here', proxies=proxies)

if result.valid:
  print(result.name, result.level, result.puid, result.friend_code, result.platform)
else:
  print('Failed:', result.error)

Friend Requests

# note: if you're using VPN, disable it, sometimes innersloth api rejects requests from VPN IP
from amongapi import send_friend_request

success = send_friend_request('your token', 'target player PUID') # note that api/v1/friendlist requires the target's player PUID and not the friend code like lotkilted#5441, the PUID looks like: apple-orange-banana, its the same as discord ID, and only avaliable method to get your PUID, is to verify with your token

if success:
  print('Friend request sent')

Public Profile Lookup

# note: if you're using VPN, disable it, sometimes innersloth api rejects requests from VPN IP
from amongapi import get_public_profile

profile = get_public_profile('put puid here')
if profile:
  print(profile['name'], profile['level'])

Lobby Verification

import asyncio
from amongapi import lobbyValidator

async def verify_with_lobby():
  validator = lobbyValidator(region='North America') # you can put 'Europe', 'Asia', 'North America'
  try:
    await validator.connect()
    joined = await validator.join_lobby('AMOBOT') # lobby code 
    if joined:
      found = await validator.wait_for_chat_message('DiscordUsername', timeout=30.0)
    if found:
      print('User Verified Successfully yipeeeeee :3')
  finally:
    await validator.close()

asyncio.run(verify_with_lobby())

Game Tracking (AutoMute)

# note: if you're using VPN, disable it, sometimes innersloth api rejects requests from VPN IP
import asyncio
from amongapi import gameTracker

async def track_game():
  tracker = gameTracker(region='North America') # options: 'Europe', 'Asia', 'North America'
  try:
    await tracker.connect()
    if await tracker.join_lobby('AMOBOT'):
      while True:
        print('Phase:', tracker.phase)
        for p in tracker.get_players_snapshot():
          print(f"  {p['name']}: {'alive' if p['is_alive'] else 'dead'}")
        await asyncio.sleep(2)
  finally:
    await tracker.close()

asyncio.run(track_game())

How the Hazel Protocol is used

the amongapi/client.py module contains a custom UDP Client that speaks Hazel, the networking protocol used by Among Us, it is a full self.contained implemenation written from scratch, no external game libraries required

What it does

  • Connects to the region master servers (Asia, Europe, North America)
  • Receives a redirect to a game server
  • Sends a join request with a lobby code
  • Parses incoming packets to extract:
    • Game State: lobby, tasks, discussion, voting
    • Player Info: name, level, alive/dead status, color
    • Chat messages: text message sent by players

This client is used internally by:

  • lobbyValidator: to join a lobby and read chat for verification
  • gameTracker: to continuously check game phases and player states for AutoMute

**Because the protocol is built into the library, the bot can join Among Us Lobbies and interact with the game just like a normal player

Innersloth API Guide (Endpoints)

Endpoint Method Auth Required Description
/api/v1/user GET Yes returns the authenticated user account info (name, level, PUID, friend code, platform, cosmetics)
/api/v1/friendlist GET Yes returns the authenticated user friend list
/api/v1/friendlist POST Yes sends a friend request to another player by their PUID
/api/v1/player/public/{puid} GET No gets a player's public profile (name, level, cosmetics) without authentication
/api/v1/account GET Yes returns account details similar to /user
/api/v1/account/link POST Yes links an external platform (Steam, Mobile, XBOX, more...) to the Innersloth account
/api/v1/active-games GET Unknown return a list of active games
/api/v1/chat GET/POST Unknown related to the game chat

How each Endpoint Works

Endpoint Used by AmongAPI What it Does
GET /api/v1/user verify_token() validates an account token and returns the user name, level, PUID, friend code, platform, and cosmetics, if the token is invalid/expired, returns 401, if the account is banned, returns 403
POST /api/v1/friendlist send_friend_request() send a friend request to the player identified by the PUID in the request body, requires a valid token from the sender, returns 200 on success
GET /api/v1/player/public/{puid} get_public_profile() returns public profile info for any player, no authentication required, useful for looking up a player name and level without having their token
GET /api/v1/friendlist not added in amongapi returns the list of friend for the authenticated user, may be added in the future updates

About

  • Made by Rawan :3
  • Made for AmongBot

Metadata

Release files for amongapi 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amongapi 1.1.3
File Size Uploaded Provenance Actions
amongapi-1.1.3.tar.gz 11.8 kB Without provenance Details for amongapi-1.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for amongapi 1.1.3
File Interpreter ABI Platform Actions
amongapi-1.1.3-py3-none-any.whl Python 3 none any Details for amongapi-1.1.3-py3-none-any.whl

Total release size: 22.4 kB

Release files / amongapi-1.1.3.tar.gz

Download URL amongapi-1.1.3.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bd84cd75b642c1a9ebf4ada5af22dce0cd4b10e0c9ea76ded31b36883fc480ad
BLAKE2b-256 checksum
How to use checksums
fa3848de6ca5958998907d1191fb9c2b14b4c8dc17e219eae96c7d5d4b1aa5be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / amongapi-1.1.3-py3-none-any.whl

Download URL amongapi-1.1.3-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7c3d1bd953312fa15930d7fcedb064cfe8686100f01727d774314b2d4923082
BLAKE2b-256 checksum
How to use checksums
3424d04e8cb3058b646a8eb6d7a125d6819cb62338852554919caf9b4fed0846
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Security for amongapi 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page