Your API keys are unscoped strings Proper key management in 30 days

For SaaS products exposing APIs that need proper key management: generation, scoping, rotation, rate limiting, and usage tracking. GitGuardian's State of Secrets Sprawl 2025 report counted 23.7M new hardcoded secrets pushed to public GitHub in 2024, and leaked keys often stay valid long after the leak.

  • Working proof in 30 days
  • Fixed scope and timeline
  • 30 days From kickoff to production delivery
  • Week 1 Technical diligence and planning
  • Week 4 Production deployment and handoff

How it shows up

Your API is your product. The risk is not hypothetical. API keys leak in GitHub commits, shared in Slack channels, and hardcoded in client apps.

The API security gap

Your API keys are random UUIDs stored in plaintext. Every key has full access to every endpoint. When a key leaks, and keys always leak, you cannot scope the blast radius. You cannot rotate without breaking the integration. You cannot even tell which key was compromised because there are no usage logs. GitHub, AWS, and Stripe all show a key once at creation and store only a hash plus a prefix. Enterprise customers know that pattern, and they check for it during security review.

Full-access blast radius

A customer's developer commits an API key to a public GitHub repo. Hardcoded keys are still the number one cause of leaks, and bots mirror public commits within minutes. That key has full read-write access to every endpoint. You have no way to scope it to read-only, no way to limit it to specific resources, and no way to know it was compromised until damage is done.

Break-the-world rotation

A key needs to be rotated. The only option is to delete the old key and create a new one. Every integration using that key breaks simultaneously. OWASP and NIST both recommend bounded key lifetimes, but you cannot enforce a rotation policy when rotation means downtime. Customers with several integrations using the same key face a coordination nightmare, so they never rotate and the key lives forever.

Invisible abuse

A bad actor is pushing a flood of API calls through a leaked key. You do not know because there is no per-key rate limiting or usage tracking. Per-IP throttling does not catch it because the traffic looks like a normal distributed client. Your database is under load and you are investigating 'performance issues' when the real problem is unmetered abuse on a single key you could have throttled in one place.

Who it is for

Best for SaaS products with a public API that customers integrate with programmatically.

Best fit

You expose an API that customers use for integrations and the key management is minimal or nonexistent.

  • API keys stored as plaintext UUIDs with no hashing
  • Every key has full access to every endpoint with no scoping
  • No key rotation without breaking customer integrations

What happens without proper key management

Every leaked key is an incident.

Security incidents escalate

The more API customers you have, the more often keys leak, and public secret leaks on GitHub keep climbing year after year. Without scoped permissions and rotation, every leak is a full-access breach that requires coordinated response with the affected customer.

Rate abuse drains resources

Without per-key rate limits, one customer's runaway script can saturate your API. Without usage tracking, you cannot identify the source. You scale your infrastructure to handle abuse you should be throttling, and you pay for compute on traffic that a single token-bucket check would have rejected with a 429.

Enterprise deals die in security review

The prospect's security team asks: 'How are API keys stored? What is the rotation policy? Can keys be scoped to read-only? Can a single compromised key be revoked without breaking the others?' Your answers are 'plaintext, none, no, and no.' These questions are standard in SOC 2 and vendor security reviews. The deal is dead.

What we do in 30 days

From plaintext UUIDs to hashed, scoped, rate-limited keys with a developer portal in 30 days.

  1. Days 1-5: Security model design

    Audit current key storage and usage patterns. Design the permission scope model mapping key permissions to API endpoints. Plan the key hashing scheme: SHA-256 over a 32-byte random key, which is fast enough to verify on every request while high entropy keeps brute force impractical, plus a short prefix kept in plaintext for identification. Define rate limit tiers per plan. Design the rotation flow that allows old and new keys to coexist during transition.

  2. Days 6-14: Core key infrastructure

    Key generation with hashed storage (full key shown once at creation, then only the prefix). Permission scoping enforced at the API middleware layer. Rate limiting with a Redis token bucket per key, with the token math in an atomic Lua script so it stays correct under concurrent requests and across instances. Usage logging for every API call with key attribution. Proof release: new keys are scoped and rate-limited in production.

  3. Days 15-30: Developer portal and operations

    Customer-facing key management UI: create, scope, rotate, revoke, and view usage. Graceful rotation with overlapping validity windows so customers update integration code on their own cadence without failed requests. Standard RateLimit and Retry-After response headers so any HTTP client can back off automatically. Admin dashboard showing per-key usage, rate limit hits, and abuse detection. Existing plaintext keys migrated to hashed storage with backward compatibility.

What you get

A production API key management system, not a UUID generator.

Shipped deliverables

Complete API key lifecycle management with security, rate limiting, and developer self-service.

  • Key generation with SHA-256 hashing at rest, shown once at creation, prefix-only identification afterward
  • Least-privilege scoping: read-only, write, admin, and custom scope sets enforced in middleware
  • Per-key rate limiting with a Redis token bucket and atomic Lua enforcement

Why Pineido

We build APIs and consume APIs daily.

API-first development experience

We have built API key systems for developer-facing SaaS products. We know that rotation needs overlapping validity windows so customers do not experience downtime. We know that rate limiting needs per-key granularity, not just per-IP, and that the token math belongs in an atomic Redis operation so it holds under load. We know that hashing high-entropy keys with SHA-256 beats slow hashes when you verify on every request. We follow the GitHub and Stripe pattern of showing a key once and storing only a hash. We build what developers actually need when integrating with your API.

The questions that decide if we are right for you

How do you migrate existing plaintext keys?

We hash all existing keys in place with SHA-256 and keep a prefix for identification, while maintaining backward compatibility. Existing integrations continue to work because verification simply hashes the incoming key and compares. Over time, customers rotate to new keys through the developer portal, and you can set an expiry on the legacy plaintext-era keys once usage drops to zero. No breaking changes required.

Can we use OAuth instead of API keys?

API keys are better for server-to-server integrations. OAuth is better for user-delegated access. Most SaaS APIs need both. We can build the API key layer now and add OAuth as a follow-on sprint if needed.

What happens when rate limits are hit?

The API returns a 429 with a Retry-After header. The response also carries the rate limit ceiling, remaining quota, and reset time using the IETF RateLimit header fields, the same standard GitHub adopted when it dropped the legacy X-RateLimit prefix. Any HTTP client can read them and back off gracefully before it ever hits the limit.

Can customers create multiple API keys with different permissions?

Yes. The developer portal lets your customers generate multiple keys scoped to specific resources and actions. A read-only key for analytics and a write key for mutations is a common pattern. If one key is compromised, they revoke it without affecting their other integrations.

How do you track API key usage for billing and analytics?

Every API request is logged with the key prefix, endpoint, response code, and latency. We log the prefix, never the full key, so secrets stay out of your logs and error reports. Your admin dashboard shows usage per key, per customer, and per endpoint. This data feeds directly into your usage-based billing pipeline if you charge by API call volume.

Do you support API key rotation without downtime?

Yes. Customers can generate a new key before revoking the old one. Both keys work simultaneously during a configurable grace period. This lets your customers update their integration code without any downtime or failed requests during the transition.

30 days From kickoff to production delivery

Stop storing API keys in plaintext

Every unscoped key is a full-access breach waiting to happen, and leaked keys often stay valid long after the leak.

Fixed price.

You leave with

  1. Day 1: Audit current key usage and design the permission scope model
  2. Day 5: Key hashing, scoping, and rate limit tiers finalized

ByFounder and Imaginator

Published Updated