Machine-to-machine search API for Telegram
GET /api/agent/search?q=<query>&limit=<n>&lang=<code>&kind=<type>&min_users=<n>&max_users=<n>| Parameter | Required | Description |
|---|---|---|
q | Yes | Search query (semantic) |
limit | No | Max number of results (default: 100) |
lang | No | Language filter (ISO 639-1 code, e.g. "en", "ru") |
kind | No | Entity type filter ("channel", "group", or "bot") |
min_users | No | Minimum subscriber/member count |
max_users | No | Maximum subscriber/member count |
This endpoint uses the x402 payment protocol (HTTP 402 Payment Required). No API keys or subscriptions needed.
402 and payment requirements (recipient, token, amount, network).PAYMENT header.Use an x402-compatible client to handle the payment flow automatically: x402-fetch, x402-reqwest.
[
{
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"kind": "channel",
"username": "example_channel",
"name": "Example Channel",
"bio": null,
"description": "An example Telegram channel",
"avatar_url": "https://example.com/avatar.jpg",
"user_count": 15000
}
]| Field | Type | Description |
|---|---|---|
uuid | string | Unique identifier |
kind | string? | channel, group, bot, or null |
username | string | Telegram username |
name | string? | Display name |
bio | string? | Short bio |
description | string? | Full description |
avatar_url | string? | Avatar image URL |
user_count | number? | Subscriber/member count |
| Status | Meaning |
|---|---|
| 400 | Empty or missing q parameter |
| 402 | Payment required |
| 502 | Upstream search service unavailable |
Using x402-fetch (JavaScript):
import { wrapFetch } from "x402-fetch";
const fetch402 = wrapFetch(fetch, wallet);
const res = await fetch402("https://semagram.io/api/agent/search?q=crypto+news");
const results = await res.json();