Quick start
Ask a question about a hub’s documents and get an answer with the file and page it came from.
- In the dashboard, open your hub and upload a document.
- Under Keys and embed, create a secret key. It is shown once.
- Send the request on this page. The answer arrives in pieces as it is written.
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.
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.
<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
400bad request- The file name or file is not acceptable.
401unauthorized- The key is missing, wrong or revoked.
403not 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.
404not found- No such document, conversation or answer in this key’s hub.
413too large- Files can be at most 4 MB.
422invalid- Fix the request body or the id.
429slow down- Too many requests: wait for the Retry-After seconds. Or the monthly usage limit has been reached: contact Groundly.
{"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
questionstring, required- 1 to 4000 characters.
conversation_idstring- Send it back to ask a follow-up.
session_tokenstring- Public keys only, with conversation_id. Valid for 24 hours.
Events
tokentext- The next piece of the answer. Append them in order.
doneconversation_id, message_id, declined, citations- The answer is complete. A public key also gets session_token.
errorcode, 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.
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?"}'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_idstring, required- From the done event.
message_idnumber, required- From the done event.
rating1 or -1, required- Helpful or not helpful.
session_tokenstring- Required with a public key.
{
"conversation_id": "p6sq0tynlx689jb418p1dn3v",
"message_id": 2,
"rating": -1,
"session_token": "1796550098.iNGMXe93..."
}(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
filenamestring, 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.
curl -X POST "https://groundly.emmapraise.com/v1/documents?filename=visiting.pdf" \ -H "Authorization: Bearer $GROUNDLY_KEY" \ --data-binary @visiting.pdf
{
"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
idstring- Use it to retrieve or delete the document.
filenamestring- As uploaded.
statusstring- processing, ready or failed.
errorstring or null- Why it failed.
created_atstring- ISO 8601, UTC.
curl https://groundly.emmapraise.com/v1/documents \ -H "Authorization: Bearer $GROUNDLY_KEY"
[
{
"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.
curl https://groundly.emmapraise.com/v1/documents/rnm0hc4hq7aefjr60dzklhd6 \ -H "Authorization: Bearer $GROUNDLY_KEY"
{
"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.
curl -X DELETE https://groundly.emmapraise.com/v1/documents/rnm0hc4hq7aefjr60dzklhd6 \ -H "Authorization: Bearer $GROUNDLY_KEY"
(no body)
List conversations
GET/v1/conversations
Secret key
The 50 newest conversations with their messages. Conversations are deleted after 90 days.
curl https://groundly.emmapraise.com/v1/conversations \ -H "Authorization: Bearer $GROUNDLY_KEY"
[
{
"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
}]
}
]
}
]