Skip to content
logo

API Access

The Kraken API, which powers all the Kraken plugins, is fully open source and available here! The Kraken plugins themselves are not open source for obvious reasons. More information on using the API can be found below.

The Kraken API extends the RuneLite API with client-interaction utilities (queries, services, and scripting helpers) for writing plugins that are compatible with RuneLite. It is published so you can learn how the client works and build your own plugins. It is not meant for botting, reverse engineering, or breaking Jagex's rules, and everything here is for educational purposes; use it at your own risk. If you are just looking to use pre-existing plugins, you can skip this document entirely and head over to our website at kraken-plugins.com.

kraken-plugins.com is temporarily offline

Use the Discord bot to sign up, buy tokens, buy plugins, and view your license keys. Download the client directly: Windows · macOS

Prerequisites

  • Java 11 (JDK required)
  • Gradle (wrapper included, no need to install globally; the project uses Gradle 8.11)
  • Git
  • RuneLite (for testing and running plugins)
  • A GitHub account and personal access token to download the published API package (see Building)

API Usage

The following RuneLite "plugin" is purely for an example of the API's capabilities and isn't a functioning full-fledged script.

java
@PluginDescriptor(
        name = "Example",
        description = "Example plugin"
)
public class ExamplePlugin extends Plugin {

    @Inject
    private Context ctx;

    @Inject
    private BankService bank;

    @Inject
    private MovementService movement;

    @Inject
    private PrayerService prayer;

    @Subscribe
    private void onGameTick(GameTick e) {
        Player local = ctx.players().local().raw();

        if (local.isInteracting()) {
            return;
        }

        if (!bank.isOpen()) {
            // Open the nearest bank booth
            ctx.gameObjects().withName("Bank booth").sortByDistance().interact("Open");
        } else {
            // Withdraw one Rune scimitar
            ctx.bank().nameContains("Rune scimitar").first().ifPresent(item -> item.withdraw(1));
        }

        // Wield the Rune scimitar from the inventory
        ctx.inventory().withId(1333).interact("Wield");

        // Move to a new position
        movement.moveTo(new WorldPoint(3253, 3420, 0));

        // Activate a protection prayer
        prayer.activatePrayer(Prayer.PROTECT_FROM_MELEE);

        // "Click" on the nearest Goblin nobody else is fighting and attack it
        ctx.npcs().withName("Goblin")
                .except(n -> n.raw().isInteracting())
                .sortByDistance()
                .interact("Attack");

        // Take the goblin bones
        ctx.groundItems().withName("Bones")
                .reachable()
                .within(5)
                .nearest()
                .ifPresent(GroundObjectEntity::take);

        // Bury the bones
        ctx.inventory().withName("Bones").interact("Bury");
    }
}

Single-valued query terminals such as first() and nearest() return Optional, and the query-level interact(...) acts on the first match and returns false when there is none. If you have code written against an older version of the API, see Migrating to 5.0.

Example API Plugins

To use the API in real RuneLite plugins, check out the Kraken Example Plugins repository. It contains six complete, best-practice plugins built on the API, each with its own README under docs/:

  • Mining (iron ore at Varrock east mine, banking, and repeating)
  • Woodcutting
  • Fishing
  • Jewelry
  • Firemaking
  • Runecrafting

To set up your development environment, we recommend following this guide on RuneLite's Wiki.

Each example plugin has a runner class at {plugin}/src/test/java/Run{Plugin}PluginTest.java that starts RuneLite with that plugin loaded in the sidebar. Add -ea to the VM arguments and --developer-mode to the program arguments when you run it.

example-plugin

You can also load the example plugins into the Kraken client without building anything, either as an external repository using the manifest URL https://github.com/cbartram/kraken-example-plugin/releases/latest/download/manifest.json, or by sideloading the built JARs.

Development Workflow

  1. Fork the API and create a new branch from master
  2. Implement or update your feature for the API
  3. Add tests: unit tests live under src/test/java/unit, in-client tests are registered in the API test plugin (plugins.api.ApiTestPlugin under src/test/java)
  4. Run ./gradlew clean build to verify that the API builds and the unit tests pass
  5. Commit your changes with a signed-off, clear message: git commit -s -m "feat(api): Add feature X to Kraken API"
  6. Open a Pull Request