S&box Wiki

Backend API

Backend API

This API is prone to changes at any time - and therefore this guide might go out of date. If something doesn't line up, it probably means the API was changed and that this page needs updating.

All endpoints are on the https://apix.facepunch.com/api/ domain.

Types

NOTE: Nullable types are suffixed with ?. This API is subject to change and probably will do so before release.

PackageType

An enum specifying the different package types.

Starting at 1:

1. Map 2. Gamemode

Find Result

This is returned by /sbox/asset/find and is used to enumerate search results.

Name Type Description
type PackageType The package types being returned
assets Package[] A list of matching packages

Category

This is returned by /sbox/menu/index and is used to describe a category displayed on the main menu.

Name Type Description
title string This category's title
description string? This category's description
packages Package[] A list of packages within this category

Asset

This is returned by /sbox/asset/get.

Name Type Description
asset Package This asset's package info

Package

These are used in various places and are used to describe assets like gamemodes and maps.

Name Type Description
org Org The organisation owning this package
ident string This package's identifier
title string This package's human-friendly name
summary string? A short description for this package
thumb string? A URL to this package's thumbnail
packageType PackageType The package's type
updated long UNIX timestamp for when the package was last updated
description string? A longer description for this package
background string? A URL to this package's in-game background
downloadUrl string? A download URL for this package

Org

These are used in various places and are used to describe organisations.

Name Type Description
ident string This organisation's identifier
title string This organisation's human-friendly name
description string? This organisation's description
thumb string? A URL to the organisation's chosen thumbnail
socialTwitter string? A URL to the organisation's Twitter account
socialWeb string? A URL to the organisation's website

Endpoints

GET /sbox/menu/index

Params

None

Returns

A list of Category objects.

Example Request

/sbox/menu/index

Example Response

[ { "title": "Newest Releases", "description": "The latest released games", "packages": [ { "org": { "ident": "facepunch", "title": "Facepunch" }, "ident": "pool", "title": "Pool", "summary": "A classic pub game where your skill is determined by...", "thumb": "https://files.facepunch.com/sbox/org/facepunch/pool/thumb.1.jpg", "packageType": 2, "updated": 1619706156 } ] }, { "title": "Most Ppular", "description": "Games that are being played the most", "packages": [ { "org": { "ident": "rtmstuff", "title": "rtm516's Stuff" }, "ident": "prophunt", "title": "Prophunt", "summary": "A Prophunt gamemode for S&box", "thumb": "https://files.facepunch.com/sbox/org/rtmstuff/prophunt/thumb.2.jpg", "packageType": 2, "updated": 1619100319 } ] } ]

GET /sbox/asset/get

Params

id: An identifier (org.package) for the asset you wish to retrive info about.

Returns

An Asset

Example Request

/sbox/asset/get?id=facepunch.pool

Example Response

{ "asset": { "org": { "ident": "facepunch", "title": "Facepunch", "description": "", "thumb": "https://files.facepunch.com/sbox/org/facepunch/logo.1.png", "socialTwitter": "", "socialWeb": "" }, "ident": "pool", "title": "Pool", "summary": "A classic pub game where your skill is determined by your blood-alcohol content.\r\n", "description": "A classic pub game where your skill is determined by your blood-alcohol content.\r\n", "thumb": "https://files.facepunch.com/sbox/org/facepunch/pool/thumb.1.jpg", "background": "https://files.facepunch.com/sbox/org/facepunch/pool/background.1.jpg", "packageType": 2, "downloadUrl": "https://github.com/Facepunch/sbox-pool", "updated": 1619706156 } }

GET /sbox/asset/find

Params

type: map or gamemode.

Returns

A FindResult object.

Example Request

/sbox/asset/find?type=map

Example Response

{ "type": 1, "assets": [ { "org": { "ident": "baks", "title": "bakscratch" }, "ident": "office", "title": "Workplace", "summary": "Remake of popular map; WIP just the interior.", "thumb": "https://files.facepunch.com/sbox/org/baks/office/thumb.4.jpg", "packageType": 1, "updated": 1619045983 }, { "org": { "ident": "exeros", "title": "Exeros" }, "ident": "floodgate", "title": "Flood Gate", "summary": "Flood map", "thumb": "https://files.facepunch.com/sbox/org/exeros/floodgate/thumb.2.jpg", "packageType": 1, "updated": 1619037397 } ] }

Other

Finding an Org

There's no known endpoint for organizations. This is the closest you can get:

  1. Visit several endpoints (/asset/find?type={map}|{gamemode}, /menu/index) and collect a list of orgs with their gamemode idents
  2. Search that list for an org that matches the ident we're looking for
  3. Visit /asset/get?id={org}.{ident}
  4. Get the title & description for the org from this

Player Counts

Player accounts appear to use the Steam Lobby API; this means that an active Steam instance is required, using an account with access to s&box.

To enumerate through lobbies, use Steamworks.SteamMatchmaking.LobbyList.

Special Pages


Wikis

?

Render Time: 19ms

DB GetPage 3
Generate Html 3
SaveChanges (1) 8
Render Body 0
Render Sidebar 0