Skip to main content

This is a simple Palworld REST API Wrapper + CLI written in python.

Project description

Palworld REST API

PyPI version Python Versions

A modern, fast, and fully-typed Python client library and CLI wrapper for the official Palworld Dedicated Server REST API. Built on httpx to provide first-class support for both synchronous scripts and high-performance asynchronous applications.

Features

  • Dual Clients: Contains both PalworldClient (sync) and AsyncPalworldClient (async) using connection pooling for maximum performance.
  • Strict Typing: Fully typed with PEP 561 compliance. API responses are parsed into rigorous Python Dataclasses for safety and excellent IDE autocomplete.
  • CLI Included: Manage your Palworld server directly from your terminal using the built-in palworld-cli.
  • Modern: Formatted with ruff, built with hatchling, and rigorously tested.

Installation

You can install the package directly from PyPI:

pip install palworld-restapi

(Or use uv add palworld-restapi if you are using uv)


Quickstart

Async Client (Recommended for Bots / Web Apps)

import asyncio
from palworld_restapi import AsyncPalworldClient

async def main():
    async with AsyncPalworldClient("http://127.0.0.1:8212", password="admin-password") as client:
        info = await client.get_info()
        print(f"Connected to {info.servername} (v{info.version})")
        
        # Announce a message to the server
        await client.announce("Hello from Python!")

if __name__ == "__main__":
    asyncio.run(main())

Sync Client (Recommended for simple scripts)

from palworld_restapi import PalworldClient

with PalworldClient("http://127.0.0.1:8212", password="admin-password") as client:
    players_resp = client.get_players()
    print(f"There are currently {len(players_resp.players)} players online.")

Command Line Interface (CLI)

The package ships with a built-in CLI to easily manage your server without writing code. It supports loading credentials from .env files automatically.

# Get server info
palworld-cli info

# See online players
palworld-cli players

# Kick a player by Steam ID
palworld-cli kick steam_00000000000000000 --message "AFK too long"

# Shut the server down in 60 seconds
palworld-cli shutdown 60 --message "Restarting for an update!"

Documentation & Examples

For full details, please refer to the documentation:

We also have a full suite of working scripts in the examples/ directory demonstrating kick/ban management, player tracking, and server metrics.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

palworld_restapi-1.0.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

palworld_restapi-1.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file palworld_restapi-1.0.0.tar.gz.

File metadata

  • Download URL: palworld_restapi-1.0.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for palworld_restapi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6619d6f45abc676cb6c0fa2dc6bcd8b1ad8e2a1d87ee211bbdba5d72575347aa
MD5 554de5c668609e5635ddcb48b0eb7ea8
BLAKE2b-256 083ed1367b2be21c87e7f6c51e2c22e6b27728c501dd12491e4d878913723d98

See more details on using hashes here.

Provenance

The following attestation bundles were made for palworld_restapi-1.0.0.tar.gz:

Publisher: publish.yml on Palworld-RESTAPI/Palworld-RESTAPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file palworld_restapi-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for palworld_restapi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c063bbad3fe3942cb4ba832733ad6e530a6f7b7a43e21d5848d84df62b6b678
MD5 2194cc97518e9344a4406764e3b46342
BLAKE2b-256 22b62153decc4013450a56ae6f2120a0f7063794ac01c69f9fadca3d5b0dcd43

See more details on using hashes here.

Provenance

The following attestation bundles were made for palworld_restapi-1.0.0-py3-none-any.whl:

Publisher: publish.yml on Palworld-RESTAPI/Palworld-RESTAPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page