This Python package provides a client for interacting with the Satisfactory Dedicated Server API. The client allows for managing various aspects of the server, including querying server state, logging in, adjusting game settings, handling save files, and issuing administrative commands.
- Perform health checks on the server
- Log in with or without a password to obtain an authentication token
- Query and modify server state and options
- Manage advanced game settings
- Create, load, save, and delete game sessions
- Set client and admin passwords
- Run server commands and shut down the server
To install this package, use:
pip install satisfactory-api-client- Python 3.10+
requestslibrary
The SatisfactoryAPI class is the main entry point for interacting with the server API.
from satisfactory_api_client import SatisfactoryAPI
# Initialize the API client
api = SatisfactoryAPI(host='your-server-ip')
# You can also specify a custom port
api = SatisfactoryAPI(host='your-server-ip', port=15000)
# You can also give a token directly without login
api = SatisfactoryAPI(host='your-server-ip', auth_token='your-token')You can log in to the server using passwordless or password-based methods.
from satisfactory_api_client.data import MinimumPrivilegeLevel
# Passwordless login
response = api.passwordless_login(MinimumPrivilegeLevel.ADMINISTRATOR)
# Password login
response = api.password_login(MinimumPrivilegeLevel.ADMINISTRATOR, password='your-admin-password')
# You can check if the token is valid by
response = api.verify_authentication_token()
print(response.data)The MinimumPrivilegeLevel enum is used to specify the type of token you want to obtain. The following levels are available:
- NOT_AUTHENTICATED
- CLIENT
- ADMINISTRATOR
- INITIAL_ADMIN
- API_TOKEN
To verify that the server is running and responsive, you can perform a health check. This will return the server's current state. You dont need a token to perform a health check.
response = api.health_check()
print(response.data)You can query the server's current state. This return information about the server and the current game session.
# Get server state
response = api.query_server_state()
print(response.data)You can query the server's current options and apply new ones:
# Get server options
response = api.get_server_options()
print(response.data)
# Apply new server options
new_options = {"server_name": "New Server Name"}
response = api.apply_server_options(new_options)Fetch and apply advanced game settings:
from satisfactory_api_client.data import AdvancedGameSettings
# Get advanced game settings
response = api.get_advanced_game_settings()
print(response.data)
# Apply advanced game settings
new_settings = AdvancedGameSettings(your_custom_settings)
response = api.apply_advanced_game_settings(new_settings)You can create, load, save, and delete game sessions. The NewGameData class is used to specify the parameters for creating a new game.
from satisfactory_api_client.data import NewGameData
# Create a new game
new_game_data = NewGameData(save_name="MyNewGame", ...)
response = api.create_new_game(new_game_data)
# Load a saved game
response = api.load_game("MySaveGame")
# Save the current game
response = api.save_game("MySaveGame")
# Delete a save file
response = api.delete_save_file("MySaveGame")You can run commands on the server or shut it down using the API. The run_command method is used to execute a server command. The shutdown method is used to shut down the server.
# Run a server command
response = api.run_command("SomeCommand")
# Shutdown the server
response = api.shutdown()passwordless_login(minimum_privilege_level: MinimumPrivilegeLevel): Log in without a password to obtain a token that is automatically saved.password_login(minimum_privilege_level: MinimumPrivilegeLevel, password: str): Log in using a password to obtain a token that is automatically saved.verify_authentication_token(): Verify that the current token is valid.
health_check(client_custom_data: str = ''): Perform a health check on the server. This will return the server's current state.query_server_state(): Query the server's current state. This includes information about the server and the current game session.shutdown(): Shut down the server. This will stop the server process.
create_new_game(game_data: NewGameData): Create a new game session. This will start a new game with the specified settings.load_game(save_name: str, enable_advanced_game_settings: bool = False): Load a saved game. This will load a previously saved game session.save_game(save_name: str): Save the current game session. This will save the current game state to a file.delete_save_file(save_name: str): Delete a saved game. This will delete a previously saved game session.enumerate_sessions(): List all available game sessions. This will return a list of saved game sessions.
get_server_options(): Get current server settings. This includes the server name, description, and other options.apply_server_options(options: ServerOptions): Apply new server settings. This will update the server options with the specified values.get_advanced_game_settings(): Get advanced game settings. This includes settings such as resource settings, enemy settings, and other advanced options.apply_advanced_game_settings(settings: AdvancedGameSettings): Apply new advanced game settings. This will update the advanced game settings with the specified values.
run_command(command: str): Run a server command. This will execute the specified command on the server.
Errors returned by the API will raise an APIError exception, which contains the error message from the server. You can catch and handle these errors in your code. For example:
try:
response = api.some_method()
except APIError as e:
print(f"Error: {e}")Contributions are welcome! If you find a bug or have a feature request, please create an issue on the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for details.
This package is not affiliated with or endorsed by Coffee Stain Studios. Satisfactory is a trademark of Coffee Stain Studios AB.