Skip to content

Instantly share code, notes, and snippets.

@scratchminer
Last active July 8, 2024 05:57
Show Gist options
  • Save scratchminer/72a030aaa86dd75658b190f675e8fe6b to your computer and use it in GitHub Desktop.
Save scratchminer/72a030aaa86dd75658b190f675e8fe6b to your computer and use it in GitHub Desktop.
Unofficial documentation for the TIC-80 HTTP API.

TIC-80 API documentation

Note: The host for all API requests is https://tic80.com.


GET /api/

Used for update checking and the surf utility.

Query parameters:

  • Required: fn:
    • dir, which will return the listing of a surf directory as a Listing.
    • version, which will return the latest TIC-80 release available as a Version.
  • path: If fn is dir, directory path to list (Unix separators, no leading slash).

GET /json/

Like /api/, but returns JSON instead of Lua tables. Used in more modern versions of TIC-80 (since May 5, 2024).

GET /cart/(hash)/(filename)

Given the hash and filename of a specific cartridge, this will return the cartridge file.

GET /export/(version)/(platform)[language]

This will return the export template file for the specified TIC-80 version, host platform, and cartridge language.

version is one of:

  • 0.90-dev
  • 0.90
  • 1.0-dev
  • 1.0
  • 1.1-dev
  • 1.1

platform is one of:

  • win: Windows EXE (modern)
  • winxp: Windows EXE (XP)
  • linux: Linux binary
  • rpi: Raspberry Pi binary
  • mac: macOS binary (not an app)
  • html: HTML ZIP file (Intstead of being appended to the end, the cartridge is copied to cart.tic in the ZIP)

language is one of:

  • fennel
  • janet (version must be 1.1-dev or later)
  • js
  • lua
  • moon
  • python (version must be 1.1-dev or later)
  • ruby
  • scheme (version must be 1.1-dev or later)
  • squirrel
  • wasm (version must be 1.0-dev or later)
  • wren

If language is missing, the export template will support all TIC-80 languages.


Data structures

Note: All data structures are implemented using either Lua table syntax (for /api/), or JSON syntax (for /json/).

Listing

Key Name Value Type Example Value
folders table of tables See Folder
files table of tables See File

Folder

Key Name Value Type Example Value
name string "Play"

File

Key Name Value Type Example Value
name string "palette demo.tic"
hash string "255730685116b5ceb150867dd96fc200"
id number 1
filename string "palette_demo.tic"

Version

Key Name Value Type Example Value
version string "1.1.2729"
major number 1
minor number 1
patch number 2729

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment