Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.simplefunctions.dev/llms.txt

Use this file to discover all available pages before exploring further.

SimpleFunctions has three auth flavors depending on the surface:
SurfaceAuthHeader
Landing public + agent + thesis + portfolio + watch APIsSF API keyAuthorization: Bearer sf_live_...
Web terminal sessionsSupabase JWTAuthorization: Bearer eyJ...
Terminal data API (data.simplefunctions.dev)Data API keyAuthorization: Bearer sft_live_...
Kalshi exchangeBYOK private keyLocal-only (CLI), or AES-256-GCM encrypted upload (autopilot)
Polymarket exchangeBYOK walletLocal-only or wallet-connect on web terminal
MCPSF API keyAuthorization: Bearer sf_live_...

CLI login

sf login
Opens a browser. After authorization, the CLI receives a long-lived API key and writes it to ~/.config/simplefunctions/config.json.

Manual API key

Get one at simplefunctions.dev/dashboard/keys. Set:
export SF_API_KEY="sf_live_..."
export SF_API_URL="https://simplefunctions.dev"

HTTP

curl -H "Authorization: Bearer $SF_API_KEY" \
  https://simplefunctions.dev/api/portfolio/state

User scoping

Authenticated account and portfolio routes are scoped to the authenticated user. Do not pass userId from the client for normal reads — server-side resolution always wins.

Secrets

The CLI and API never return raw exchange private keys. Key metadata may include presence, id suffixes, or created/rotated timestamps, but never secret material.

BYOK encryption (cloud autopilot)

sf portfolio enable does:
1

Read local Kalshi PEM

From your local ~/.config/simplefunctions/config.json or environment variable.
2

Encrypt client-side

AES-256-GCM with your SF account-derived key. The plain PEM never leaves the local process.
3

Upload ciphertext

POST /api/portfolio/secrets. Server stores ciphertext only.
4

Decrypt during ticks only

Decryption happens inside an isolated Trigger.dev process during a tick, then the key is erased from process memory immediately (src/trigger/portfolio-tick.ts:451-457).

See also

API keys

Scopes and rotation.

Portfolio autopilot

Cloud autopilot setup with BYOK.

Security

Encryption and audit guarantees.