Skip to content

API Keys

API keys provide programmatic access to the Shoehorn API for automation, CI/CD pipelines, and service-to-service communication.

API keys follow the format: shp_svc_<72-character-random-string>

  • The shp_svc_ prefix identifies it as a Shoehorn service key
  • Keys are shown only once at creation time
  • Keys are stored as bcrypt hashes (cost 12)
  1. Navigate to Admin > API Keys
  2. Click Create API Key
  3. Enter a name and description
  4. Select scopes
  5. Optionally set an expiration date
  6. Click Create
  7. Copy the key immediately (it won’t be shown again)
Terminal window
curl -X POST https://shoehorn.example.com/api/v1/admin/api-keys \
-H "Authorization: Bearer <session-token>" \
-H "Content-Type: application/json" \
-d '{
"name": "CI/CD Pipeline",
"description": "Used by GitHub Actions",
"scopes": ["catalog:read", "catalog:write"],
"expires_at": "2026-12-31T00:00:00Z"
}'

Include the key in the Authorization header:

Terminal window
curl https://shoehorn.example.com/api/v1/entities \
-H "Authorization: Bearer shp_svc_xxxxxxxxxxxx"

Scopes define what an API key can access. Use the minimum scopes needed.

ScopeDescription
catalog:readRead entities, search, stats
catalog:writeCreate and update entities
catalog:adminDelete entities
forge:readRead molds and workflow runs
forge:writeCreate and execute workflows
forge:adminDelete molds and runs
repositories:readRead repository data
repositories:writeUpdate repository data
repositories:adminFull repository management
k8s-agents:readRead cluster and agent data
k8s-agents:createRegister new clusters
k8s-agents:updateUpdate agent configuration
k8s-agents:deleteRemove clusters
k8s-agents:writeCreate, update, delete agents
k8s-agents:adminFull agent management
operations:readRead workloads and GitOps data
operations:writeUpdate operations resources
operations:adminFull operations management
admin:readRead settings and audit logs
admin:writeUpdate settings and manage users
internal:serviceService-to-service communication

Higher scopes include all permissions of lower scopes:

resource:admin -> resource:write -> resource:read

For example, catalog:admin grants catalog:write and catalog:read automatically.

Terminal window
curl https://shoehorn.example.com/api/v1/admin/api-keys \
-H "Authorization: Bearer <token>"

Keys are listed with their prefix (first 12 characters) for identification, not the full key.

Terminal window
curl -X DELETE https://shoehorn.example.com/api/v1/admin/api-keys/<key-id> \
-H "Authorization: Bearer <token>"

Revoked keys are immediately invalid. The revocation is recorded with a timestamp.

  • Maximum 25 active keys per user
  • Key expiration is optional (keys can be permanent)
  • All key usage is logged with last_used_at timestamp
  • Keys are hashed with bcrypt (cost 12) before storage
  • Key lookups use a prefix index for performance
  • Failed authentication returns a generic error (prevents enumeration)
  • Successful key validations are cached for 5 minutes (SHA256 of key)
  • last_used_at is updated asynchronously (does not block requests)
Use CaseRecommended Scopes
CI/CD entity updatescatalog:read, catalog:write
Terraform providercatalog:admin, k8s-agents:admin
Read-only dashboardcatalog:read, operations:read
K8s agentk8s-agents:write, operations:write
Monitoring integrationcatalog:read, operations:read