API & Agent Resources
go.spaced.school is the landing site of SPACED — a Kazakhstan-based full-cycle online school for grades 5–11. The site is static HTML. It exposes exactly one public API endpoint (an analytics proxy, documented below) and a set of machine-readable content resources for AI agents and crawlers.
meta-capi — Meta Conversions API proxy
A Supabase Edge Function (Deno) that receives analytics events from the static landing
pages and forwards them to the Meta (Facebook) Graph API
(graph.facebook.com/v18.0/{pixel_id}/events). It exists for first-party
conversion tracking, not for general data access.
Authentication
None. The endpoint is public (no JWT, no API key) because it is called directly from visitors' browsers. There is nothing to register for and no credentials are issued.
CORS
Access-Control-Allow-Origin: *Access-Control-Allow-Methods: POST, OPTIONSAccess-Control-Allow-Headers: authorization, x-client-info, apikey, content-typeOPTIONSpreflight returns an empty response with the CORS headers.
Request
Content-Type: application/json. Body schema:
| Field | Type | Required | Description |
|---|---|---|---|
event_name |
string | yes | Must be one of the allowed events listed below; anything else is rejected. |
event_id |
string | yes | Max 100 characters. A UUID generated client-side, used for deduplication
against the browser Meta Pixel event with the same eventID. |
event_source_url |
string | no | URL of the page that produced the event. |
user_data |
object | no | Optional keys: fbp, fbc, external_id,
em, ph, fn, ln,
client_user_agent. The PII fields (em, ph,
fn, ln) must already be SHA-256 hashed on the client. |
custom_data |
object | no | Arbitrary key–value pairs forwarded as Meta custom_data. |
Allowed events
PageView ViewContent InitiateCheckout Lead Schedule Purchase Subscribe CompleteRegistration
Server-side enrichment
The function adds these fields itself before forwarding to Meta:
user_data.client_ip_address— fromx-forwarded-for(first entry), falling back tocf-connecting-ip, thenx-real-ip;user_data.client_user_agent— from the request'sUser-Agentheader;event_time— current Unix timestamp;action_source— always"website".
Example
curl -X POST \
https://amwwtwlsuwcgmfvubrye.supabase.co/functions/v1/meta-capi \
-H "Content-Type: application/json" \
-d '{
"event_name": "PageView",
"event_id": "3a3a6c1e-9d3f-4f8a-b1f0-1c2d3e4f5a6b",
"event_source_url": "https://go.spaced.school/",
"user_data": { "fbp": "fb.1.1700000000000.1234567890" },
"custom_data": { "content_category": "home" }
}'
Responses
| Status | Body | When |
|---|---|---|
200 |
{"ok": true, "meta": {…}} |
Event accepted by the Meta Graph API; meta is Meta's raw response. |
200 |
{"ok": false, "status": <n>, "meta": {…}} |
Meta returned an error. Still HTTP 200 by design — the proxy never blocks the browser. |
200 |
{"ok": false, "error": "…"} |
The upstream fetch to Meta threw an exception. |
400 |
{"error": "Invalid JSON"} / {"error": "Invalid event_name"} / {"error": "Invalid event_id"} |
Malformed body or failed validation. |
405 |
{"error": "Method not allowed"} |
Any method other than POST or OPTIONS. |
500 |
{"error": "Server not configured"} |
Server-side environment variables for Meta are missing. |
Browser client
Pages on this site call the endpoint via
/spaced-meta.js
(window.spacedMeta.track(eventName, customData, pii)), which generates the
event_id, fires the browser Meta Pixel with the same ID for deduplication,
and SHA-256-hashes any PII client-side before sending.
Content resources for AI agents
These static, machine-readable resources describe SPACED school and this site. They are served directly by the host at exact URLs (no SPA routing involved):
| Resource | Type | Purpose |
|---|---|---|
| /llms.txt | text/plain | Concise verified facts about SPACED school for LLMs (llms.txt convention). |
| /llms-full.txt | text/plain | Full reference: programs, pricing, FAQ, and guidance on how to cite SPACED. |
| /for-llm/ | text/html | Human- and agent-readable page with structured, verified facts about the school. |
| /sitemap.xml | application/xml | List of all public pages on this site. |
| /.well-known/api-catalog | application/linkset+json | RFC 9727 API catalog pointing at this documentation and the resources above. |
| /robots.txt | text/plain | Crawler access policy — AI crawlers are explicitly welcome. |
| /auth.md | text/markdown | Authentication discovery document: no protected APIs, anonymous access only. |
https://go.spaced.school/docs/api.html. Unknown directory-style paths on
this domain are redirected by the SPA shell to https://www.spaced.school/,
so always use exact file URLs when fetching resources listed here.