Prompt
I'm building an internal tool that might become a public API, what should I avoid?
Latest observation
If you think an internal tool might later become a public API, the biggest thing to avoid is optimizing only for “it works for our team right now”. A lot of internal shortcuts become painful, insecure, or breaking once external users rely on them.
Things to avoid
1. Leaking internal implementation details
Avoid endpoints, payloads, or error messages that expose:
- database schema
- internal service names
- stack traces
- file paths
- queue/job IDs that only make sense internally
Why: public users will depend on these details, and they make refactoring harder.
2. No versioning strategy
Avoid shipping an API without a plan for:
/v1,/v2, or equivalent versioning- deprecation windows
- backward compatibility policy
Why: once public, changing response shapes becomes a breaking change.
3. Using unstable or ambiguous data contracts
Avoid:
- changing field names casually
- returning inconsistent types (
stringsometimes,objectother times) - using untyped “misc” blobs everywhere
- relying on implicit ordering
Why: public consumers need predictable schemas.
4. Authentication that’s “good enough for internal”
Avoid auth patterns like:
- shared API keys with no scoping
- hardcoded tokens
- trusting network location alone
- session auth that only works in your internal browser app
Why: public APIs need least-privilege, revocation, auditability, and safer key handling.
5. Weak authorization boundaries
Avoid assuming:
- “if they can call the endpoint, they can see everything”
- filtering data only in the UI
- missing object-level authorization checks
Why: internal tools often have broad access, but public APIs must enforce access per resource and per action.
6. No rate limiting or abuse controls
Avoid launching without:
- rate limits
- quota controls
- request size limits
- pagination limits
- bot/abuse protections where needed
Why: public APIs attract accidental and intentional load.
7. Unclear error handling
Avoid:
- generic 500s for everything
- inconsistent error formats
- HTTP status codes that don’t match the failure
- returning raw exception messages
Why: public developers need actionable, machine-readable errors.
8. Assuming trusted clients
Avoid client-side-only enforcement for:
- validation
- permissions
- business rules
- idempotency
Why: public API clients are untrusted and can call anything directly.
9. No observability or audit trail
Avoid going public without:
- request IDs
- logs tied to auth principals
- metrics for latency/errors
- audit logs for sensitive operations
Why: support and incident response become much harder once external users depend on the API.
10. Tight coupling to your internal workflow
Avoid exposing APIs that mirror internal admin processes exactly, such as:
- internal state transitions that are not meaningful externally
- workflow steps users should not manage directly
- “create then manually fix later” patterns
Why: external consumers need a stable business-oriented interface.
11. Undocumented behavior
Avoid relying on:
- tribal knowledge
- “ask the team in Slack”
- hidden assumptions around time zones, casing, sorting, nulls, etc.
Why: public APIs need explicit documentation and examples.
12. Making breaking changes silently
Avoid:
- renaming fields
- altering enums
- changing pagination behavior
- adding required fields
- changing default sort/filter behavior
Why: even “small” changes can break integrations.
Good default practices if public is possible
- Design stable resource names and schemas
- Use explicit versioning from the start
- Enforce authn/authz at the API layer
- Add rate limits and quotas early
- Standardize errors
- Keep internal and public models separated if possible
- Write docs as you build
- Track request IDs and audit logs
- Treat every field as part of a contract
Rule of thumb
If you wouldn’t want an unknown external developer to depend on it for years, don’t expose it as-is.
If you want, I can also give you:
- a checklist for “internal → public API readiness”, or
- a list of common design mistakes with examples.