Skip to main content

signaloid-cli keys validate

Validate a Signaloid API key.

Synopsis

signaloid-cli keys validate --api-key <KEY>

Description

Validates whether a Signaloid API key is valid and active. This is useful for verifying keys before using them in automated scripts or checking if a key has been revoked or expired.

Options

OptionDescription
--api-key <KEY>API key to validate (required)

Output

Displays a success or failure message indicating whether the key is valid.

Valid Key

✓ API key is valid.

Invalid Key

✗ Invalid API key.
You can create a new API key using: signaloid-cli keys create --name <MyKey>
or directly from your account settings at: https://signaloid.io/settings/api

Exit Codes

CodeDescription
0API key is valid
1API key is invalid or validation failed

Examples

Validate an API Key

signaloid-cli keys validate --api-key scce_abc123xyz...

Use in Script for Validation

#!/bin/bash

API_KEY="scce_abc123..."

if signaloid-cli keys validate --api-key "$API_KEY" 2>/dev/null; then
echo "Key is valid, proceeding..."
# Continue with operations using this key
else
echo "Key is invalid or expired"
exit 1
fi

Key Rotation Workflow

#!/bin/bash
# Rotate API keys with validation

OLD_KEY="$1"
NEW_KEY="$2"

echo "API Key Rotation"
echo "================"

# Verify old key is still valid
echo "Checking old key..."
if ! signaloid-cli keys validate --api-key "$OLD_KEY"; then
echo "Warning: Old key is already invalid"
fi

# Verify new key is valid
echo "Validating new key..."
if ! signaloid-cli keys validate --api-key "$NEW_KEY"; then
echo "Error: New key is invalid"
exit 1
fi

echo "New key validated. Updating configuration..."
# Update your configuration here
echo "export SIGNALOID_API_KEY='$NEW_KEY'" > ~/.signaloid_key

echo "Key rotation completed"

Common Use Cases

CI/CD Pipeline Validation

Before running builds or deployments:

# GitHub Actions example
- name: Validate API Key
run: |
if ! signaloid-cli keys validate --api-key "${{ secrets.SIGNALOID_API_KEY }}"; then
echo "Invalid API key in secrets"
exit 1
fi

Security Considerations

Never Log API Keys

# ❌ Bad - key exposed in output
echo "Validating key: $API_KEY"
signaloid-cli keys validate --api-key "$API_KEY"

# ✅ Good - key not exposed
echo "Validating API key..."
signaloid-cli keys validate --api-key "$API_KEY" 2>/dev/null

Use Environment Variables

# ✅ Store key in environment
export SIGNALOID_API_KEY="scce_..."

# Validate without hardcoding
signaloid-cli keys validate --api-key "$SIGNALOID_API_KEY"

Troubleshooting

Key Format Issues

Ensure the key has the correct format:

  • Should start with scce_
  • Contains only alphanumeric characters and underscores
  • No extra whitespace or quotes

Network Issues

If validation fails due to network issues:

# Add timeout and retry logic
for i in {1..3}; do
if signaloid-cli keys validate --api-key "$API_KEY"; then
break
fi
echo "Retry $i/3..."
sleep 2
done

See Also