Quickstart
Your first request, three ways.
1. curl
curl -X POST https://testnet-api.geobrowser.io/graphql \
-H "Content-Type: application/json" \
-d '{"query": "{ spaces(first: 3) { id type } }"}'
You should get back something like:
{
"data": {
"spaces": [
{ "id": "a19c345ab9866679b001d7d2138d88a1", "type": "PERSONAL" },
{ "id": "41e851610e13a19441c4d980f2f2ce6b", "type": "DAO" },
{ "id": "...", "type": "PERSONAL" }
]
}
}
2. JavaScript / TypeScript
async function gql(query: string, variables?: Record<string, unknown>) {
const res = await fetch("https://testnet-api.geobrowser.io/graphql", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query, variables }),
});
const json = await res.json();
if (json.errors) throw new Error(JSON.stringify(json.errors));
return json.data;
}
const data = await gql(`{ spaces(first: 3) { id type } }`);
console.log(data.spaces);
Always use variables instead of string interpolation when your query has user-controlled values — it's safer and catches type errors at query time.
3. GraphQL playground (in-browser exploration)
Point any GraphQL client (Apollo Sandbox, Insomnia, Postman, etc.) at https://testnet-api.geobrowser.io/graphql and you get a live editor with type-ahead, schema docs, and query history. Great for poking around when you're trying to figure out what fields exist.