Data API: Difference between revisions
Created page with "The '''Data API''' is an official method of retrieving live game information from Bconomy. The fetched data is returned in a machine-readable format, allowing it to be used by third-party tools and integrations that respect the Game Rules. ==API key== An API key is required when accessing the Data API to prevent abuse and allow access of sensitive information. This key must be included in every call to the API to authenticate yo..." |
Publish from docs/data-api.md |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
__TOC__ | |||
The Data API is Bconomy's official HTTP interface for reading live game data as JSON. Third-party tools may use it as long as they follow the [https://bconomy.net Game Rules]. | |||
== Getting an API key == | |||
Public static reference data is also available without a key through <code><nowiki>GET /api/reference</nowiki></code>. Other Data API queries below require a key. | |||
# Open the [https://bconomy.net/play Web Client], signed in with your main Bconomy account. | |||
# Run <code><nowiki>/resetapikey</nowiki></code> in the Console. Running it again replaces your key, so any tool using the old key stops working. | |||
# Copy the key. It is shown only once. You may be asked to complete a verification step first. | |||
Treat the key like a password. Anyone holding it can read anything your account can, and their requests count against your rate limit. | |||
== Quick start == | |||
Send a <code><nowiki>POST</nowiki></code> to <code><nowiki>https://bconomy.net/api/data</nowiki></code> with your key in the <code><nowiki>x-api-key</nowiki></code> header and a JSON body naming the query in <code><nowiki>type</nowiki></code>: | |||
< | <pre>const res = await fetch("https://bconomy.net/api/data", { | ||
// | |||
const | |||
method: "POST", | method: "POST", | ||
headers: { | headers: { "Content-Type": "application/json", "x-api-key": MY_KEY }, | ||
body: JSON.stringify({ type: "pets/pet", id: 1 }), | |||
body: JSON.stringify({ type: "pet", id: 1 }), | |||
}); | }); | ||
const pet = await res.json();</pre> | |||
// | The response is the requested data itself, with no wrapper. For <code><nowiki>pets/pet</nowiki></code> that is a single [[Data API/Types#Pet|<code><nowiki>Pet</nowiki></code>]] object. | ||
== Conventions == | |||
= | {| class="wikitable" | ||
|- | |||
! Topic | |||
! Rule | |||
|- | |||
| Endpoint | |||
| <code><nowiki>POST https://bconomy.net/api/data</nowiki></code> | |||
|- | |||
| Authentication | |||
| <code><nowiki>x-api-key</nowiki></code> header on every request | |||
|- | |||
| Query | |||
| <code><nowiki>type</nowiki></code> field in the JSON body, written as <code><nowiki>area/name</nowiki></code> (for example <code><nowiki>market/listings</nowiki></code>); other fields are that query's parameters | |||
|- | |||
| IDs | |||
| <code><nowiki>id</nowiki></code> is a BcID for player queries and the object's own ID for pets, eggs and factions; each endpoint says which | |||
|- | |||
| Dates | |||
| Fields documented as ISO 8601 are strings; fields documented as Unix ms are numbers of milliseconds since 1970 | |||
|- | |||
| Pagination | |||
| <code><nowiki>page</nowiki></code> is 1-based; <code><nowiki>pageSize</nowiki></code> is optional unless an endpoint says otherwise | |||
|- | |||
| Large numbers | |||
| Some totals can exceed <code><nowiki>Number.MAX_SAFE_INTEGER</nowiki></code> and lose precision in JavaScript; those fields are marked | |||
|- | |||
| Rate limit | |||
| 120 requests per minute, counted per IP address and per BcID; heavy API use also slows your own Web Client | |||
|- | |||
| Versioning | |||
| None. Fields can be added, changed or removed without notice | |||
|} | |||
=== Errors === | |||
Errors return a JSON body of <code><nowiki>{ "error": string }</nowiki></code>: | |||
= | {| class="wikitable" | ||
|- | |||
< | ! Status | ||
! Meaning | |||
|- | |||
| <code><nowiki>400</nowiki></code> | |||
| The game rejected the request, for example when you are over the rate limit. <code><nowiki>error</nowiki></code> explains why | |||
|- | |||
| <code><nowiki>403</nowiki></code> | |||
| The query type exists but is not available through the HTTP API | |||
|- | |||
| <code><nowiki>500</nowiki></code> | |||
| Anything else, including a missing or invalid key, an unknown <code><nowiki>type</nowiki></code>, or invalid parameters | |||
|} | |||
==== | == Endpoints == | ||
Each endpoint page lists the request, the response and any limits. Shared shapes such as <code>User</code> and <code>Pet</code> are on [[Data API/Types|Types]]. | |||
< | |||
</ | |||
= | {| class="wikitable" | ||
|- | |||
! Query | |||
! Returns | |||
|- | |||
! colspan="2" | [[Data API/Profile|Profile]] | |||
|- | |||
| [[Data API/Profile#user/profile|<code><nowiki>user/profile</nowiki></code>]] | |||
| Returns a single user's full public profile, enriched with inventory, faction, linked Discord info (if public), and BCS roles. | |||
|- | |||
| [[Data API/Profile#user/get|<code><nowiki>user/get</nowiki></code>]] | |||
| Returns the core [[Data API/Types#User|<code><nowiki>User</nowiki></code>]] object. | |||
|- | |||
| [[Data API/Profile#user/lbPositions|<code><nowiki>user/lbPositions</nowiki></code>]] | |||
| Returns a user's leaderboard positions, scoped to that profile's own type (main / ironman / hardcore rank among their own kind only). | |||
|- | |||
| [[Data API/Profile#user/inventory|<code><nowiki>user/inventory</nowiki></code>]] | |||
| Returns the inventory of a user. | |||
|- | |||
| [[Data API/Profile#stats/user|<code><nowiki>stats/user</nowiki></code>]] | |||
| Returns all tracked lifetime and periodic statistics for a user. | |||
|- | |||
| [[Data API/Profile#stats/trophies|<code><nowiki>stats/trophies</nowiki></code>]] | |||
| Returns the trophy record for a user. | |||
|- | |||
| [[Data API/Profile#user/otherProfiles|<code><nowiki>user/otherProfiles</nowiki></code>]] | |||
| Returns public summary information for other profiles belonging to the same account as the requested profile. | |||
</ | |- | ||
| [[Data API/Profile#stats/userWindowed|<code><nowiki>stats/userWindowed</nowiki></code>]] | |||
| Returns time-windowed statistics for a user across multiple aggregation buckets. | |||
|- | |||
< | | [[Data API/Profile#stats/burnOdds|<code><nowiki>stats/burnOdds</nowiki></code>]] | ||
| Returns daily and weekly first-draw Burn odds for a user in their profile mode, using all eligible positive burns, with no leaderboard page cutoff. | |||
</ | |||
</ | |||
< | |||
</ | |||
< | |||
< | |||
< | |||
< | |||
< | |||
</ | |||
< | |||
|- | |- | ||
| | ! colspan="2" | [[Data API/Pets|Pets]] | ||
|- | |- | ||
| | | [[Data API/Pets#pets/pet|<code><nowiki>pets/pet</nowiki></code>]] | ||
| Returns a single pet. | |||
|- | |- | ||
| | | [[Data API/Pets#pets/egg|<code><nowiki>pets/egg</nowiki></code>]] | ||
| Returns a single egg. | |||
|- | |- | ||
| | | [[Data API/Pets#pets/userPetsAndEggs|<code><nowiki>pets/userPetsAndEggs</nowiki></code>]] | ||
| Returns pets and eggs owned by a user. | |||
|- | |- | ||
| | | [[Data API/Pets#pets/offspring|<code><nowiki>pets/offspring</nowiki></code>]] | ||
| Returns all pets and eggs that have the specified pet as a parent. | |||
|- | |- | ||
| | | [[Data API/Pets#pets/leaderboard|<code><nowiki>pets/leaderboard</nowiki></code>]] | ||
| | | Returns a paginated page of the pets leaderboard (sorted by lifetime items found descending). | ||
|- | |- | ||
! colspan="2" | [[Data API/Menagerie|Menagerie]] | |||
|[[ | |||
|- | |- | ||
| [[Data API/Menagerie#menagerie/get|<code><nowiki>menagerie/get</nowiki></code>]] | |||
| Returns a user's menagerie collection, unlocked variants, and active animal status. | |||
|[[# | |||
|Returns | |||
|- | |- | ||
| [[Data API/Menagerie#menagerie/leaderboard|<code><nowiki>menagerie/leaderboard</nowiki></code>]] | |||
| Returns a paginated page of the menagerie collection leaderboard. | |||
|[[# | |||
|Returns | |||
|- | |- | ||
! colspan="2" | [[Data API/Factions|Factions]] | |||
|[[ | |||
| | |||
|- | |- | ||
| [[Data API/Factions#factions/get|<code><nowiki>factions/get</nowiki></code>]] | |||
| Returns a single faction. | |||
|[[# | |||
|<code> | |||
|- | |- | ||
| [[Data API/Factions#factions/members|<code><nowiki>factions/members</nowiki></code>]] | |||
| Returns all users that belong to a faction. | |||
|[[ | |||
|<code> | |||
| | |||
|- | |- | ||
| | | [[Data API/Factions#factions/recruiting|<code><nowiki>factions/recruiting</nowiki></code>]] | ||
| Returns recruiting factions of the viewer's profile type with an open member spot and at least one FP-funded active boost. | |||
|< | |||
|Returns the | |||
|- | |- | ||
| [[Data API/Factions#factions/joinRequests|<code><nowiki>factions/joinRequests</nowiki></code>]] | |||
| Returns faction join requests filtered by either faction or user. | |||
|[[ | |||
| | |||
|- | |- | ||
|<code> | | [[Data API/Factions#factions/leaderboard|<code><nowiki>factions/leaderboard</nowiki></code>]] | ||
| Returns a paginated page of the faction leaderboard. | |||
|- | |- | ||
| | ! colspan="2" | [[Data API/Market|Market]] | ||
|- | |- | ||
|<code> | | [[Data API/Market#market/preview|<code><nowiki>market/preview</nowiki></code>]] | ||
| Returns the current lowest listing price and price delta for every item. | |||
|- | |- | ||
|<code> | | [[Data API/Market#market/listings|<code><nowiki>market/listings</nowiki></code>]] | ||
| Returns up to 50 active market listings for an item, sorted by price ascending. | |||
|- | |- | ||
|<code> | | [[Data API/Market#market/userListings|<code><nowiki>market/userListings</nowiki></code>]] | ||
| Returns all active market listings created by a user. | |||
|- | |- | ||
|<code> | | [[Data API/Market#market/globalRecentActivity|<code><nowiki>market/globalRecentActivity</nowiki></code>]] | ||
| Returns the last 20 market transactions (buys, listings, and delistings) across all items. | |||
|- | |- | ||
|<code> | | [[Data API/Market#market/recentTransactions|<code><nowiki>market/recentTransactions</nowiki></code>]] | ||
| Returns the last 5 market transactions for a specific item. | |||
|- | |- | ||
|<code> | | [[Data API/Market#market/priceHistory|<code><nowiki>market/priceHistory</nowiki></code>]] | ||
| Returns historical lowest-price snapshots for an item. | |||
|- | |- | ||
|<code> | | [[Data API/Market#market/volumeHistory|<code><nowiki>market/volumeHistory</nowiki></code>]] | ||
| Returns aggregated trade volume history for an item. | |||
|- | |- | ||
| | ! colspan="2" | [[Data API/Leaderboards|Leaderboards]] | ||
|- | |- | ||
|<code> | | [[Data API/Leaderboards#stats/userLeaderboard|<code><nowiki>stats/userLeaderboard</nowiki></code>]] | ||
| Returns a paginated page of the user leaderboard. | |||
|- | |- | ||
|<code> | | [[Data API/Leaderboards#stats/hoarderLeaderboard|<code><nowiki>stats/hoarderLeaderboard</nowiki></code>]] | ||
| Returns players ranked by hoarder trophy size (count of item-collector trophies held). | |||
|- | |- | ||
|<code> | | [[Data API/Leaderboards#stats/itemCollectorLeaderboard|<code><nowiki>stats/itemCollectorLeaderboard</nowiki></code>]] | ||
| Returns the current trophy holders for all collectible items. | |||
|- | |- | ||
| | ! colspan="2" | [[Data API/Logs|Logs]] | ||
|- | |- | ||
|<code> | | [[Data API/Logs#logs/byBcId|<code><nowiki>logs/byBcId</nowiki></code>]] | ||
| Returns logs associated with a user. | |||
|- | |- | ||
|<code> | | [[Data API/Logs#logs/byIdType|<code><nowiki>logs/byIdType</nowiki></code>]] | ||
| Returns logs associated with a faction or item. | |||
|- | |- | ||
|<code> | | [[Data API/Logs#logs/byLogType|<code><nowiki>logs/byLogType</nowiki></code>]] | ||
| Returns logs filtered by event type. | |||
|- | |- | ||
|<code> | | [[Data API/Logs#misc/dailyInputs|<code><nowiki>misc/dailyInputs</nowiki></code>]] | ||
| Returns all commands executed by a user on a specific date (UTC day). | |||
|- | |- | ||
| | ! colspan="2" | [[Data API/Game Data|Game Data]] | ||
|- | |- | ||
|<code> | | [[Data API/Game Data#GET /api/reference|<code><nowiki>GET /api/reference</nowiki></code>]] | ||
| Public, read-only reference definitions from the running server. | |||
|- | |- | ||
|<code> | | [[Data API/Game Data#misc/itemData|<code><nowiki>misc/itemData</nowiki></code>]] | ||
| Returns static data for all game items. | |||
|- | |- | ||
|<code> | | [[Data API/Game Data#misc/gameState|<code><nowiki>misc/gameState</nowiki></code>]] | ||
| Returns the current live game state including active bosses, the ball pit, global action boosts, and giveaways. | |||
|- | |- | ||
|<code> | | [[Data API/Game Data#misc/userBallsOwned|<code><nowiki>misc/userBallsOwned</nowiki></code>]] | ||
| Returns the number of balls the <strong>authenticated user</strong> (identified by the API key) currently has in the ball pit. | |||
|- | |- | ||
|<code> | | [[Data API/Game Data#stats/questSeasons|<code><nowiki>stats/questSeasons</nowiki></code>]] | ||
| Returns archived quest seasons. | |||
|- | |- | ||
|<code> | | [[Data API/Game Data#misc/bossFactionStats|<code><nowiki>misc/bossFactionStats</nowiki></code>]] | ||
| Returns active faction combat contribution stats for the current boss fight. | |||
|- | |- | ||
| | ! colspan="2" | [[Data API/Search|Search]] | ||
|- | |- | ||
|<code> | | [[Data API/Search#search/users|<code><nowiki>search/users</nowiki></code>]] | ||
| Searches users by name. | |||
|- | |- | ||
|<code> | | [[Data API/Search#search/factions|<code><nowiki>search/factions</nowiki></code>]] | ||
| Searches factions by name. | |||
|- | |- | ||
|<code> | | [[Data API/Search#search/pets|<code><nowiki>search/pets</nowiki></code>]] | ||
| Searches pets by species, skin, aura, and/or name. | |||
|- | |- | ||
| | ! colspan="2" | [[Data API/Player Activity|Player Activity]] | ||
|- | |- | ||
|<code> | | [[Data API/Player Activity#playerActivity/online|<code><nowiki>playerActivity/online</nowiki></code>]] | ||
| Returns game profiles with a connection, reported presence, or interaction signal in the past 90 minutes. | |||
|- | |- | ||
| | ! colspan="2" | [[Data API/Homepage feed|Homepage feed]] | ||
|- | |- | ||
|<code> | | [[Data API/Homepage feed#GET /api/eventsfeed|<code><nowiki>GET /api/eventsfeed</nowiki></code>]] | ||
| A public endpoint with no API key, used by the homepage marquees. | |||
|} | |} | ||
<small>Generated from the Bconomy source documentation. Edits made on the wiki are overwritten on the next publish; ask the developers to change the source.</small> | |||
[[Category:Data API]] | |||
Latest revision as of 21:42, 3 November 2026
The Data API is Bconomy's official HTTP interface for reading live game data as JSON. Third-party tools may use it as long as they follow the Game Rules.
Getting an API key
[edit | edit source]Public static reference data is also available without a key through GET /api/reference. Other Data API queries below require a key.
- Open the Web Client, signed in with your main Bconomy account.
- Run
/resetapikeyin the Console. Running it again replaces your key, so any tool using the old key stops working. - Copy the key. It is shown only once. You may be asked to complete a verification step first.
Treat the key like a password. Anyone holding it can read anything your account can, and their requests count against your rate limit.
Quick start
[edit | edit source]Send a POST to https://bconomy.net/api/data with your key in the x-api-key header and a JSON body naming the query in type:
const res = await fetch("https://bconomy.net/api/data", {
method: "POST",
headers: { "Content-Type": "application/json", "x-api-key": MY_KEY },
body: JSON.stringify({ type: "pets/pet", id: 1 }),
});
const pet = await res.json();
The response is the requested data itself, with no wrapper. For pets/pet that is a single Pet object.
Conventions
[edit | edit source]| Topic | Rule |
|---|---|
| Endpoint | POST https://bconomy.net/api/data
|
| Authentication | x-api-key header on every request
|
| Query | type field in the JSON body, written as area/name (for example market/listings); other fields are that query's parameters
|
| IDs | id is a BcID for player queries and the object's own ID for pets, eggs and factions; each endpoint says which
|
| Dates | Fields documented as ISO 8601 are strings; fields documented as Unix ms are numbers of milliseconds since 1970 |
| Pagination | page is 1-based; pageSize is optional unless an endpoint says otherwise
|
| Large numbers | Some totals can exceed Number.MAX_SAFE_INTEGER and lose precision in JavaScript; those fields are marked
|
| Rate limit | 120 requests per minute, counted per IP address and per BcID; heavy API use also slows your own Web Client |
| Versioning | None. Fields can be added, changed or removed without notice |
Errors
[edit | edit source]Errors return a JSON body of { "error": string }:
| Status | Meaning |
|---|---|
400
|
The game rejected the request, for example when you are over the rate limit. error explains why
|
403
|
The query type exists but is not available through the HTTP API |
500
|
Anything else, including a missing or invalid key, an unknown type, or invalid parameters
|
Endpoints
[edit | edit source]Each endpoint page lists the request, the response and any limits. Shared shapes such as User and Pet are on Types.
| Query | Returns |
|---|---|
| Profile | |
user/profile
|
Returns a single user's full public profile, enriched with inventory, faction, linked Discord info (if public), and BCS roles. |
user/get
|
Returns the core User object.
|
user/lbPositions
|
Returns a user's leaderboard positions, scoped to that profile's own type (main / ironman / hardcore rank among their own kind only). |
user/inventory
|
Returns the inventory of a user. |
stats/user
|
Returns all tracked lifetime and periodic statistics for a user. |
stats/trophies
|
Returns the trophy record for a user. |
user/otherProfiles
|
Returns public summary information for other profiles belonging to the same account as the requested profile. |
stats/userWindowed
|
Returns time-windowed statistics for a user across multiple aggregation buckets. |
stats/burnOdds
|
Returns daily and weekly first-draw Burn odds for a user in their profile mode, using all eligible positive burns, with no leaderboard page cutoff. |
| Pets | |
pets/pet
|
Returns a single pet. |
pets/egg
|
Returns a single egg. |
pets/userPetsAndEggs
|
Returns pets and eggs owned by a user. |
pets/offspring
|
Returns all pets and eggs that have the specified pet as a parent. |
pets/leaderboard
|
Returns a paginated page of the pets leaderboard (sorted by lifetime items found descending). |
| Menagerie | |
menagerie/get
|
Returns a user's menagerie collection, unlocked variants, and active animal status. |
menagerie/leaderboard
|
Returns a paginated page of the menagerie collection leaderboard. |
| Factions | |
factions/get
|
Returns a single faction. |
factions/members
|
Returns all users that belong to a faction. |
factions/recruiting
|
Returns recruiting factions of the viewer's profile type with an open member spot and at least one FP-funded active boost. |
factions/joinRequests
|
Returns faction join requests filtered by either faction or user. |
factions/leaderboard
|
Returns a paginated page of the faction leaderboard. |
| Market | |
market/preview
|
Returns the current lowest listing price and price delta for every item. |
market/listings
|
Returns up to 50 active market listings for an item, sorted by price ascending. |
market/userListings
|
Returns all active market listings created by a user. |
market/globalRecentActivity
|
Returns the last 20 market transactions (buys, listings, and delistings) across all items. |
market/recentTransactions
|
Returns the last 5 market transactions for a specific item. |
market/priceHistory
|
Returns historical lowest-price snapshots for an item. |
market/volumeHistory
|
Returns aggregated trade volume history for an item. |
| Leaderboards | |
stats/userLeaderboard
|
Returns a paginated page of the user leaderboard. |
stats/hoarderLeaderboard
|
Returns players ranked by hoarder trophy size (count of item-collector trophies held). |
stats/itemCollectorLeaderboard
|
Returns the current trophy holders for all collectible items. |
| Logs | |
logs/byBcId
|
Returns logs associated with a user. |
logs/byIdType
|
Returns logs associated with a faction or item. |
logs/byLogType
|
Returns logs filtered by event type. |
misc/dailyInputs
|
Returns all commands executed by a user on a specific date (UTC day). |
| Game Data | |
GET /api/reference
|
Public, read-only reference definitions from the running server. |
misc/itemData
|
Returns static data for all game items. |
misc/gameState
|
Returns the current live game state including active bosses, the ball pit, global action boosts, and giveaways. |
misc/userBallsOwned
|
Returns the number of balls the authenticated user (identified by the API key) currently has in the ball pit. |
stats/questSeasons
|
Returns archived quest seasons. |
misc/bossFactionStats
|
Returns active faction combat contribution stats for the current boss fight. |
| Search | |
search/users
|
Searches users by name. |
search/factions
|
Searches factions by name. |
search/pets
|
Searches pets by species, skin, aura, and/or name. |
| Player Activity | |
playerActivity/online
|
Returns game profiles with a connection, reported presence, or interaction signal in the past 90 minutes. |
| Homepage feed | |
GET /api/eventsfeed
|
A public endpoint with no API key, used by the homepage marquees. |
Generated from the Bconomy source documentation. Edits made on the wiki are overwritten on the next publish; ask the developers to change the source.