GraphQL basics
GraphQL basics
One endpoint
All GraphQL operations go to a single endpoint:
The server accepts POST, GET, and multipart form transports. For nearly
everything you want POST with Content-Type: application/json.
Scope wrapping
The root schema exposes each API scope as a nullable field:
Every operation in the User API section is nested
under user { ... }:
Request shape
Response shape
Success:
Scope-level error — the scope field returns null and GraphQL errors are
populated:
Warning
Scope roots are nullable by design. If your client treats data.user as
non-null it will crash on any scope-level error. Always check for null
before dereferencing scope fields.
Transport-level errors
These do not return a GraphQL body — they’re plain HTTP errors from the middleware:
| Code | Message | Cause |
|---|---|---|
| 401 | Missing token |
no Authorization header |
| 401 | Invalid token |
token expired, bad signature, or session gone |
Anything else (validation errors, business-logic errors, permission errors)
comes back as a 200 with the errors array populated.
File uploads
The file.upload mutation takes a GraphQL Upload! scalar. Use the
GraphQL multipart request spec
format. See the files/upload page
for a minimal curl example.