SpaceTraders is an open-universe game and learning platform that offers a set of HTTP endpoints to control a fleet of ships and explore a multiplayer universe.
The API is documented using OpenAPI. You can send your first request right here in your browser to check the status of the game server.
{
\"method\": \"GET\",
\"url\": \"https://api.spacetraders.io/v2\",
}
Unlike a traditional game, SpaceTraders does not have a first-party client or app to play the game. Instead, you can use the API to build your own client, write a script to automate your ships, or try an app built by the community.
We have a Discord channel where you can share your projects, ask questions, and get help from other players.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 2.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 3.7+
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import openapi_client
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import openapi_client
Execute pytest
to run the tests.
Please follow the installation procedure and then run the following:
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.spacetraders.io/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://api.spacetraders.io/v2"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: AgentToken
configuration = openapi_client.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.AgentsApi(api_client)
agent_symbol = 'FEBA66' # str | The agent symbol (default to 'FEBA66')
try:
# Get Public Agent
api_response = api_instance.get_agent(agent_symbol)
print("The response of AgentsApi->get_agent:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling AgentsApi->get_agent: %s\n" % e)
All URIs are relative to https://api.spacetraders.io/v2
Class | Method | HTTP request | Description |
---|---|---|---|
AgentsApi | get_agent | GET /agents/{agentSymbol} | Get Public Agent |
AgentsApi | get_agents | GET /agents | List Agents |
AgentsApi | get_my_agent | GET /my/agent | Get Agent |
ContractsApi | accept_contract | POST /my/contracts/{contractId}/accept | Accept Contract |
ContractsApi | deliver_contract | POST /my/contracts/{contractId}/deliver | Deliver Cargo to Contract |
ContractsApi | fulfill_contract | POST /my/contracts/{contractId}/fulfill | Fulfill Contract |
ContractsApi | get_contract | GET /my/contracts/{contractId} | Get Contract |
ContractsApi | get_contracts | GET /my/contracts | List Contracts |
FactionsApi | get_faction | GET /factions/{factionSymbol} | Get Faction |
FactionsApi | get_factions | GET /factions | List Factions |
FleetApi | create_chart | POST /my/ships/{shipSymbol}/chart | Create Chart |
FleetApi | create_ship_ship_scan | POST /my/ships/{shipSymbol}/scan/ships | Scan Ships |
FleetApi | create_ship_system_scan | POST /my/ships/{shipSymbol}/scan/systems | Scan Systems |
FleetApi | create_ship_waypoint_scan | POST /my/ships/{shipSymbol}/scan/waypoints | Scan Waypoints |
FleetApi | create_survey | POST /my/ships/{shipSymbol}/survey | Create Survey |
FleetApi | dock_ship | POST /my/ships/{shipSymbol}/dock | Dock Ship |
FleetApi | extract_resources | POST /my/ships/{shipSymbol}/extract | Extract Resources |
FleetApi | extract_resources_with_survey | POST /my/ships/{shipSymbol}/extract/survey | Extract Resources with Survey |
FleetApi | get_mounts | GET /my/ships/{shipSymbol}/mounts | Get Mounts |
FleetApi | get_my_ship | GET /my/ships/{shipSymbol} | Get Ship |
FleetApi | get_my_ship_cargo | GET /my/ships/{shipSymbol}/cargo | Get Ship Cargo |
FleetApi | get_my_ships | GET /my/ships | List Ships |
FleetApi | get_ship_cooldown | GET /my/ships/{shipSymbol}/cooldown | Get Ship Cooldown |
FleetApi | get_ship_nav | GET /my/ships/{shipSymbol}/nav | Get Ship Nav |
FleetApi | install_mount | POST /my/ships/{shipSymbol}/mounts/install | Install Mount |
FleetApi | jettison | POST /my/ships/{shipSymbol}/jettison | Jettison Cargo |
FleetApi | jump_ship | POST /my/ships/{shipSymbol}/jump | Jump Ship |
FleetApi | navigate_ship | POST /my/ships/{shipSymbol}/navigate | Navigate Ship |
FleetApi | negotiate_contract | POST /my/ships/{shipSymbol}/negotiate/contract | Negotiate Contract |
FleetApi | orbit_ship | POST /my/ships/{shipSymbol}/orbit | Orbit Ship |
FleetApi | patch_ship_nav | PATCH /my/ships/{shipSymbol}/nav | Patch Ship Nav |
FleetApi | purchase_cargo | POST /my/ships/{shipSymbol}/purchase | Purchase Cargo |
FleetApi | purchase_ship | POST /my/ships | Purchase Ship |
FleetApi | refuel_ship | POST /my/ships/{shipSymbol}/refuel | Refuel Ship |
FleetApi | remove_mount | POST /my/ships/{shipSymbol}/mounts/remove | Remove Mount |
FleetApi | sell_cargo | POST /my/ships/{shipSymbol}/sell | Sell Cargo |
FleetApi | ship_refine | POST /my/ships/{shipSymbol}/refine | Ship Refine |
FleetApi | siphon_resources | POST /my/ships/{shipSymbol}/siphon | Siphon Resources |
FleetApi | transfer_cargo | POST /my/ships/{shipSymbol}/transfer | Transfer Cargo |
FleetApi | warp_ship | POST /my/ships/{shipSymbol}/warp | Warp Ship |
SystemsApi | get_construction | GET /systems/{systemSymbol}/waypoints/{waypointSymbol}/construction | Get Construction Site |
SystemsApi | get_jump_gate | GET /systems/{systemSymbol}/waypoints/{waypointSymbol}/jump-gate | Get Jump Gate |
SystemsApi | get_market | GET /systems/{systemSymbol}/waypoints/{waypointSymbol}/market | Get Market |
SystemsApi | get_shipyard | GET /systems/{systemSymbol}/waypoints/{waypointSymbol}/shipyard | Get Shipyard |
SystemsApi | get_system | GET /systems/{systemSymbol} | Get System |
SystemsApi | get_system_waypoints | GET /systems/{systemSymbol}/waypoints | List Waypoints in System |
SystemsApi | get_systems | GET /systems | List Systems |
SystemsApi | get_waypoint | GET /systems/{systemSymbol}/waypoints/{waypointSymbol} | Get Waypoint |
SystemsApi | supply_construction | POST /systems/{systemSymbol}/waypoints/{waypointSymbol}/construction/supply | Supply Construction Site |
DefaultApi | get_status | GET / | Get Status |
DefaultApi | register | POST /register | Register New Agent |
- AcceptContract200Response
- AcceptContract200ResponseData
- ActivityLevel
- Agent
- Chart
- Construction
- ConstructionMaterial
- Contract
- ContractDeliverGood
- ContractPayment
- ContractTerms
- Cooldown
- CreateChart201Response
- CreateChart201ResponseData
- CreateShipShipScan201Response
- CreateShipShipScan201ResponseData
- CreateShipSystemScan201Response
- CreateShipSystemScan201ResponseData
- CreateShipWaypointScan201Response
- CreateShipWaypointScan201ResponseData
- CreateSurvey201Response
- CreateSurvey201ResponseData
- DeliverContract200Response
- DeliverContract200ResponseData
- DeliverContractRequest
- DockShip200Response
- ExtractResources201Response
- ExtractResources201ResponseData
- ExtractResourcesRequest
- Extraction
- ExtractionYield
- Faction
- FactionSymbol
- FactionTrait
- FactionTraitSymbol
- FulfillContract200Response
- GetAgents200Response
- GetConstruction200Response
- GetContract200Response
- GetContracts200Response
- GetFaction200Response
- GetFactions200Response
- GetJumpGate200Response
- GetMarket200Response
- GetMounts200Response
- GetMyAgent200Response
- GetMyShip200Response
- GetMyShipCargo200Response
- GetMyShips200Response
- GetShipCooldown200Response
- GetShipNav200Response
- GetShipyard200Response
- GetStatus200Response
- GetStatus200ResponseAnnouncementsInner
- GetStatus200ResponseLeaderboards
- GetStatus200ResponseLeaderboardsMostCreditsInner
- GetStatus200ResponseLeaderboardsMostSubmittedChartsInner
- GetStatus200ResponseLinksInner
- GetStatus200ResponseServerResets
- GetStatus200ResponseStats
- GetSystem200Response
- GetSystemWaypoints200Response
- GetSystemWaypointsTraitsParameter
- GetSystems200Response
- GetWaypoint200Response
- InstallMount201Response
- InstallMount201ResponseData
- InstallMountRequest
- Jettison200Response
- Jettison200ResponseData
- JettisonRequest
- JumpGate
- JumpShip200Response
- JumpShip200ResponseData
- JumpShipRequest
- Market
- MarketTradeGood
- MarketTransaction
- Meta
- NavigateShip200Response
- NavigateShip200ResponseData
- NavigateShipRequest
- NegotiateContract200Response
- NegotiateContract200ResponseData
- OrbitShip200Response
- OrbitShip200ResponseData
- PatchShipNavRequest
- PurchaseCargo201Response
- PurchaseCargoRequest
- PurchaseShip201Response
- PurchaseShip201ResponseData
- PurchaseShipRequest
- RefuelShip200Response
- RefuelShip200ResponseData
- RefuelShipRequest
- Register201Response
- Register201ResponseData
- RegisterRequest
- RemoveMount201Response
- RemoveMount201ResponseData
- RemoveMountRequest
- ScannedShip
- ScannedShipEngine
- ScannedShipFrame
- ScannedShipMountsInner
- ScannedShipReactor
- ScannedSystem
- ScannedWaypoint
- SellCargo201Response
- SellCargo201ResponseData
- SellCargoRequest
- Ship
- ShipCargo
- ShipCargoItem
- ShipCrew
- ShipEngine
- ShipFrame
- ShipFuel
- ShipFuelConsumed
- ShipModificationTransaction
- ShipModule
- ShipMount
- ShipNav
- ShipNavFlightMode
- ShipNavRoute
- ShipNavRouteWaypoint
- ShipNavStatus
- ShipReactor
- ShipRefine201Response
- ShipRefine201ResponseData
- ShipRefine201ResponseDataProducedInner
- ShipRefineRequest
- ShipRegistration
- ShipRequirements
- ShipRole
- ShipType
- Shipyard
- ShipyardShip
- ShipyardShipCrew
- ShipyardShipTypesInner
- ShipyardTransaction
- Siphon
- SiphonResources201Response
- SiphonResources201ResponseData
- SiphonYield
- SupplyConstruction201Response
- SupplyConstruction201ResponseData
- SupplyConstructionRequest
- SupplyLevel
- Survey
- SurveyDeposit
- System
- SystemFaction
- SystemType
- SystemWaypoint
- TradeGood
- TradeSymbol
- TransferCargo200Response
- TransferCargoRequest
- Waypoint
- WaypointFaction
- WaypointModifier
- WaypointModifierSymbol
- WaypointOrbital
- WaypointTrait
- WaypointTraitSymbol
- WaypointType
Authentication schemes defined for the API:
- Type: Bearer authentication