Revision as of 00:14, 17 October 2020 by Tiran (talk | contribs) (Undo revision 5392 by Tiran (talk))


From Tycoon Gaming

Transport Tycoon API

Root API URI is the servers address

API is available per server instance

API Keys

TL;DR: Create a new key using /api key new

Add charges using /api key refill (adds 1000 charges for $1M)

The API requires an API Key to access most features.

Each key has a limited amount of API calls (also called charges), which is consumed every time an API call is made using the key.

Additional charges can be purchased in-game using the /api key refill command at the cost of $1000 (in-game money) per charge.

Any user can generate an API key, this key is said users private key.

To generate a key, use the /api key new command in-game.

If you already have a key generated, the old one will be deleted and a new one takes its place.

When you generate a key for the first time, it will come with some free charges allowing you to test the API for free.

The API Key can be copied using the /api key copy command. (This will show your key on screen!)

For developers

The API Key must be placed as an `X-Tycoon-Key` header.

Key Related Endpoints

/charges.json Returns the amount of charges left (does not cost charges to check)


type name (data type and a property name)
type? name (data type may vary based on data context)
type! name (data might not exist based on data context)

Note: Array data types do not contain named properties, the names used here are for clarifiation

Get world information for online players

Returns a list of all online players with positional data.

Their current mode of transportation and some other details are also included.

This endpoint is used to produce the servers livemap.

GET /status/map/positions.json
- int time
- array[array player] data
-- string name
-- int source
-- int user_id
-- vec3 position
-- object owned_vehicles
--- object[string vehicle_type]!
---- string vehicle_spawn
-- object vehicle
--- int vehicle_class
--- string vehicle_type
--- int! model
--- string! vehicle_label
--- string! vehicle_name
--- bool? has_trailer
--- string! trailer
--- string! vehicle_spawn
-- object job
--- string group
--- string name

Get server details and online players

Returns the servers name and details, as well as data for every player online.

This endpoint is used to produce the server list:

GET /status/widget/players.json
- object server
-- string name
-- string motd
-- string number
-- string region
-- string beta
-- string uptime
-- int limit
- array[array player] players
-- string name
-- int source
-- int user_id
-- string? avatar
-- bool staff
-- string job_name
-- bool whitelist

Get Online Players

Returns a list of online players

GET /status/players.json
array players
- string name
- int? source
- int user_id

Airline Routes

Returns the active Airline Pilot routes on the server

GET /status/airline.json
- object[string player] player
-- string plane
-- object destination
--- float x
--- float y
--- float z
--- float h
--- string airport
--- string name
-- bool atTerminal

Get resource configurations

This can be used to easily get vector data for routes etc. in certain jobs Not all resources have viewable configs

GET /status/config/[resource]
returns a raw .lua file dump

Top10 Stats

Returns a list of the top 10 for the stat in descending order.
Note: Usernames are kinda unreliable so likely theyll be malformed or include invalid characters.

Some valid stats:

GET /status/top10/[stat]
-array top
-- int user_id
-- string user_name
-- int stat_count