Skip to main content

Service Accounts

Service accounts enable automated systems (robots, scripts, integrations) to authenticate with Switchyard using API keys.

Overview

Service accounts provide:
  • API Key Authentication: No user interaction required
  • Role-based Permissions: Inherit permissions from assigned role
  • Audit Trail: Track last usage timestamp
  • Secure Storage: API keys are hashed before storage

Creating a Service Account

Use the CLI tool:
Output:
The API key is only shown once at creation. Store it securely - it cannot be retrieved later.

Managing Service Accounts

Using a Service Account

Authentication

Making API Calls

Database Schema

Security Best Practices

Create new service accounts periodically and revoke old ones to minimize exposure from compromised keys.
Assign the minimum role required. Use robot role for automated systems instead of superadmin.
Regularly check last_used_at to identify unused accounts that should be revoked.
Store API keys in environment variables or secrets managers, never in code.

Troubleshooting

API Key Not Working

Possible causes:
  • Typo in API key
  • Service account is inactive (is_active = false)
  • Role not assigned
Solutions:
  1. Verify the key is correct (only shown once at creation)
  2. Check is_active in the database
  3. Verify role_id is set