Ratelimit overrides are a way to override the ratelimit for specific users or group using an identifier.

Configure your override

import { Override } from "@unkey/ratelimit"

const unkey = new Override({
  rootKey: process.env.UNKEY_ROOT_KEY,
})

Use it

async function handler(request) {

  const identifier = request.getUserId() // or ip or anything else you want

  const override = await unkey.setOverride({
      identifier: identifier,
      limit: 10,
      duration: 60000,
      namespaceName: "email.outbound",
      async: true
  })
  if (override.error){
    // handle the error here
    console.error(override.error.message);
    return;
  }
  // handle the request here
}

There are four main functions to interact with overrides: