SpaceTraders API
-
API version: 2.0.0
-
Build date: 2023-06-05T09:25:51.979579Z[Etc/UTC]
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.
Automatically generated by the OpenAPI Generator
Building the API client library requires:
- Java 1.8+
- Maven/Gradle
To install the API client library to your local Maven repository, simply execute:
mvn clean install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deploy
Refer to the OSSRH Guide for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>de.elbosso.spacetraders</groupId>
<artifactId>openapi-generator-api-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
Add this dependency to your project's build file:
repositories {
mavenCentral() // Needed if the 'openapi-generator-api-client' jar has been published to maven central.
mavenLocal() // Needed if the 'openapi-generator-api-client' jar has been published to the local maven repo.
}
dependencies {
implementation "de.elbosso.spacetraders:openapi-generator-api-client:0.0.1-SNAPSHOT"
}
At first generate the JAR by executing:
mvn clean package
Then manually install the following JARs:
target/openapi-generator-api-client-0.0.1-SNAPSHOT.jar
target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
import de.elbosso.spacetraders.client.invoker.*;
import de.elbosso.spacetraders.client.invoker.auth.*;
import de.elbosso.spacetraders.client.model.*;
import de.elbosso.spacetraders.client.api.AgentsApi;
public class AgentsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.spacetraders.io/v2");
// Configure HTTP bearer authorization: AgentToken
HttpBearerAuth AgentToken = (HttpBearerAuth) defaultClient.getAuthentication("AgentToken");
AgentToken.setBearerToken("BEARER TOKEN");
AgentsApi apiInstance = new AgentsApi(defaultClient);
try {
GetMyAgent200Response result = apiInstance.getMyAgent();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AgentsApi#getMyAgent");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
All URIs are relative to https://api.spacetraders.io/v2
Class | Method | HTTP request | Description |
---|---|---|---|
AgentsApi | getMyAgent | GET /my/agent | My Agent Details |
ContractsApi | acceptContract | POST /my/contracts/{contractId}/accept | Accept Contract |
ContractsApi | deliverContract | POST /my/contracts/{contractId}/deliver | Deliver Contract |
ContractsApi | fulfillContract | POST /my/contracts/{contractId}/fulfill | Fulfill Contract |
ContractsApi | getContract | GET /my/contracts/{contractId} | Get Contract |
ContractsApi | getContracts | GET /my/contracts | List Contracts |
DefaultApi | getStatus | GET / | Get Status |
DefaultApi | register | POST /register | Register New Agent |
FactionsApi | getFaction | GET /factions/{factionSymbol} | Get Faction |
FactionsApi | getFactions | GET /factions | List Factions |
FleetApi | createChart | POST /my/ships/{shipSymbol}/chart | Create Chart |
FleetApi | createShipShipScan | POST /my/ships/{shipSymbol}/scan/ships | Scan Ships |
FleetApi | createShipSystemScan | POST /my/ships/{shipSymbol}/scan/systems | Scan Systems |
FleetApi | createShipWaypointScan | POST /my/ships/{shipSymbol}/scan/waypoints | Scan Waypoints |
FleetApi | createSurvey | POST /my/ships/{shipSymbol}/survey | Create Survey |
FleetApi | dockShip | POST /my/ships/{shipSymbol}/dock | Dock Ship |
FleetApi | extractResources | POST /my/ships/{shipSymbol}/extract | Extract Resources |
FleetApi | getMounts | GET /my/ships/{shipSymbol}/mounts | Get Mounts |
FleetApi | getMyShip | GET /my/ships/{shipSymbol} | Get Ship |
FleetApi | getMyShipCargo | GET /my/ships/{shipSymbol}/cargo | Get Ship Cargo |
FleetApi | getMyShips | GET /my/ships | List Ships |
FleetApi | getShipCooldown | GET /my/ships/{shipSymbol}/cooldown | Get Ship Cooldown |
FleetApi | getShipNav | GET /my/ships/{shipSymbol}/nav | Get Ship Nav |
FleetApi | installMount | POST /my/ships/{shipSymbol}/mounts/install | Install Mount |
FleetApi | jettison | POST /my/ships/{shipSymbol}/jettison | Jettison Cargo |
FleetApi | jumpShip | POST /my/ships/{shipSymbol}/jump | Jump Ship |
FleetApi | navigateShip | POST /my/ships/{shipSymbol}/navigate | Navigate Ship |
FleetApi | negotiateContract | POST /my/ships/{shipSymbol}/negotiate/contract | Negotiate Contract |
FleetApi | orbitShip | POST /my/ships/{shipSymbol}/orbit | Orbit Ship |
FleetApi | patchShipNav | PATCH /my/ships/{shipSymbol}/nav | Patch Ship Nav |
FleetApi | purchaseCargo | POST /my/ships/{shipSymbol}/purchase | Purchase Cargo |
FleetApi | purchaseShip | POST /my/ships | Purchase Ship |
FleetApi | refuelShip | POST /my/ships/{shipSymbol}/refuel | Refuel Ship |
FleetApi | removeMount | POST /my/ships/{shipSymbol}/mounts/remove | Remove Mount |
FleetApi | sellCargo | POST /my/ships/{shipSymbol}/sell | Sell Cargo |
FleetApi | shipRefine | POST /my/ships/{shipSymbol}/refine | Ship Refine |
FleetApi | transferCargo | POST /my/ships/{shipSymbol}/transfer | Transfer Cargo |
FleetApi | warpShip | POST /my/ships/{shipSymbol}/warp | Warp Ship |
SystemsApi | getJumpGate | GET /systems/{systemSymbol}/waypoints/{waypointSymbol}/jump-gate | Get Jump Gate |
SystemsApi | getMarket | GET /systems/{systemSymbol}/waypoints/{waypointSymbol}/market | Get Market |
SystemsApi | getShipyard | GET /systems/{systemSymbol}/waypoints/{waypointSymbol}/shipyard | Get Shipyard |
SystemsApi | getSystem | GET /systems/{systemSymbol} | Get System |
SystemsApi | getSystemWaypoints | GET /systems/{systemSymbol}/waypoints | List Waypoints |
SystemsApi | getSystems | GET /systems | List Systems |
SystemsApi | getWaypoint | GET /systems/{systemSymbol}/waypoints/{waypointSymbol} | Get Waypoint |
- AcceptContract200Response
- AcceptContract200ResponseData
- Agent
- Chart
- ConnectedSystem
- 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
- FactionTrait
- FulfillContract200Response
- GetContract200Response
- GetContracts200Response
- GetFaction200Response
- GetFactions200Response
- GetJumpGate200Response
- GetMarket200Response
- GetMounts200Response
- GetMyAgent200Response
- GetMyShip200Response
- GetMyShipCargo200Response
- GetMyShips200Response
- GetShipCooldown200Response
- GetShipNav200Response
- GetShipyard200Response
- GetStatus200Response
- GetStatus200ResponseAnnouncementsInner
- GetStatus200ResponseLeaderboards
- GetStatus200ResponseLeaderboardsMostCreditsInner
- GetStatus200ResponseLeaderboardsMostSubmittedChartsInner
- GetStatus200ResponseLinksInner
- GetStatus200ResponseServerResets
- GetStatus200ResponseStats
- GetSystem200Response
- GetSystemWaypoints200Response
- GetSystems200Response
- GetWaypoint200Response
- InstallMount201Response
- InstallMount201ResponseData
- InstallMount201ResponseDataTransaction
- 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
- Register201Response
- Register201ResponseData
- RegisterRequest
- RemoveMount201Response
- RemoveMountRequest
- ScannedShip
- ScannedShipEngine
- ScannedShipFrame
- ScannedShipMountsInner
- ScannedShipReactor
- ScannedSystem
- ScannedWaypoint
- SellCargo201Response
- SellCargo201ResponseData
- SellCargoRequest
- Ship
- ShipCargo
- ShipCargoItem
- ShipCrew
- ShipEngine
- ShipFrame
- ShipFuel
- ShipFuelConsumed
- ShipModule
- ShipMount
- ShipNav
- ShipNavFlightMode
- ShipNavRoute
- ShipNavRouteWaypoint
- ShipNavStatus
- ShipReactor
- ShipRefine200Response
- ShipRefine200ResponseData
- ShipRefine200ResponseDataProducedInner
- ShipRefineRequest
- ShipRegistration
- ShipRequirements
- ShipRole
- ShipType
- Shipyard
- ShipyardShip
- ShipyardShipTypesInner
- ShipyardTransaction
- Survey
- SurveyDeposit
- System
- SystemFaction
- SystemType
- SystemWaypoint
- TradeGood
- TradeSymbol
- TransferCargo200Response
- TransferCargoRequest
- Waypoint
- WaypointFaction
- WaypointOrbital
- WaypointTrait
- WaypointType
Authentication schemes defined for the API:
- Type: HTTP Bearer Token authentication
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.