Still haven't joined our discord? Join here for giveaways and events: https://cube2d.net/discord
Rap api guide

Mode: user

Get RAP for a single user (by user_id or username).

Query ParamTypeRequiredDescription
modestringyesUse user
user_idintone ofUser ID to look up
usernamestringone ofUsername to look up (exact match)
pretty0/1noPretty‑print JSON
GET https://cube2d.net/api/rapapi?mode=user&user_id=9&pretty=1
GET https://cube2d.net/api/rapapi?mode=user&username=YourName

Mode: list

List users with username, bio, avatar URL, Cubx, and RAP. Paginated.

Query ParamTypeRequiredDescription
modestringyesUse list
pageintnoPage number (default 1)
per_pageintnoItems per page (default 50, max 250)
sortenumnorap_desc (default), rap_asc, id_asc, id_desc
pretty0/1noPretty‑print JSON
GET https://cube2d.net/api/rapapi?mode=list&per_page=50&sort=rap_desc&pretty=1
GET https://cube2d.net/api/rapapi?mode=list&page=2&per_page=100&sort=id_asc
Response Shape

Mode user — 200 OK

{ "success": true, "mode": "user", "meta": { "limited_rule": "items.is_limited=1 | items.stock IS NOT NULL", "rap_source": "avg(price, original_price)" }, "user": { "user_id": 9, "username": "Example", "bio": "hello!", "avatar": "https://cube2d.net/images/avatars/avatar_9.png", "cubx": 1234, "rap": 4321 } }

Mode list — 200 OK

{ "success": true, "mode": "list", "page": 1, "per_page": 50, "total_users": 123, "users": [ { "user_id": 9, "username": "Example", "bio": "hello!", "avatar": "https://cube2d.net/images/avatars/avatar_9.png", "cubx": 1234, "rap": 4321 } ] }

Errors

400 Bad Request: { "success": false, "error": "Provide user_id or username", "code": "MISSING_IDENTIFIER" } 404 Not Found: { "success": false, "error": "User not found", "code": "NOT_FOUND" } 500 Server Error: { "success": false, "error": "Server error", "code": "SERVER_ERROR" }
Catalog API (Items)

Endpoint

GET https://cube2d.net/api/catalog

Returns items from the catalog with filters and pagination. For limited items, extra fields are included (RAP, original price, stock, current price) and owners are listed from user_inventory.

Query Parameters

ParamTypeRequiredDescription
statusenumno Filter by item status: limited, featured, normal, all (default all).
pageintno Page number (default 1).
per_pageintno Items per page (default 50, max 100).
sortenumno created_desc (default), price_desc, price_asc, rap_desc, rap_asc.
RAP sorts only apply to limited items; others are ranked last.
searchstringno Substring match on item name.
categorystringno Exact category match (e.g., hat, glasses).
creator_idintno Filter by creator user ID.
pretty0/1no Pretty‑print JSON output.

Examples

GET https://cube2d.net/api/catalog?status=all&per_page=50
GET https://cube2d.net/api/catalog?status=limited&sort=rap_desc&pretty=1
GET https://cube2d.net/api/catalog?status=featured&category=hat
GET https://cube2d.net/api/catalog?search=smile&creator_id=9
Catalog API — Response Shape

200 OK

{ "success": true, "meta": { "total": 123, "page": 1, "per_page": 50, "status": "limited", "sort": "rap_desc", "search": "smile", "category": "hat", "creator_id": 9 }, "items": [ { "item_id": 15, "item_name": "Cube2D Tablet", "creator_id": 41, "description": "Given to the most valuable people in Cube2D", "category": "accessory", "image_path": "images/item/item_682b541b7d0a96.55544590.png", "status": "limited", "created_at": "2025-05-19 17:54:03", "rap": 312.45, "original_price": 10, "stock": null, "current_price": 1000, "owners_count": 2, "owners": [ { "user_id": 9, "username": "Example" }, { "user_id": 22, "username": "Alice" } ] }, { "item_id": 35, "item_name": "Cube Face", "creator_id": 41, "description": "", "category": "other", "image_path": "images/item/item_689887e6531229.45440880.png", "status": "featured", "created_at": "2025-08-10 11:52:06", "owners_count": 0, "owners": [] } ] }

Errors

400 Bad Request: { "success": false, "error": "Invalid parameter value", "code": "BAD_PARAM" } 500 Server Error: { "success": false, "error": "Server error", "code": "SERVER_ERROR" }

Notes

  • Status logic: limited = items.is_limited=1. featured = is_featured=1 AND is_limited=0. normal = neither featured nor limited.
  • Limited fields: For limited items, the response adds rap, original_price, stock (NULL = unlimited, 0 = sold out), and current_price (from items.price).
  • RAP: Average of the last ≤30 non‑null sale/purchase prices found in user_inventory (auto‑detects price column among last_sale_price, price_paid, purchase_price, price).
  • Owners: Joined from user_inventoryusers. Includes owners_count and an array of { user_id, username }.
  • Sorting: rap_* sorts push non‑limited items to the bottom.
Test
curl "https://cube2d.net/api/rapapi?mode=user&user_id=9&pretty=1"
curl "https://cube2d.net/api/rapapi?mode=list&per_page=100&sort=rap_desc&pretty=1"
curl "https://cube2d.net/api/catalog?status=limited&sort=rap_desc&pretty=1"
curl "https://cube2d.net/api/catalog?status=featured&category=hat"