Lesson 180 · 2 min

App safety basics: keys and data

If you build anything with AI, guard two things above all: your secret keys and other people's data.

Many AI-built apps connect to services using an API key, a long secret code that proves the app is yours. Anyone who has your key can use the service as you, and you pay the bill.

The classic mistake is putting the key inside the web page or in code you share publicly. Bots scan the internet for leaked keys around the clock. Keys belong on a server or in a secrets setting, never in the browser, a screenshot or a public file.

Data is the other half. Collect only what you need, and do not store ID numbers, health details or passwords unless you really must and know how to protect them. Many small tools work fine storing nothing, or storing only on the user's own device.

Before sharing an app, ask the AI to review it for exposed keys and personal data, then double-check the answer. Set a spending limit with your AI provider. If a key leaks, cancel it at once and make a new one.

Do it now

Run a safety check on a small app

  1. 1. Take any small app or tool you or AI have built, or imagine one.
  2. 2. Use the prompt below to get a checklist for it.
  3. 3. Fix the top item first, even if it is just setting a spending limit.
I built a small app that [WHAT IT DOES] using [TOOLS OR SERVICES]. Give me a short safety checklist for a beginner, covering secret keys, user data, spending limits and sharing. Mark the three most important items.

Quick check

Where should an API key never be placed?

Where should an API key never be placed?

More on this

Words from this lesson

API
A doorway that lets one program send requests to another, for example an app asking an AI model for an answer.
Data privacy
Keeping personal or confidential information under control, including deciding what you type into AI tools and where it is stored.
Rate limit
A cap on how many requests or messages you can send to an AI service in a set amount of time.
Vibe coding
Building software by describing what you want to an AI and accepting its code, often without reading it closely.