Skip to main content
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

  try {
    const { meta, data } = await unkey.setOverride({
        identifier: identifier,
        limit: 10,
        duration: 60000,
        namespaceName: "email.outbound",
    })
    
    if (data.error){
      // handle the error here
      console.error(data.error.message);
      return;
    }
  } catch (err) {
    console.error(err);
    return;
  }
  
  // handle the request here
}
There are four main functions to interact with overrides:
Last modified on February 14, 2026