Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 1.22 KB

File metadata and controls

46 lines (30 loc) · 1.22 KB

API Auth Examples

All protected API calls require a bearer token.

These examples show the minimum flow: set environment variables, send token-authenticated requests, and keep scope boundaries explicit.

Permission model recap:

  • permissions are {resource}:{operation} (for example memories:read, knowledge:write)
  • shorthand read/write/edit/delete expands across all resources
  • token access is downscoped by both declared permissions and token scope restrictions

Environment variables

export POSTBRAIN_URL="http://localhost:7433"
export POSTBRAIN_TOKEN="<token>"

Basic authenticated call

Use this as your first connectivity/auth check:

curl -sS -H "Authorization: Bearer ${POSTBRAIN_TOKEN}" \
  "${POSTBRAIN_URL}/v1/principals"

Create token (server CLI)

Create dedicated tokens per workload instead of sharing one long-lived token across systems:

postbrain token create --name "automation" --principal "acme-platform"

Scope-aware usage pattern

When using clients/agents, set a default scope and keep tokens least-privilege.

export POSTBRAIN_SCOPE="project:your-org/your-repo"

This reduces accidental cross-scope access and keeps automation behavior predictable.