Start

API and MCP

Ask your files from code over the API, or from an agent over MCP, with the key the demo gives you. The samples on this page name this site, so they work as you copy them.

The API host

https://api.groundwork.computer serves the API alone: web fetch and search, projects and keys, with /openapi.json and /llms.txt. The same calls also work on this site.

An id.orgsoft.org key, om_sk_…, opens all of it. Each call is charged to its account, from the Greenfield Pro allowance first and then purchased credit, and the reply says what it cost. Call it from your server: requests from a browser page are refused.

sh
curl -X POST https://api.groundwork.computer/v1/web/fetch \
  -H "Authorization: Bearer $OM_KEY" -H "content-type: application/json" \
  -d '{"url": "https://example.com"}'

curl -X POST https://api.groundwork.computer/v1/web/search \
  -H "Authorization: Bearer $OM_KEY" -H "content-type: application/json" \
  -d '{"query": "retrieval evals", "limit": 5}'
Endpoint Body Returns
POST /v1/web/fetch { "url" } url, title, text, and meta.charge_usd
POST /v1/web/search { "query", "limit" } results, each with title, url and snippet
POST /v1/projects { "slug", "name" } The new project
POST /v1/keys { "project", "scopes" } A project key, shown once
POST /v1/projects/{project}/add { "text" }, { "url" } or { "file", "name" } The file added
POST /v1/projects/{project}/search { "query", "k" } passages, best first
POST /v1/projects/{project}/ask { "prompt" } answer with [^s1] markers, and sources

The id key works as its account's organization key, so the project calls below take it in place of gwo_….

Projects

An app with clients of its own uses projects. Each project is isolated: its own files, index and build, and nothing in it is read by another project. Make one for each client.

An organization key, gwo_…, makes projects and keys. It comes from us, is shown once, and belongs on your server. A project key, gwp_…, opens one project, to read (search and ask), write (add and build) or both.

sh
curl -X POST https://<demo>/v1/projects \
  -H "Authorization: Bearer $GW_ORG_KEY" -H "content-type: application/json" \
  -d '{"slug": "halvorsen-riley"}'

curl -X POST https://<demo>/v1/keys \
  -H "Authorization: Bearer $GW_ORG_KEY" -H "content-type: application/json" \
  -d '{"project": "halvorsen-riley", "scopes": ["read", "write"]}'

Add text or files, build, then ask:

sh
curl -X POST https://<demo>/v1/projects/halvorsen-riley/add \
  -H "Authorization: Bearer $GW_KEY" -H "content-type: application/json" \
  -d '{"title": "1:1 with Dana", "text": "Riley Moreno: Before you start…"}'

curl -X POST https://<demo>/v1/projects/halvorsen-riley/build -H "Authorization: Bearer $GW_KEY"

curl -X POST https://<demo>/v1/projects/halvorsen-riley/ask \
  -H "Authorization: Bearer $GW_KEY" -H "content-type: application/json" \
  -d '{"prompt": "What are Riley'"'"'s growth edges in the meetings?", "format": "json"}'

ask takes a prompt, and optionally instructions for how the answer reads, messages for earlier turns, a mode of chat, agent or auto, and a format of json or csv with a schema or columns. Nothing is stored between calls: your app keeps the conversation.

To rotate a key, make a new one, switch to it, then revoke the old one with DELETE /v1/keys/{id}.

Try it with a session

Start a session from code. It returns a key, shown once:

sh
curl -X POST https://<demo>/v1/sessions
export GW_KEY=gwd_…

Or add files at /demo/start, let them build, and choose Make a key in the Use step.

The key opens only that session's files, and stops working when the session is deleted, after three idle hours. A new key from the page replaces the old one. Every call sends it as Authorization: Bearer $GW_KEY. Keep it in that environment variable rather than in code or a chat.

Ask

Ask from code with the API, or add the MCP server to an agent.

curl -X POST https://<your site>/v1/ask \
  -H "Authorization: Bearer $GW_KEY" \
  -H "content-type: application/json" \
  -d '{"question": "What do these files say about refunds?"}'

Endpoints

Endpoint Body Returns
POST /v1/sessions None, and no key key, expiresAt, limits
GET /v1/build None state, built, steps, files
POST /v1/ask { "question", "instructions", "thread" } answer in Markdown with [^s1] markers, sources, run
POST /v1/search { "query", "k" } passages, best first, with no model call
POST /v1/sources { "from" }, a link or notion, slack or drive added, or wait with a signIn link to open first
PUT /v1/files?name= The file's bytes added
POST /mcp MCP over streamable HTTP The ask, search and add tools

Search costs nothing and keeps working after the key's answers are used up.

Add files and sources

Adding a file or a source builds the index again on its own. GET /v1/build says when it is done, and the next question reads it.

sh
curl -X PUT "https://<demo>/v1/files?name=handbook.pdf" \
  -H "Authorization: Bearer $GW_KEY" --data-binary @handbook.pdf

curl -X POST https://<demo>/v1/sources \
  -H "Authorization: Bearer $GW_KEY" \
  -H "content-type: application/json" \
  -d '{"from": "https://example.com/pricing"}'

A service you have not signed in to answers wait with a signIn link. Open it, then send the same call again.

Shape the answer

instructions say how the answer should read: a role to play, a length, a format. They are kept apart from the question and never change what counts as evidence. thread holds up to four earlier turns, so a follow-up is read in its conversation; reading it counts as one more answer.

sh
curl -X POST https://<demo>/v1/ask \
  -H "Authorization: Bearer $GW_KEY" \
  -H "content-type: application/json" \
  -d '{"question": "And who approves it?", "instructions": "One sentence.", "thread": [{"question": "What does a large repair cost?", "answer": "Over 500 dollars."}]}'

MCP tools

Tool Arguments What it does
ask question Answers with citations to the page, row or moment
search query, k Returns the best passages, with no model call
add from Adds a link or a service by name, then rebuilds

The MCP tab under Ask has the command for Claude Code and the settings for any other MCP client.

For agents

  • /openapi.json describes every endpoint.
  • /llms.txt lists the API with every guide.
  • Copy prompt beside the API and MCP tabs gives an agent these steps with this site's address filled in.