Get started
Authentication
API keys, agent self-signup with a claim link, device login for the CLI, and OAuth 2.1 for MCP clients.
The API key is the credential. There is no token exchange for REST calls. Everything else on this page is a way to get a key.
API keys
- Keys look like
gs_live_…. The prefix makes a leaked key easy to spot in code and logs. - Send it as
Authorization: Bearer <key>or as thex-api-keyheader. - A key is shown once, when it is created. We store only its hash.
- Revoke a key in the dashboard; it stops working on its next call.
- Spend caps: each key can have a daily and a monthly cap in credits. A call that would pass a cap answers
402 spend_cap_reached; other keys keep working. - A key can’t raise its own caps or create keys. Only a signed-in person can, in the dashboard.
curl "https://api.groundsocial.dev/v1/reddit/subreddits/selfhosted" \
-H "Authorization: Bearer $GROUNDSOCIAL_API_KEY"Agent self-signup
An agent with no key and no human can create its own account. It gets 100 free credits and a claim link for a person.
- POST
POST https://api.groundsocial.dev/v1/agent/signupwith no auth. The body is optional:{"agent_name": "…", "purpose": "…"}is shown to the person who claims the account. - Maybe answer one questionIt may answer
428 challenge_required. The question is inerror.details.challenge.question; the answer is always one of the words in it. POST again withchallenge_token(fromerror.details.challenge.token) andanswer. The short form-field namescandawork too, anderror.details.curlis a ready-to-run command. - Store the key
201returnsapi_key,key_id,account_id,credits,claim_url,claim_expires_at,message_for_humananddocslinks. Saveapi_keywhere your agent keeps secrets. - Relay the claim linkShow
message_for_human(it containsclaim_url) to your person when one is around.
| Answer | Means | Do |
|---|---|---|
201 | Account created | Use api_key. |
428 challenge_required | One question first | Answer it with the same POST. |
428 challenge_failed | Wrong or expired answer; this is a new question | Answer the new question. |
429 signup_limited | Too many signups from this network today | Wait Retry-After seconds, or use an existing key. |
429 challenge_locked | Too many questions or wrong answers | Wait Retry-After seconds. |
503 signup_disabled | Signup is switched off | Stop and tell your human. Don’t look for another signup URL. |
Claiming an agent’s account
- The person opens
claim_url(https://groundsocial.dev/claim/{token}) in a browser, signs in with their email and accepts. - The agent’s key keeps working; credits, usage and history stay.
- Claim links are single-use and expire at
claim_expires_at. - Agents must never complete a claim themselves, or pay for or upgrade a person’s account.
Device login (CLI)
groundsocial login uses the device flow (RFC 8628), so you never paste a key into a terminal.
- Start
POST /v1/device/codereturnsdevice_code,user_code,verification_uri,verification_uri_completeandinterval. - ApproveThe person opens
https://groundsocial.dev/device, signs in, checks the code and approves. - PollThe CLI polls
POST /v1/device/tokeneveryintervalseconds.authorization_pending: keep polling.slow_down: add 5 seconds.access_denied: stop.expired_token: start again. On approval it receives a new key.
OAuth 2.1 for MCP clients
Claude, ChatGPT, Cursor and other clients connect to the remote MCP server at https://api.groundsocial.dev/mcp with OAuth. The client finds everything from the 401’s WWW-Authenticate header.
- Public clients only; PKCE with
S256is required. - Dynamic client registration (RFC 7591) and client ID metadata documents are both supported.
- Scopes:
reddit:readandaccount:read. Omittingscopegrants both. - Access tokens last an hour; refresh tokens 30 days and rotate on every use.
- One grant, one key. Approving a connection creates a key named
<client> (MCP connection). Its spend caps apply to that app, and revoking it disconnects the app at once.
Not supported
Client secrets and confidential clients, client_credentials, implicit and password grants, JWT access tokens, token introspection, and identity assertions (ID-JAG). Use a key, agent signup or OAuth above.