Legacy API

To use the legacy API (also known as API v1), import the LegacyClient class and instantiate it.

import { LegacyClient } from 'osu-web.js';

const legacyApi = new LegacyClient(apiKey);

Node.js versions prior to 18 don’t have a native fetch API, so you’ll have to use a polyfill instead.

import fetch from 'node-fetch'; // Install this package
import { LegacyClient } from 'osu-web.js';

const legacyApi = new LegacyClient(apiKey, {
  polyfillFetch: fetch
});

Parameters

ParameterTypeOptionalDescription
apiKeystringYour osu! API Key
options

options

ParameterTypeOptionalDescription
polyfillFetchIn case developing with a Node.js version prior to 18, you need to pass a polyfill for the fetch API. Install node-fetch

You should avoid exposing the API key in your source code and frontend apps. Set it as an environment variable.

Notice that something is missing? Found a typo? Think something's incomplete? Or think that something can be explained better? Feel free to open a pull request or submit an issue on the library's Github repository .