Authentication
The Promptic API supports two authentication methods.
API key (recommended)
Pass your API key as a Bearer token in the Authorization header:
curl https://promptic.eu/api/v1/components \
-H "Authorization: Bearer pk_live_..."Create API keys in your workspace settings. Each key is scoped to a single workspace.
Using the SDK
The Python SDK resolves the API key automatically from environment variables or the config file:
from promptic_sdk import PrompticClient
# Reads PROMPTIC_API_KEY env var or ~/.promptic/config.toml
with PrompticClient() as client:
components = client.list_components()
# Or pass explicitly
with PrompticClient(api_key="pk_live_...") as client:
components = client.list_components()For tracing, pass the key to init() or set the env var:
import promptic_sdk
promptic_sdk.init(api_key="pk_live_...")
# or: export PROMPTIC_API_KEY="pk_live_..."Session authentication
For browser-based integrations, use session cookies with the X-Workspace-Id header:
curl https://promptic.eu/api/v1/components \
-H "Cookie: your-session-cookie" \
-H "X-Workspace-Id: WORKSPACE_ID"The SDK supports session auth via the access_token and workspace_id parameters:
with PrompticClient(access_token="...", workspace_id="...") as client:
...Auth priority
The SDK resolves credentials in this order:
access_token+workspace_id(session auth)api_keyargumentPROMPTIC_ACCESS_TOKEN+PROMPTIC_WORKSPACE_IDenv varsPROMPTIC_API_KEYenv var~/.promptic/config.toml
Error responses
If authentication fails, the API returns 401:
{
"error": "Invalid or missing API key"
}See the full API Reference for all available endpoints.