1| 2| 3| 4| 5| 6| MapleSpike — API Documentation: Quickstart, Reference, MCP Setup 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 36| 37| 38| 39| 40| 61| 62|
63| 64| 65|
66| [00] 67| Quickstart 68| LIVE 69|
70|

One API key.
65 Canadian government data modules. Every response cited.

71| 72|

Get an API key, make your first call, and see the citation contract — in under 5 minutes.

73| 74|
75|// 30-second quickstart

76|$ curl -s https://api.maplespike.ca/v1/gov/search \
77|  -H "X-API-Key: ms_live_..." \
78|  -G -d "query=housing" \
79|  -d "jurisdiction=federal" \
80|  -d "_limit=2" | jq .

81|{
82|  "success": true,
83|  "data": { "releases": [...] },
84|  "quality": { "freshness_seconds": 47, "confidence": "high" },
85|  "citation": {
86|    "source_name": "open.canada.ca",
87|    "data_hash": "sha256:a1f3...",
88|    "license": "OGL-C"
89|  }
90|} 91|
92| 93|
94| No key? 95| Get one free at workspace.html — 1,000 calls/month included. Or pass _mock=true for sample data with no upstream hit. 96|
97| 98| 99|
100| [01] 101| Authentication 102|
103|

Multiple ways to authenticate

104|

Four authentication methods, one JWT token format. All methods issue the same JWT — pick the one that fits your use case.

105| 106|

API Key (recommended for servers)

107|

Create a key from the workspace, then send it as the X-API-Key header:

108|
109|$ curl -H "X-API-Key: ms_live_..." https://api.maplespike.ca/v1/health 110|
111| 112|

OAuth (recommended for web apps)

113|

Sign in with GitHub, Google, or any OIDC provider. Redirect to the provider, get a JWT on callback:

114|
115|# List configured providers
116|$ curl https://api.maplespike.ca/v1/auth/oauth/providers

117|# Redirect user to provider (browser):
118|GET /v1/auth/oauth/github 119|
120|

Configure providers via MAPLESPIKE_OAUTH_{NAME}_CLIENT_ID env vars.

121| 122|

Web3 Wallet (sign-in with Ethereum)

123|

Sign a SIWE (EIP-4361) message with your wallet, verify the signature, get a JWT:

124|
125|# Request a challenge
126|POST /v1/auth/web3/challenge { "address": "0x..." }

127|# Sign the message with your wallet, then:
128|POST /v1/auth/web3/login { "message": "...", "signature": "0x...", "address": "0x..." } 129|
130| 131|

Passkey / FIDO2 (biometric)

132|

Register a passkey (Touch ID, Windows Hello, Android biometric, YubiKey), then authenticate with it:

133|
134|# Register a passkey
135|POST /v1/auth/passkey/register/begin { "userId": "...", "userName": "..." }
136|POST /v1/auth/passkey/register/complete { "registrationId": "...", "credential": { ... } }

137|# Authenticate
138|POST /v1/auth/passkey/login/begin
139|POST /v1/auth/passkey/login/complete { "loginId": "...", "credential": { ... } } 140|
141|

Works with Bitwarden, iCloud Keychain, Google Password Manager, Windows Hello, and any FIDO2 authenticator.

142| 143|

All methods issue JWTs with the same format. Use the token as a Bearer header or session cookie. Keys are hashed with SHA-256 at rest.

144| 145| 146|
147| [02] 148| Request + Response 149|
150|

One envelope. Every endpoint.

151|

Every response carries the same structure — data, quality score, citation metadata, and usage info. Your agent always knows where the answer came from.

152| 153|

Response shape

154|
155|{
156|  "success": true,
157|  "data": { /* structured payload */ },
158|  "quality": {
159|    "freshness_seconds": 47,
160|    "confidence": "high",
161|    "certainty_score": 0.923
162|  },
163|  "citation": {
164|    "source_name": "open.canada.ca",
165|    "source_url": "https://...",
166|    "data_hash": "sha256:a1f3...",
167|    "license": "OGL-C"
168|  },
169|  "meta": {
170|    "creditsCharged": 0,
171|    "cacheStatus": "hit"
172|  }
173|} 174|
175| 176| 177|
178| [03] 179| API Reference 180|
181|

REST endpoints

182| 183| 184| 185| 186| 187| 188| 189| 190| 191| 192|
MethodPathDescription
GET/v1/healthSystem status and usage
GET/v1/gov/releasesLatest government data releases
GET/v1/gov/search?query=Search across all sources
GET/v1/citation/:hashVerify a data point by SHA-256 hash
GET/v1/usageUsage and quota info
GET/v1/keysList API keys
POST/v1/keysCreate a new API key
GET/v1/auth/meCurrent user profile
193| 194| 195|
196| [04] 197| Token Optimization 198|
199|

Trim responses for AI agents

200|

Every token saved is money earned. These params go in the same request body — they're extracted before validation.

201| 202| 203| 204| 205| 206| 207| 208| 209|
ParamTypeEffect
_fieldsstring[]Return only named fields
_format"full" \ "compact"Compact strips null/empty
_limitnumberCap array results
_pagenumberPagination offset
_summarybooleanReturn aggregates, not rows
_mocktrueSample data, free, no upstream hit
210| 211| 212|
213| [05] 214| Citation Contract 215|
216|

Every response. Every endpoint. Verifiable.

217|

Every MapleSpike endpoint returns the same citation block — whether you're using the REST API, MCP tools, or cross-reference engine. One integration gives you auditable data across the stack.

218|
219|
   220|{
   221|  "success": true,
   222|  "data": { ... },
   223|  "citation": {
   224|    "source_name": "open.canada.ca",
   225|    "source_url": "https://open.canada.ca/...",
   226|    "retrieved_at": "2026-05-13T12:00Z",
   227|    "data_hash": "sha256:a1f3...",
   228|    "license": "OGL-C",
   229|    "update_frequency": "daily",
   230|    "original_format": "JSON",
   231|    "citation_text": "open.canada.ca, retrieved 2026-05-13. OGL-C. https://...",
   232|    "citation_footnote": "open.canada.ca, May 2026"
   233|  }
   234|}
   235|  
236| 237|

data_hash is the SHA-256 of the response payload at fetch time. Re-fetch the source yourself and compare — if hashes match, you saw what we saw, byte-for-byte.

238| 239| 240|
241| [06] 242| MCP Tools 243| 22 TOOLS 244|
245|

Data tools for AI agents

246|

All tools return the same { data, quality, citation } envelope. Connect any MCP client — or use the REST API directly:

247| 248|
249|{
250|  "mcpServers": {
251|    "maplespike": {
252|      "command": "npx",
253|      "args": ["@maplespike/mcp"],
254|      "env": { "MAPLESPIKE_API_KEY": "ms_live_..." }
255|    }
256|  }
257|} 258|
259| 260| 261| 262| 263| 264| 265| 266| 267| 268| 269| 270| 271| 272| 273| 274| 275| 276| 277|
CategoryToolDescription
Generalquery_gov_dataSearch StatCan, CKAN, provincial portals
Generalfact_checkVerify claims against official data
Generalget_citationRetrieve SHA-256 citation hash
Generallatest_releasesRecent government releases
Parliamentsearch_committeesHoC + Senate committees, evidence, in-camera
Corporatesearch_corporateLobbying, procurement, exec statements
Influencesearch_influence32 tracked actors, funding, connections
Regulatorysearch_gazetteCanada Gazette Parts I+II regulations
Appointmentssearch_gicGovernor-in-Council appointments
Electionssearch_electionsThird-party advertising, spending
Provincialsearch_provincial_lobbyingON lobbying registry (BC/QC stubbed)
Oversightsearch_oversightOAG, PBO, Ethics, CB, CRTC reports
Legalsearch_canliiCourt decisions, citations via CanLII
Cross-Referencesearch_cross_referenceSearch all modules at once — entity timeline across lobbying, GIC, committees, contracts, elections
Laboursearch_lmiaLMIA quarterly data, TFW program
278| 279| 280|
281| [07] 282| Rate Limits 283|
284|

Per-plan caps

285|

Rate limits are per-second and per-month. Hitting the per-second limit returns 429 with a Retry-After header.

286| 287| 288| 289| 290| 291| 292|
PlanPer secPer monthOverage
Free2/s1,000Hard cap (402)
Pro25/s50,000$1/1K (planned)
Business100/s250,000$0.80/1K (planned)
EnterpriseCustomCustomNegotiated
293| 294| 295|
296| [08] 297| Errors 298|
299|

One shape. Specific categories.

300|

All error responses carry success: false, a stable error code, and a human-readable message.

301| 302| 303| 304| 305| 306| 307| 308| 309| 310|
CodeStatusRetryMeaning
auth_invalid401NoFix API key or JWT
rate_limited429YesRespect Retry-After header
quota_exhausted402NoUpgrade plan or wait for reset
input_invalid400NoCheck input schema
source_unavailable502YesUpstream source down, retry later
not_found404NoResource doesn't exist
server_error500YesBackoff, report if persistent
311| 312| 313|
314| [09] 315| FAQ 316|
317|

Common questions

318| 319|
320|

Do I need a credit card to start?

321|

No. Free plan: 1,000 calls/month, every source, every SDK, citation hashes included. No card, no time limit.

322|
323| 324|
325|

What makes the citations verifiable?

326|

Every response includes source name, exact upstream URL, retrieval timestamp, and a SHA-256 content hash. You can re-fetch and confirm exactly what the agent saw.

327|
328| 329|
330|

Which AI frameworks are supported?

331|

MCP (Claude, Cursor, Windsurf, ChatGPT), Anthropic tool_use, OpenAI function calling. TypeScript and Python SDKs.

332|
333| 334|
335|

How fresh is the data?

336|

Depends on the source. Committee evidence: ~24h. Canada Gazette: within hours of publication. CanLII: daily. Every response ships with a freshness_seconds field so your agent always knows.

337|
338| 339|
340|

What is the cross-reference engine?

341|

Search for any person or company and get their complete government footprint — lobbying meetings, committee testimony, GIC board appointments, procurement contracts, court cases, and campaign donations — in a unified timeline. One call replaces manually querying 63 separate modules.

342|
343| 344|
345|

Is my API key secure?

346|

Keys are hashed with SHA-256 at rest — we only see them at verify time. HTTPS-only transit. Rotate from the workspace instantly.

347|
348| 349|
350| 351| 390| 391| 392| 393| 394| 395|