Skip to content

Authentication

Every v1 call is a Bearer token on https://www.brainpercent.app/api/v1. Keys are minted in the app. A key cannot create another key.

01Bearer token

Send Authorization: Bearer bp_… on every request.

curl https://www.brainpercent.app/api/v1/projects \
  -H "Authorization: Bearer bp_your_key"

02Key format

bp_ plus 64 hex characters. Shown once at creation. The server stores a SHA-256 hash, so a lost key cannot be recovered. Revoke it and mint another.

03Creating keys

Mint and revoke on Developer settings. Those routes read the signed-in session cookie. A Bearer header against /api/v1/api-keys does not authenticate, and the body is a flat { "error": "…" }, not the envelope below.

A key created without an explicit permissions list gets ["read"]. Every write then returns 403. You can hold ten active keys.

04Permissions and scopes

A request needs both the HTTP permission and the resource scope.

PermissionMethodsWhat it covers
readGETList and fetch articles, social, projects, credits, usage
writePOSTGenerate articles, generate social, publish
deleteDELETENone of the Bearer routes require it. Revoke is session-only.
ScopeRoutes
articles/api/v1/articles/*
social/api/v1/social/*
projects/api/v1/projects/*
user/api/v1/user/credits, /api/v1/user/usage

05Error envelope

StatusCodeMeaning
400VALIDATION_ERRORBody or query failed validation
400NO_PROJECTNo project yet. Create one in the app.
401UNAUTHORIZEDMissing or invalid key
402INSUFFICIENT_CREDITSWallet cannot cover the job
403FORBIDDENMissing permission or scope, or consent required
404NOT_FOUNDMissing, or not yours
409CONFLICTAlready in the target state
412PRECONDITION_FAILEDNot ready, or a channel is missing
429RATE_LIMIT_EXCEEDEDToo many requests. Retry-After is set.
500INTERNAL_ERRORQuote the request_id
429Rate limit
{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Please slow down."
  },
  "meta": {
    "request_id": "req_abc123",
    "timestamp": "2026-02-01T00:00:00Z"
  }
}

06Response headers

HeaderMeaning
X-Request-IdQuote this in any report
X-RateLimit-LimitRequests allowed this minute
X-RateLimit-RemainingRequests left this minute
X-RateLimit-ResetUTC epoch seconds when the minute resets
X-RateLimit-Daily-LimitDaily allowance. Omitted when unlimited.
X-RateLimit-Daily-RemainingDaily left. Omitted when unlimited.
Retry-AfterOn 429 only

07Rate limits

Per API key, not per account. Generation still costs credits.

PlanPer minutePer day
Free1005,000
Starter, Plus, Pro, Business100050,000
Enterprise10000Unlimited

08CORS

HeaderValue
Access-Control-Allow-Origin*
Access-Control-Allow-MethodsGET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-HeadersAuthorization, Content-Type, X-Request-Id
Access-Control-Max-Age86400