v1.0.1
REST APIv1.0.0

API Key Management & Lifecycle

Creating, authenticating with, listing, and revoking developer API keys in BehaviorSim.

Developer API keys allow automated scripts, CLI executions, and backend microservices to interact with BehaviorSim without user intervention.

Need an API key?Generate, inspect, and revoke developer keys directly in your account dashboard.
Manage API Keys →

API Key Format

All developer API keys generated by BehaviorSim use a standard deterministic prefix:

Format: bs_live_<32-char-random-secret>

Authenticating Requests

Pass your raw API key in the Authorization HTTP request header using the standard Bearer scheme:

terminal
curl -X POST https://api.behavioursim.vedaangsharma.in/v1/simulations \
  -H "Authorization: Bearer bs_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"preset": "finance", "num_interactions": 50}'

Lifecycle Operations

  • Creation (POST /v1/api-keys): Generates a key record and returns the raw secret string exactly once.
  • Listing (GET /v1/api-keys): Returns metadata (ID, name, prefix, creation date, last used date). Raw secrets are never stored in plaintext and cannot be retrieved after creation.
  • Revocation (DELETE /v1/api-keys/{id}): Immediately deactivates the key from authenticating future requests.

Security Best Practices

Never Commit API Keys to Public Source Repositories

Always load your API key from environment variables (e.g. BEHAVIORSIM_API_KEY). Never hardcode API keys into client-side browser code or public GitHub repositories.