Pcornel
Automation · APIs

API Keys

Cheat sheet · https://pcornel.dk/topic.php?topic=5312

Back to the Topic

Answer

Static or semi-static secret values used by APIs to identify and sometimes authorize a calling application or tenant.

Remember

  • API key ≠ user identity; keys often represent an application, project or tenant rather than a human.
  • Key present ≠ authorized for every operation; server-side scope or product entitlement may still deny access.
  • Key in URL ≠ safe transport; query strings leak easily into logs, history and proxies.
  • Key rotated ≠ old key unusable automatically; overlap and revocation windows may exist.

First checks

  • curl -sS -H 'X-API-Key: <key>' <url> — key header
  • Key scope and IP restrictions — limits
  • Key rotation date — age

Verify in this order

key → header → API

Where it usually breaks

Possession of a valid API key proves only access to that credential; authorization and caller attribution depend on server policy.

API Keys API boundary map

BoundaryHealthy evidenceSuspicious evidence
Caller / requestEnvironment/version, identity and exact request contract are attributableHidden defaults, wrong endpoint/version, leaked or mismatched credentials
Server / responseStatus, headers, structured body and request ID are interpreted togetherStatus-only handling, ignored error body, ambiguous async result or unsafe retry
State / proofWrite result is reconciled with resource read-back or acceptance testResponse success treated as final target success without verification
TroubleshootingFirst failed boundary is preserved, changed minimally and retestedBlind retries, credential rotation, replay or payload edits before evidence is captured

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5312

Confirmation

Confirm action

Continue?