Connect a key
What you need#
- The gateway address and a product key from the owner. relic has no public address of its own: the owner tells you where it is reachable.
- At least one scope granted to your key. Without it every list is empty.
Authenticate#
Send the key on every request as Authorization: Bearer <key> or as X-Api-Key: <key>. The key identifies your product, so scopes and the ledger follow it. A missing or wrong key gets 401 unauthorized.
Use it as an MCP server#
The MCP endpoint is POST /mcp (Streamable HTTP, stateless, JSON replies). Register it in an MCP client with your key as the bearer token. The tool list depends on the key: tools of a scope your key does not have are not listed.
First calls over MCP#
list_chatsshows every conversation open to your key.find_chatfinds one by name,@usernameor id.- Pass the
refyou got asconversationto the other tools. A Telegram ref looks liketelegram:<account>:<id>. get_messagesreturns the newest messages first. Usearound,after,filter,senderortopicto narrow them.
First calls over REST#
curl -s -H "Authorization: Bearer $RELIC_KEY" \
"$RELIC_URL/v1/conversations?limit=2"
{
"total": 2,
"count": 2,
"truncated": false,
"conversations": [
{ "ref": "telegram:main:-1001234567890", "name": "Example group", "type": "group", "platform": "telegram" },
{ "ref": "telegram:main:1234567", "name": "Example person", "type": "private", "platform": "telegram" }
]
}
Then read one conversation with GET /v1/conversations/<ref>/messages?limit=20. The ref must be URL-encoded.
Check what your key can do#
GET /v1/scopereturns the scope rows of your key, grouped by access level.GET /v1/usagereturnsusedTodayand the dailycap.GET /v1/adaptersreturns the login state of each adapter.
More in REST API and Errors and limits.