NewCommand BuilderFree

Introducing Secrets

Store an API key once and use it in your API requests as a variable. The value is never shown again, and each key can be locked to the APIs it belongs to.

BotGhost team3 min read

What it is

When your bot calls an outside service like ChatGPT or Hypixel, it usually needs an API key. Until now you pasted that key straight into your Send an API Request block. With Secrets, you store the key once, give it a name, and use a reference like {SECRET_OPENAI_API_KEY} wherever the key goes.

The value is stored encrypted and is never shown again, only replaced. Your commands, share codes and logs only ever contain the reference.

Add a secret

  1. Open any command or event in the Command Builder and pick the Secrets tab.
  2. Click New, type a Name (letters, numbers and underscores, saved in uppercase) and paste the Value.
  3. Turn on Only allow specific APIs and list the API the key belongs to, for example https://api.openai.com.
  4. Click Save Secret.

Click any secret in the list to copy its reference. The same list also opens from Manage Secrets inside the Send an API Request block.

Use it in a request

Put the reference wherever the key goes. For most AI services that is an Authorization header with the value Bearer {SECRET_OPENAI_API_KEY}. Your bot swaps in the real key right before the request is sent.

Slash Command
/ask
Send an API Request
Authorization header: Bearer {SECRET_OPENAI_API_KEY}
Plain Text Reply
Reply with the answer

The Secrets tab has an Add a popular API key menu with 17 well-known services, grouped into AI, Fun, Gaming, Data and Automation. It includes OpenAI, Anthropic (Claude), Google Gemini, Giphy, Hypixel, YouTube, GitHub and more.

Pick one, use Get your key to fetch it from the service, and paste it in. The name and allowed API are filled in for you, and every built-in API template for that service picks the key up automatically.

Lock a key to its API

Every secret has an Allowed APIs button. With Only allow specific APIs turned on (recommended), your bot only sends the key to the addresses you list. Paste the API's web address, one per line; only the site part is kept. Secrets without a lock show Any API in the list.

Only allow specific APIs
This secret will only be sent to the APIs listed below.
OffOn

Good to know

  • Free bots can store 5 secrets; premium bots can store up to 50.
  • References work inside Send an API Request blocks. Changes reach your running bot within a minute.
  • To swap a key, click Update the key on the secret, paste the new value and click Update Secret. It replaces the old one straight away.
  • Collaborators never see the values. They can only add, change or delete secrets if their role includes Manage secrets (the Admin role does).
  • Existing API requests keep working as they are. Move a key into Secrets whenever you like.

Full list of changes

  • NewSecrets tab in the Command Builder: store an API key once and use it as {SECRET_NAME} in Send an API Request blocks
  • NewAdd a popular API key with 17 services such as OpenAI, Claude, Gemini, Giphy and Hypixel, with the name and API filled in
  • NewAllowed APIs on each secret, so your bot only sends the key to the APIs you list
  • NewManage Secrets inside the Send an API Request block
See 12 Sep in the changelog