Skip to main content

Authentication

Authenticate using a Bearer Token:
from terminaluse import Client

client = Client(token="tu_your_token_here")
Or via environment:
# Uses TERMINALUSE_API_KEY automatically
client = Client()

Getting Tokens

# After logging in via CLI, token is stored automatically
client = Client()

Token Scopes

ScopeAccess
read:agentsView agents
write:agentsCreate/update agents
read:tasksView tasks
write:tasksCreate/update tasks
adminFull access

Request Headers

The SDK sets headers automatically:
Authorization: Bearer tu_your_token_here

Token Refresh

from terminaluse import AuthenticationError

try:
    agent = client.agents.retrieve("id")
except AuthenticationError:
    # Token expired - get new token
    client = Client(token=get_new_token())

Security Best Practices

Use environment variables, not hardcoded values.
Request only the permissions you need.
Replace tokens periodically, especially for production.