HTTP API
WWKG exposes a standards-based HTTP API for SPARQL queries, graph management, and administration. The server listens on port 4242 by default.
SPARQL Protocol endpoint
Query
Or with URL-encoded form data:
Update
Explain
Returns the query execution plan without running the query.
Graph Store Protocol
The Graph Store Protocol (GSP) provides RESTful access to named graphs.
Retrieve a graph
Replace a graph
Append to a graph
Delete a graph
Default graph
Use ?default to target the default graph:
GSP selector rules:
- Triple payloads (N-Triples, Turtle, RDF/XML): exactly one of
?defaultor?graph=<iri>is required. - Quad payloads (N-Quads, TriG; planned):
?defaultand?graph=are rejected; graph context comes from the payload.
Graph IRI policy:
- User graph IDs may use any valid IRI scheme (
urn:,http:,https:,file:, …). urn:wwkg:graph:defaultis reserved for the virtual default graph and cannot be used as a named graph ID.
Content negotiation
Request formats (Content-Type)
| MIME type | Format |
|---|---|
application/sparql-query | SPARQL query |
application/sparql-update | SPARQL update |
text/turtle | Turtle |
application/n-triples | N-Triples |
application/rdf+xml | RDF/XML |
Response formats (Accept)
| MIME type | Format | Used for |
|---|---|---|
application/sparql-results+json | SPARQL Results JSON | SELECT, ASK (default) |
text/tab-separated-values | TSV | SELECT |
text/turtle | Turtle | CONSTRUCT, DESCRIBE, GSP |
application/n-triples | N-Triples | CONSTRUCT, DESCRIBE, GSP |
Authentication
WWKG supports two caller-authentication mechanisms for privileged routes.
API token
For scripts and automation, send your API token in the x-wwkg-api-key header:
This resolves a caller identity via the server’s token index (sys:auth).
Browser session (Clerk JWT)
For the web interface (and any JWT-based integration), send:
The JWT must be verifiable by the node’s configured JWKS issuer and include the WWKG DID claim expected by server authorization.
For WWKG website integrations:
- token retrieval uses Clerk template token (
wwkgby default) - server must have
CLERK_JWKS_URLconfigured, including in local development
Without a valid JWT or API token, privileged endpoints return 401.
Branch and workspace selection
URL parameters
POST /sparql?branch=experiment
POST /sparql?workspace=urn:wwkg:workspace:550e8400-e29b-41d4-a716-446655440000
Request headers
When both a header and URL parameter are present, the header takes precedence.
Response headers
Every query response includes version metadata:
| Header | Description |
|---|---|
X-WWKG-Branch | Branch that was queried |
X-WWKG-Commit | Content ID of the commit that was queried |
X-WWKG-Timestamp | Timestamp of the commit |
X-WWKG-Root | Content ID of the database state |