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 C# SDK is automatically generated by the OpenAPI Generator project:
- API version: 2.0.0
- SDK version: 1.0.0
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
This generator should support all current LTS versions of Unity
- Unity 2020.3 (LTS) and up
- .NET Standard 2.1 / .NET Framework
- Newtonsoft.Json - 3.0.2 or later
- Unity Test Framework - 1.1.33 or later
Add the dependencies to Packages/manifest.json
{
"dependencies": {
...
"com.unity.nuget.newtonsoft-json": "3.0.2",
"com.unity.test-framework": "1.1.33",
}
}
Then use the namespaces:
using SpaceTradersUnitySDK.Api;
using SpaceTradersUnitySDK.Client;
using SpaceTradersUnitySDK.Model;using System;
using System.Collections.Generic;
using UnityEngine;
using SpaceTradersUnitySDK.Api;
using SpaceTradersUnitySDK.Client;
using SpaceTradersUnitySDK.Model;
namespace SpaceTradersUnitySDKExample
{
public class GetAgentExample : MonoBehaviour
{
async void Start()
{
Configuration config = new Configuration();
config.BasePath = "https://api.spacetraders.io/v2";
// Configure Bearer token for authorization: AgentToken
config.AccessToken = "YOUR_BEARER_TOKEN";
var apiInstance = new AgentsApi(config);
var agentSymbol = "\"FEBA66\""; // string | The agent symbol (default to "FEBA66")
try
{
// Get Public Agent
GetMyAgent200Response result = await apiInstance.GetAgentAsync(agentSymbol);
Debug.Log(result);
Debug.Log("Done!");
}
catch (ApiException e)
{
Debug.LogError("Exception when calling AgentsApi.GetAgent: " + e.Message );
Debug.LogError("Status Code: "+ e.ErrorCode);
Debug.LogError(e.StackTrace);
}
}
}
}All URIs are relative to https://api.spacetraders.io/v2
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AgentsApi | GetAgent | GET /agents/{agentSymbol} | Get Public Agent |
| AgentsApi | GetAgents | GET /agents | List Agents |
| AgentsApi | GetMyAgent | GET /my/agent | Get Agent |
| ContractsApi | AcceptContract | POST /my/contracts/{contractId}/accept | Accept Contract |
| ContractsApi | DeliverContract | POST /my/contracts/{contractId}/deliver | Deliver Cargo to 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 | ExtractResourcesWithSurvey | POST /my/ships/{shipSymbol}/extract/survey | Extract Resources with Survey |
| 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 | GetRepairShip | GET /my/ships/{shipSymbol}/repair | Get Repair Ship |
| FleetApi | GetScrapShip | GET /my/ships/{shipSymbol}/scrap | Get Scrap Ship |
| 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 | RepairShip | POST /my/ships/{shipSymbol}/repair | Repair Ship |
| FleetApi | ScrapShip | POST /my/ships/{shipSymbol}/scrap | Scrap Ship |
| FleetApi | SellCargo | POST /my/ships/{shipSymbol}/sell | Sell Cargo |
| FleetApi | ShipRefine | POST /my/ships/{shipSymbol}/refine | Ship Refine |
| FleetApi | SiphonResources | POST /my/ships/{shipSymbol}/siphon | Siphon Resources |
| FleetApi | TransferCargo | POST /my/ships/{shipSymbol}/transfer | Transfer Cargo |
| FleetApi | WarpShip | POST /my/ships/{shipSymbol}/warp | Warp Ship |
| SystemsApi | GetConstruction | GET /systems/{systemSymbol}/waypoints/{waypointSymbol}/construction | Get Construction Site |
| 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 in System |
| SystemsApi | GetSystems | GET /systems | List Systems |
| SystemsApi | GetWaypoint | GET /systems/{systemSymbol}/waypoints/{waypointSymbol} | Get Waypoint |
| SystemsApi | SupplyConstruction | POST /systems/{systemSymbol}/waypoints/{waypointSymbol}/construction/supply | Supply Construction Site |
- Model.AcceptContract200Response
- Model.AcceptContract200ResponseData
- Model.ActivityLevel
- Model.Agent
- Model.Chart
- Model.Construction
- Model.ConstructionMaterial
- Model.Contract
- Model.ContractDeliverGood
- Model.ContractPayment
- Model.ContractTerms
- Model.Cooldown
- Model.CreateChart201Response
- Model.CreateChart201ResponseData
- Model.CreateShipShipScan201Response
- Model.CreateShipShipScan201ResponseData
- Model.CreateShipSystemScan201Response
- Model.CreateShipSystemScan201ResponseData
- Model.CreateShipWaypointScan201Response
- Model.CreateShipWaypointScan201ResponseData
- Model.CreateSurvey201Response
- Model.CreateSurvey201ResponseData
- Model.DeliverContract200Response
- Model.DeliverContract200ResponseData
- Model.DeliverContractRequest
- Model.DockShip200Response
- Model.ExtractResources201Response
- Model.ExtractResources201ResponseData
- Model.ExtractResources201ResponseDataEventsInner
- Model.ExtractResourcesRequest
- Model.Extraction
- Model.ExtractionYield
- Model.Faction
- Model.FactionSymbol
- Model.FactionTrait
- Model.FactionTraitSymbol
- Model.FulfillContract200Response
- Model.GetAgents200Response
- Model.GetConstruction200Response
- Model.GetContract200Response
- Model.GetContracts200Response
- Model.GetFaction200Response
- Model.GetFactions200Response
- Model.GetJumpGate200Response
- Model.GetMarket200Response
- Model.GetMounts200Response
- Model.GetMyAgent200Response
- Model.GetMyShip200Response
- Model.GetMyShipCargo200Response
- Model.GetMyShips200Response
- Model.GetRepairShip200Response
- Model.GetRepairShip200ResponseData
- Model.GetScrapShip200Response
- Model.GetScrapShip200ResponseData
- Model.GetShipCooldown200Response
- Model.GetShipNav200Response
- Model.GetShipyard200Response
- Model.GetStatus200Response
- Model.GetStatus200ResponseAnnouncementsInner
- Model.GetStatus200ResponseLeaderboards
- Model.GetStatus200ResponseLeaderboardsMostCreditsInner
- Model.GetStatus200ResponseLeaderboardsMostSubmittedChartsInner
- Model.GetStatus200ResponseLinksInner
- Model.GetStatus200ResponseServerResets
- Model.GetStatus200ResponseStats
- Model.GetSystem200Response
- Model.GetSystemWaypoints200Response
- Model.GetSystemWaypointsTraitsParameter
- Model.GetSystems200Response
- Model.GetWaypoint200Response
- Model.InstallMount201Response
- Model.InstallMount201ResponseData
- Model.InstallMountRequest
- Model.Jettison200Response
- Model.Jettison200ResponseData
- Model.JettisonRequest
- Model.JumpGate
- Model.JumpShip200Response
- Model.JumpShip200ResponseData
- Model.JumpShipRequest
- Model.Market
- Model.MarketTradeGood
- Model.MarketTransaction
- Model.Meta
- Model.NavigateShip200Response
- Model.NavigateShip200ResponseData
- Model.NavigateShipRequest
- Model.NegotiateContract200Response
- Model.NegotiateContract200ResponseData
- Model.OrbitShip200Response
- Model.OrbitShip200ResponseData
- Model.PatchShipNavRequest
- Model.PurchaseCargo201Response
- Model.PurchaseCargoRequest
- Model.PurchaseShip201Response
- Model.PurchaseShip201ResponseData
- Model.PurchaseShipRequest
- Model.RefuelShip200Response
- Model.RefuelShip200ResponseData
- Model.RefuelShipRequest
- Model.Register201Response
- Model.Register201ResponseData
- Model.RegisterRequest
- Model.RemoveMount201Response
- Model.RemoveMount201ResponseData
- Model.RemoveMountRequest
- Model.RepairShip200Response
- Model.RepairShip200ResponseData
- Model.RepairTransaction
- Model.ScannedShip
- Model.ScannedShipEngine
- Model.ScannedShipFrame
- Model.ScannedShipMountsInner
- Model.ScannedShipReactor
- Model.ScannedSystem
- Model.ScannedWaypoint
- Model.ScrapShip200Response
- Model.ScrapShip200ResponseData
- Model.ScrapTransaction
- Model.SellCargo201Response
- Model.SellCargo201ResponseData
- Model.SellCargoRequest
- Model.Ship
- Model.ShipCargo
- Model.ShipCargoItem
- Model.ShipConditionEvent
- Model.ShipCrew
- Model.ShipEngine
- Model.ShipFrame
- Model.ShipFuel
- Model.ShipFuelConsumed
- Model.ShipModificationTransaction
- Model.ShipModule
- Model.ShipMount
- Model.ShipNav
- Model.ShipNavFlightMode
- Model.ShipNavRoute
- Model.ShipNavRouteWaypoint
- Model.ShipNavStatus
- Model.ShipReactor
- Model.ShipRefine201Response
- Model.ShipRefine201ResponseData
- Model.ShipRefine201ResponseDataProducedInner
- Model.ShipRefineRequest
- Model.ShipRegistration
- Model.ShipRequirements
- Model.ShipRole
- Model.ShipType
- Model.Shipyard
- Model.ShipyardShip
- Model.ShipyardShipCrew
- Model.ShipyardShipTypesInner
- Model.ShipyardTransaction
- Model.Siphon
- Model.SiphonResources201Response
- Model.SiphonResources201ResponseData
- Model.SiphonYield
- Model.SupplyConstruction201Response
- Model.SupplyConstruction201ResponseData
- Model.SupplyConstructionRequest
- Model.SupplyLevel
- Model.Survey
- Model.SurveyDeposit
- Model.System
- Model.SystemFaction
- Model.SystemType
- Model.SystemWaypoint
- Model.TradeGood
- Model.TradeSymbol
- Model.TransferCargo200Response
- Model.TransferCargoRequest
- Model.WarpShip200Response
- Model.WarpShip200ResponseData
- Model.Waypoint
- Model.WaypointFaction
- Model.WaypointModifier
- Model.WaypointModifierSymbol
- Model.WaypointOrbital
- Model.WaypointTrait
- Model.WaypointTraitSymbol
- Model.WaypointType
Authentication schemes defined for the API:
- Type: Bearer Authentication