OpenBlox is a strictly typed API wrapper for both Classic and OpenCloud Roblox endpoints. It is written in TypeScript and can run natively on both NodeJs and Bun.
- Currently wraps over 200 Roblox API endpoints.
- Automatically handles CSRF tokens.
- Automatically polls long running operations.
- Easily iterate over paginated endpoints via async iterators (see Pagination).
- Use any http library via HTTP adapters (fetch is used by default).
- Easily rebind any Openblox API wrapper method to use different credentials (cookie, opencloud key, oauth access token) (see Rebinding).
- Prettifies response data
- ensures camel case (Example).
- turns Date strings into Date’s (Example).
- removes outer
data
wrappers (Example). - if an endpoint asks for an array of IDs and it returns its response data as an array, where each item in the response array corresponds to an item in the IDs array, then it will turn the response data into a dictionary so the data can be accessed more easily (Example).
- Abstracts pagination data away into its own
cursors
object (see Pagination) (Example).
OpenCloud APIs Support
Last updated 18th July 2024 - Openblox v.1.0.18
Classic APIs Support
Last updated 18th August 2024 - Openblox v.1.0.41
Getting Started!
- Install Openblox:
npm install openblox
- Setup Openblox in your project:
import "dotenv/config";
import { setConfig } from "openblox/config";
/*
Naming your Roblox Cookie environment variable `ROBLOX_COOKIE` will automatically
import it into your Openblox config, therefore voiding the need to set it in the config
manually. Similarly, naming your OpenCloud API Key environment variable `ROBLOX_CLOUD_KEY`
will also automatically import it into your Openblox config.
*/
setConfig({
cookie: process.env.MY_ROBLOX_COOKIE,
cloudKey: process.env.MY_ROBLOX_CLOUD_KEY
});
- Run Openblox API wrapper methods:
import "dotenv/config";
import { setConfig } from "openblox/config";
import { UsersApi } from "openblox/cloud";
import { ClassicUsersApi } from "openblox/classic"; // Classic APIs will always be prefixed with `Classic`.
/*
Naming your Roblox Cookie environment variable `ROBLOX_COOKIE` will automatically
import it into your Openblox config, therefore voiding the need to set it in the config
manually. Similarly, naming your OpenCloud API Key environment variable `ROBLOX_CLOUD_KEY`
will also automatically import it into your Openblox config.
*/
setConfig({
cookie: process.env.MY_ROBLOX_COOKIE,
cloudKey: process.env.MY_ROBLOX_CLOUD_KEY
})
(async () => {
const { data:userInfo_classic } = await ClassicUsersApi.userInfo({ userId: 45348281 })
const { data:userInfo_cloud } = await UsersApi.userInfo({ userId: 45348281 })
})
Support
You can get support for Openblox in the following servers:
RobloxAPI
RoAPI