Skip to main content
miji.be

API Key

A unique string used to authenticate and control access to a web API. Identifies the caller and enforces usage limits.

Oct 9, 2026 / About 1 min read

Security

An API key is a unique string issued to identify and authenticate a client accessing a web API. Think of it as a reservation number that tells the server "this person is authorized to use this service."

API keys serve three main purposes: authentication (identifying who is making the request), access control (enforcing rate limits and plan-based feature restrictions), and usage tracking (recording who called which endpoint and when).

Most URL shortening services provide APIs that let you programmatically shorten URLs and retrieve click statistics. To use these APIs, you register for an account, obtain an API key, and include it in your request headers (e.g., "Authorization: Bearer sk-abc123...").

The most critical aspect of API key management is keeping keys secret. Accidentally committing keys to public GitHub repositories is common. According to GitGuardian's 2023 report, 10 million secrets (API keys, passwords) were leaked on GitHub in 2022. Store keys in environment variables or dedicated secret management services - never hardcode them.

It's important to understand the difference between API keys and OAuth tokens. API keys are suited for application-level authentication and are simple to implement. OAuth provides user-level authorization with finer-grained access control but is more complex. Use API keys for server-to-server communication and personal projects; use OAuth when accessing user data.

Was this article helpful?

Related Terms

API Rate Limit

A restriction on the number of API requests a client can make within a specified time period.

HTTPS

The secure version of HTTP that encrypts data transmitted between a browser and a web server using TLS.

Input Validation

The process of verifying whether input data from users matches the expected format and range. One of the security measures.

CORS

Cross-Origin Resource Sharing - a browser security mechanism that controls which domains can access resources from another domain.

SSL/TLS

Cryptographic protocols that provide secure communication over the internet by encrypting data between client and server.

Link Governance

An operational framework for centrally managing creation permissions, naming conventions, expiration policies, and access controls for shortened URLs within an organization.

Related Articles

URL Shortener API Guide - Generating Short URLs Programmatically

A practical guide to using URL shortener APIs. Learn about request formats, response structures, authentication, and implementation patterns.

GitHub Short URLs - Shorten Long Issue, PR, and Blob URLs for Developer Workflows

Manage GitHub long Issue, PR, and blob URLs with short links. Streamline code reviews, documentation, and team communication with custom short URLs.

Short URL Security - Phishing Risks, Safe Sharing Practices, and Protection Guide

A comprehensive guide to short URL security. Understand phishing risks, malware distribution via shortened links, and best practices for safe sharing.

FAQ

What should I do if my API key is leaked?
Immediately revoke the key in the service's dashboard and generate a new one. Check usage logs for unauthorized activity. If pushed to GitHub, remove it from commit history as well.
Where should I store API keys?
Use environment variables (.env files) or cloud secret management services (like AWS Secrets Manager). Never embed them in source code or client-side JavaScript.
Do API keys expire?
It depends on the service. Some keys have expiration dates, others remain valid until manually revoked. Regular key rotation is recommended as a security best practice.

Put the terms to work

Shorten a URL for Free