Skip to content

Authentication

Every request (except /health and /machine/keys/bootstrap) requires an API key passed in the X-API-Key header.

Terminal window
curl https://apis.jameslin.info/machine/snapshots \
-H "X-API-Key: mk_a1b2c3d4e5f6..."
const res = await fetch('https://apis.jameslin.info/machine/snapshots', {
headers: { 'X-API-Key': 'mk_a1b2c3d4e5f6...' },
});
mk_<64 hex characters>
  • Prefix: mk_ (machine key)
  • Body: 64 hex characters (32 random bytes)

Keys are never stored in plaintext. When a key is created:

  1. The raw key is returned to you once
  2. The key is hashed with SHA-256
  3. Only the hash is stored in the database

If you lose a key, it cannot be recovered — create a new one.

Each API key is scoped to exactly one project and carries two pieces of identity:

PropertyDescription
apiKeyIdUnique identifier for the key
projectIdThe project this key belongs to
MethodPathPurpose
GET/healthHealth check
POST/machine/keys/bootstrapCreate first project + key
StatusErrorMeaning
401Missing X-API-Key headerNo key provided
401Invalid API keyKey doesn’t match any stored hash
403Forbidden: requires one of [...]Valid key but insufficient role

See Roles & Permissions for details on what each role can access.