FNLB Devs

Developer Portal

API

API Overview

The API reference next to these guides is the complete list of routes. This page is the map. Schemas, examples, and the try client live on each route, so they stay in one place. Base URL:

https://api.fnlb.net/v1

Paths in the reference are relative to that URL. Authenticated calls use the header from Authenticating. OAuth2 tokens also need the scope named on the route. Limits are per route, not global. See Rate limits.

Areas

  • OAuth2

    Exchange an authorization code for an access token.

  • User

    Read the account that owns the token.

  • Bots

    List, create, update, import, and export bots.

  • Categories

    Group bots and read the ids a self-hosted cluster needs.

  • Presets

    Store reusable cosmetic setups.

  • Commands

    Run a command on one bot, such as changing an outfit.

  • Social

    Read friends, pending requests, and blocked users for a bot.

  • Gateway

    Leave this API when you need live party and shard state.

A first call

GET /bots returns the bots on the token's account. From a server:

const response = await fetch('https://api.fnlb.net/v1/bots', {
  headers: { Authorization: 'Bearer FNLB_YOUR_API_TOKEN' }
});
if (!response.ok) throw new Error(await response.text());
const bots = await response.json();

While you are signed in to this portal, open that route and use Try request. The session token is sent for you and is not shown in the client. Public routes, such as GET /bots/public, do not take a token and are not rate limited.

Commands

Cosmetic changes and other bot actions go through one route, POST /bots/{botId}/commands/run. It needs the commands.run scope when you use an OAuth2 token.

{
  "command": "outfit",
  "args": "Renegade Raider",
  "locale": "en"
}

The route page lists the fields and the errors. Do not cache a private copy of that schema. The reference is updated with the API. command is the name only, with no category prefix. args is either one string or a list of up to 25 strings. locale is optional and picks the language of the reply.

{
  "nonce": "…",
  "botName": "Alpha",
  "content": "Set outfit to Renegade Raider.",
  "format": 1
}

format is how to present content: 0 neutral, 1 success, 2 info, 3 warn, 4 error. The HTTP status is still 200 when the bot answered. A 4xx means the API rejected the call before the bot ran it. The reply does not include the party. Read that from the gateway with the same bot id.

What a bot object contains

GET /bots returns the bots owned by the token. Each object has:

FieldMeaning
idBot id. This is {botId} on every other bot route, including the gateway.
nicknameName shown in FNLB.
emailEpic account email stored with the bot, when one is set.
parentCategory id. The same value as id from GET /categories.
flagsBitfield. 1 disabled, 2 public, 4 invalid auth. Combine them. 6 is public and invalid auth.

Creating a bot is POST /bots and needs bots.write on an OAuth2 token. Updating and deleting are PATCH /bots/{botId} and DELETE /bots/{botId}.

Friends, categories, presets

GET /user is the account behind the token: id, username, and, when the token may see them, email and connections. That id is the gateway bucket.

Deeper guides