---
title: "Block, unblock, or revoke an API key"
description: "Stop a TIR Token Factory API key for a while by blocking it, restore it by unblocking it, or end it for good by revoking it."
content_type: "how-to"
product: "token-factory"
platform: "TIR"
url: "/tir/token-factory/how-to/block-unblock-or-revoke-an-api-key/"
topic: ["api-keys"]
---

# Block, unblock, or revoke an API key

Stop an API key from working the moment you need to. Block a key to pause it while you find out
what happened, and unblock it to restore it. Revoke a key to end it for good, for example when it
has leaked or the system that used it is gone.

All three actions are in the key's **Actions** menu on **API Keys**: in TIR, open the project. In the side
menu, under **INFERENCE**, select **Token Factory**, then **API Keys**.

## If a key has leaked

Revoke a leaked key first, then replace it:

1. In the key's **Actions** menu, select **Revoke**, type the key's name exactly as shown, and
   select **Revoke Key**. Token Factory refuses the key from then on, and code that still uses it
   fails until you replace the key.
2. [Create a new key](/tir/token-factory/how-to/create-an-api-key/) and put it in your code in place
   of the old one.
3. To check for use you did not expect, open **Analytics** and look for more requests or tokens than
   your code sends, or for models your code does not call; see [Monitor usage and
   cost](/tir/token-factory/how-to/monitor-usage-and-cost/).

## Block a key

Blocking keeps the key, so you can restore it later without changing any code.

1. In the key's **Actions** menu, select **Block**.
2. (Optional) In **Reason (optional)**, say why you are blocking it, for example "leaked in a public
   repo". The reason can be up to 200 characters and is shown with the key's status.
3. Select **Block Key**.

The key's status changes to **Blocked**, and Token Factory refuses it from the next request until
you unblock it.

## Unblock a key

1. In the blocked key's **Actions** menu, select **Unblock**.
2. Select **Unblock Key**.

The key's status returns to **Active**, and Token Factory accepts it again from the next request.

A key blocked by Token Factory support cannot be unblocked from your project, and its status note
reads "Blocked by Token Factory support: requests with it are refused. Contact support to unblock
it." Contact [support](/tir/tir-support/) with the key's name and project to have it reviewed.

## Revoke a key

Revoking a key stops it at once, and it cannot be undone. Any code that still uses the key starts
failing. If the code must keep running and the key has not leaked, put a new key in place first.

1. (Optional) To keep your code running, [create a new key](/tir/token-factory/how-to/create-an-api-key/)
   and update the code that uses the old one.
2. In the old key's **Actions** menu, select **Revoke**.
3. Type the key's name exactly as shown, then select **Revoke Key**.

The key leaves the list, and requests with it are refused.

For the messages these actions can show, see [Troubleshooting TIR Token
Factory](/tir/token-factory/troubleshooting/token-factory/).
