Skip to content

Setting Up

Authentication

How Grout Institution API requests are authenticated, the response envelope, what each error means, CORS, and how request ids help support.

Send the key as a bearer token on every request:

http
GET /v1/students HTTP/1.1
Host: serverless.grout.app
Authorization: Bearer grt_live_k3JdP8x…

There is no session, cookie or refresh token. The key identifies the institution; nothing else in the request does.

Response envelope#

json
{ "success": true, "data": { … } }
json
{ "success": false, "error": "insufficient_scope", "message": "This endpoint requires scope(s): students:write",
  "required": ["students:write"], "missing": ["students:write"] }

Validation failures use 422 validation_error with an issues array of { path, message }.

Errors#

StatuserrorMeaning
401unauthorizedNo bearer token, or the token is not a grt_ key
401invalid_api_keyUnknown, revoked, expired, or institution not approved: deliberately indistinguishable
403insufficient_scopeSee required / missing
404not_foundResource does not exist in your institution
409conflict and friendsState conflict (already added, already verified, insufficient allowance…)
422validation_error and friendsBody or query invalid
429rate_limitedHonour Retry-After
500internal_errorQuote X-Request-Id to support
503rate_limiter_unavailableTransient; retry after 5 s

Request ids#

Every response carries X-Request-Id: req_…. Log it next to your own correlation id. Support can trace a request end to end from it.

CORS#

Browser calls from *.grout.app origins are allowed, but a key must never be embedded in client-side code. Call the API from your server and expose only what your users need.

Checking a key#

GET /v1/me returns the key's name, scopes, rate limit and institution. Use it as a health check in your deploy pipeline:

bash
curl -fsS https://serverless.grout.app/v1/me -H "Authorization: Bearer $GROUT_API_KEY" > /dev/null \
  && echo "key ok"