docs: Clarify HTTP endpoint auth is optional, not required#4562
Merged
docs: Clarify HTTP endpoint auth is optional, not required#4562
Conversation
All /v1/database routes go through anon_auth_middleware, which allocates a new anonymous identity when no Authorization header is provided. The docs previously marked many of these as 'Required' when they actually accept anonymous requests. Changes: - authorization.md: Add paragraph explaining anonymous access for all /v1/database endpoints - database.md: Change 'Required Headers' to 'Optional Headers' for publish, delete, names, call, logs, and sql endpoints - database.md: Add 'Optional Headers' section to schema endpoint (previously had no auth documentation at all) - Each endpoint now explains what happens without auth: anonymous identity allocated, public-only access, ownership checks still enforced for privileged operations Routes that genuinely require auth (identity/websocket-token, identity/verify) are unchanged -- they use SpacetimeAuthRequired which returns 401 when no token is provided.
bfops
reviewed
Mar 5, 2026
docs/docs/00300-resources/00200-reference/00200-http-api/00100-authorization.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
bfops
reviewed
Mar 5, 2026
docs/docs/00300-resources/00200-reference/00200-http-api/00300-database.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
bfops
reviewed
Mar 5, 2026
docs/docs/00300-resources/00200-reference/00200-http-api/00300-database.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
bfops
reviewed
Mar 5, 2026
docs/docs/00300-resources/00200-reference/00200-http-api/00300-database.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
bfops
reviewed
Mar 5, 2026
docs/docs/00300-resources/00200-reference/00200-http-api/00300-database.md
Outdated
Show resolved
Hide resolved
bfops
reviewed
Mar 5, 2026
docs/docs/00300-resources/00200-reference/00200-http-api/00300-database.md
Outdated
Show resolved
Hide resolved
bfops
reviewed
Mar 5, 2026
docs/docs/00300-resources/00200-reference/00200-http-api/00300-database.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
POST /v1/identity/:identity/set-email is documented but not implemented — no route exists in identity.rs. Remove it. The remaining 'Required Headers' in identity.md are websocket-token and verify, both of which use SpacetimeAuthRequired and genuinely require auth. The only 'Required Headers' in database.md is the WebSocket protocol headers for /subscribe (not auth-related).
…kworklabs/SpacetimeDB into bot/docs-http-auth-optional
cloutiertyler
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All
/v1/databaseroutes go throughanon_auth_middleware, which allocates a new anonymous identity when noAuthorizationheader is provided. The docs previously marked many endpoints as requiring auth (Required Headers) when they actually accept anonymous requests.Code audit
Traced through
anon_auth_middlewareincrates/client-api/src/auth.rsand each route handler incrates/client-api/src/routes/database.rs:POST /v1/database(publish)PUT /v1/database/:id(publish)GET /v1/database/:id(info)DELETE /v1/database/:idGET .../namesPOST .../namesPUT .../namesGET .../identityGET .../subscribe(WS)POST .../call/:reducerGET .../schemaGET .../logsPOST .../sqlRoutes that genuinely require auth (
POST /v1/identity/websocket-token,GET /v1/identity/:id/verify) useSpacetimeAuthRequiredand are unchanged.Changes
authorization.md: Added paragraph explaining anonymous access for all/v1/databaseendpointsdatabase.md: ChangedRequired HeaderstoOptional Headersfor 8 endpoints, with per-endpoint explanations of anonymous behaviordatabase.md: Added newOptional Headerssection to/schemaendpoint (previously undocumented)