GroundlyAPI referenceBase URL https://groundly.emmapraise.com
Contents

Quick start

Ask a question about a hub’s documents and get an answer with the file and page it came from.

  1. In the dashboard, open your hub and upload a document.
  2. Under Keys and embed, create a secret key. It is shown once.
  3. Send the request on this page. The answer arrives in pieces as it is written.
Your first question
export GROUNDLY_KEY="sk_live_..."

curl -N https://groundly.emmapraise.com/v1/chat \
  -H "Authorization: Bearer $GROUNDLY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"question": "What are the visiting hours?"}'

Keys and limits

Send your key in the Authorization header. The key decides which hub is used, so you never send a hub ID.

Key types

sk_live_ secret
For your server only. Can call everything here. Refused from a browser. 120 requests a minute.
pk_live_ public
For web pages and apps. Chat and feedback only, from the sites listed on the key (or without an Origin header if the key allows mobile apps). 10 requests a minute per visitor, 120 in total.

Each workspace also has a monthly token cap. Never put a secret key in a page or a mobile app.

Every request
Authorization: Bearer sk_live_...

Website widget

A ready-made chat button. Its name, greeting, colour and logo come from the hub’s Settings.

The page must be on one of the public key’s sites. With a Content-Security-Policy, allow https://groundly.emmapraise.com in script-src, frame-src and connect-src.

Add before </body>
<script src="https://groundly.emmapraise.com/widget.js"
        data-key="pk_live_..."></script>

Errors

A failed request returns a status and detail. For 422, detail is a list of invalid fields.

Statuses

400 bad request
The file name or file is not acceptable.
401 unauthorized
The key is missing, wrong or revoked.
403 not allowed
Wrong key type, a site not on the key, or an expired chat. For an expired chat, drop conversation_id and session_token and ask again.
404 not found
No such document, conversation or answer in this key’s hub.
413 too large
Files can be at most 4 MB.
422 invalid
Fix the request body or the id.
429 slow down
Too many requests: wait for the Retry-After seconds. Or the monthly usage limit has been reached: contact Groundly.
Response
{"detail": "Missing or invalid API key."}

Ask a question

POST/v1/chat

Secret or public key

The reply is a stream of server-sent events (text/event-stream). Each data value is on one line; the example is wrapped to be readable.

Body

question string, required
1 to 4000 characters.
conversation_id string
Send it back to ask a follow-up.
session_token string
Public keys only, with conversation_id. Valid for 24 hours.

Events

token text
The next piece of the answer. Append them in order.
done conversation_id, message_id, declined, citations
The answer is complete. A public key also gets session_token.
error code, message
The answer failed after the stream began. The status is still 200, so check for this event.

Each citation has the filename, page and quoted passage. marker matches the [n] in the answer where the model provides one, and is otherwise null.

Request
curl -N https://groundly.emmapraise.com/v1/chat \
  -H "Authorization: Bearer $GROUNDLY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"question": "What are the visiting hours?"}'
Response 200
event: token
data: {"text": "Visiting hours are 10:00 to 12:00 every day."}

event: done
data: {"conversation_id": "p6sq0tynlx689jb418p1dn3v",
       "declined": false,
       "citations": [{
         "document_id": "rnm0hc4hq7aefjr60dzklhd6",
         "filename": "visiting.pdf",
         "page": 1,
         "quote": "Visiting hours are 10:00 to 12:00 every day.",
         "marker": null
       }],
       "message_id": 2,
       "session_token": "1796550098.iNGMXe93..."}

Send feedback

POST/v1/chat/feedback

Secret or public key

Record whether an answer helped.

Body

conversation_id string, required
From the done event.
message_id number, required
From the done event.
rating 1 or -1, required
Helpful or not helpful.
session_token string
Required with a public key.
Request body
{
  "conversation_id": "p6sq0tynlx689jb418p1dn3v",
  "message_id": 2,
  "rating": -1,
  "session_token": "1796550098.iNGMXe93..."
}
Response
(no body)

Upload a document

POST/v1/documents?filename=visiting.pdf

Secret key

Send the file itself as the request body, not as a form. Uploading the same content again returns the existing document.

Query

filename string, required
Ends in .pdf, .txt or .md. At most 200 characters.

Files can be up to 4 MB. Scanned pages with no text cannot be read.

Request
curl -X POST "https://groundly.emmapraise.com/v1/documents?filename=visiting.pdf" \
  -H "Authorization: Bearer $GROUNDLY_KEY" \
  --data-binary @visiting.pdf
Response
{
  "id": "rnm0hc4hq7aefjr60dzklhd6",
  "filename": "visiting.pdf",
  "status": "processing",
  "error": null,
  "created_at": "2026-12-05T09:41:37.822861+00:00"
}

List documents

GET/v1/documents

Secret key

The hub’s documents, newest first.

Each document

id string
Use it to retrieve or delete the document.
filename string
As uploaded.
status string
processing, ready or failed.
error string or null
Why it failed.
created_at string
ISO 8601, UTC.
Request
curl https://groundly.emmapraise.com/v1/documents \
  -H "Authorization: Bearer $GROUNDLY_KEY"
Response 200
[
  {
    "id": "rnm0hc4hq7aefjr60dzklhd6",
    "filename": "visiting.pdf",
    "status": "ready",
    "error": null,
    "created_at": "2026-12-05T09:41:37.822861+00:00"
  }
]

Retrieve a document

GET/v1/documents/{document_id}

Secret key

After an upload, request this until status is no longer processing.

Request
curl https://groundly.emmapraise.com/v1/documents/rnm0hc4hq7aefjr60dzklhd6 \
  -H "Authorization: Bearer $GROUNDLY_KEY"
Response
{
  "id": "rnm0hc4hq7aefjr60dzklhd6",
  "filename": "visiting.pdf",
  "status": "ready",
  "error": null,
  "created_at": "2026-12-05T09:41:37.822861+00:00"
}

Delete a document

DELETE/v1/documents/{document_id}

Secret key

Removes the document, so it is no longer used in answers.

Request
curl -X DELETE https://groundly.emmapraise.com/v1/documents/rnm0hc4hq7aefjr60dzklhd6 \
  -H "Authorization: Bearer $GROUNDLY_KEY"
Response
(no body)

List conversations

GET/v1/conversations

Secret key

The 50 newest conversations with their messages. Conversations are deleted after 90 days.

Request
curl https://groundly.emmapraise.com/v1/conversations \
  -H "Authorization: Bearer $GROUNDLY_KEY"
Response 200
[
  {
    "id": "p6sq0tynlx689jb418p1dn3v",
    "created_at": "2026-12-05T09:41:37.984563+00:00",
    "messages": [
      {"role": "user", "text": "What are the visiting hours?", "citations": []},
      {
        "role": "assistant",
        "text": "Visiting hours are 10:00 to 12:00 every day.",
        "citations": [{
          "document_id": "rnm0hc4hq7aefjr60dzklhd6",
          "filename": "visiting.pdf",
          "page": 1,
          "quote": "Visiting hours are 10:00 to 12:00 every day.",
          "marker": null
        }]
      }
    ]
  }
]