Dhamma.Gift Search API

Поиск по ключевому слову

Operations 4

GET /search Поиск по ключевому слову #
GET /search/{keyword} То же самое, что /search?q={keyword} — keyword как часть пути #
GET /search/enrich Догрузить полные данные (root-текст/переводы) для конкретных id сутт #
GET /api/ai-search ИИ-поиск: вопрос своими словами → сутты #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/dhamma-gift:dhamma-gift-search-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

dhamma-gift-search-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Dhamma.gift Search API
  version: 1.0.0
  description: Поиск по палийскому канону (Sutta/Vinaya) — API для dg-light.js. Все ответы — JSON.
servers:
- url: /
  description: Текущий сервер
tags:
- name: Search
  description: Поиск по ключевому слову
paths:
  /search:
    get:
      tags:
      - Search
      summary: Поиск по ключевому слову
      description: Без `?fast=1` — полный ответ (root-текст/переводы для всех найденных сегментов, wordReport, variantSegments). С `?fast=1` — быстрый частичный ответ (только skeleton + wordReport + variantSegments, без чтения файлов сутт) — используется для мгновенного первого рендера, полные данные потом дозагружаются через /search/enrich.
      parameters:
      - name: q
        in: query
        required: true
        description: Искомое слово/фраза. Минимум 3 символа — короче игнорируется (см. `tooShort` в ответе).
        schema:
          type: string
        example: kacchapa
      - $ref: '#/components/parameters/scope'
      - $ref: '#/components/parameters/exact'
      - $ref: '#/components/parameters/langs'
      - $ref: '#/components/parameters/lb'
      - $ref: '#/components/parameters/la'
      - name: fast
        in: query
        description: '`1` — быстрый частичный ответ без чтения файлов сутт (см. описание выше).'
        schema:
          type: string
          enum:
          - '1'
      responses:
        '200':
          description: Результат поиска
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          description: Не передан q
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getSearch
      x-operation-id-source: derived
  /search/{keyword}:
    get:
      tags:
      - Search
      summary: То же самое, что /search?q={keyword} — keyword как часть пути
      description: 'Короткие ссылки: /search/kacchapa?scope=dhamma работает наравне с /search?q=kacchapa&scope=dhamma. Остальные параметры — те же query-параметры, что у /search.'
      parameters:
      - name: keyword
        in: path
        required: true
        schema:
          type: string
        example: kacchapa
      - $ref: '#/components/parameters/scope'
      - $ref: '#/components/parameters/exact'
      - $ref: '#/components/parameters/langs'
      - $ref: '#/components/parameters/lb'
      - $ref: '#/components/parameters/la'
      - name: fast
        in: query
        schema:
          type: string
          enum:
          - '1'
      responses:
        '200':
          description: Результат поиска
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
      operationId: getSearchByKeyword
      x-operation-id-source: derived
  /search/enrich:
    get:
      tags:
      - Search
      summary: Догрузить полные данные (root-текст/переводы) для конкретных id сутт
      description: Вызывается вслед за /search?fast=1 с id сутт, которые нужно "дообогатить" — например видимую страницу таблицы, или сразу все найденные id разом. keyword/scope должны совпадать с исходным вызовом /search?fast=1 (иначе будет считаться заново, без переиспользования кеша).
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
        example: kacchapa
      - name: ids
        in: query
        required: true
        description: Id сутт через запятую.
        schema:
          type: string
        example: dn1,dn2,sn35.240
      - $ref: '#/components/parameters/scope'
      - $ref: '#/components/parameters/exact'
      - $ref: '#/components/parameters/langs'
      - $ref: '#/components/parameters/lb'
      - $ref: '#/components/parameters/la'
      responses:
        '200':
          description: Данные по запрошенным id (та же форма, что и data[id] у /search) плюс актуальные wordReport/metadata/variantSegments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          description: Не передан q или ids
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getSearchEnrich
      x-operation-id-source: derived
  /api/ai-search:
    get:
      tags:
      - Search
      summary: 'ИИ-поиск: вопрос своими словами → сутты'
      description: 'Когда точный поиск ничего не нашёл: слова пали из словаря DPD, иначе смысловой поиск. Ответ — сутты и подсказки слов. Медленнее обычного поиска (секунды).'
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
        example: черепаха
      - name: lang
        in: query
        required: false
        description: Язык подсказок слов (язык интерфейса)
        schema:
          type: string
          enum:
          - ru
          - en
        example: ru
      - name: scope
        in: query
        required: false
        description: Область, как у /search
        schema:
          type: string
        example: default
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  query:
                    type: string
                  suttas:
                    type: array
                    items:
                      type: object
                  wordSuggestions:
                    type: array
                    items:
                      type: object
      operationId: getApiAiSearch
      x-operation-id-source: derived
components:
  schemas:
    WordReportEntry:
      type: object
      properties:
        word:
          type: string
        textCount:
          type: integer
        matchCount:
          type: integer
        links:
          type: array
          items:
            type: object
            properties:
              sutta_id:
                type: string
              segment:
                type: string
    SearchResponse:
      type: object
      properties:
        metadata:
          $ref: '#/components/schemas/SearchMetadata'
        data:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuttaResult'
        wordReport:
          type: array
          items:
            $ref: '#/components/schemas/WordReportEntry'
        variantSegments:
          type: array
          items:
            $ref: '#/components/schemas/VariantSegment'
    Error:
      type: object
      properties:
        error:
          type: string
    VariantSegment:
      type: object
      description: Сегмент, где keyword встречается в вариантном (не root) чтении — текст берётся из variant-файла как есть, включая редакторскую нотацию разночтений ("→", "(mr)", "(?)").
      properties:
        sutta_id:
          type: string
        segment:
          type: string
        text:
          type: string
          example: 'Macchakacchapasañchannā → macchakacchapasampannā (?) '
    Segment:
      type: object
      properties:
        segment:
          type: string
          example: dn1:1.1
        root_text:
          type: string
          description: Пали, root-чтение
        variant:
          type: string
          description: Пали, вариантное чтение (если есть)
        translations:
          type: object
          description: Ключ вида "ru_khantibalo", "en_sujato" -> текст перевода
          additionalProperties:
            type: string
        html:
          type: string
        lb_context:
          type: array
          items:
            type: object
        la_context:
          type: array
          items:
            type: object
    SearchMetadata:
      type: object
      properties:
        query:
          type: string
        scope:
          type: string
        langs:
          type: array
          items:
            type: string
        lb:
          type: integer
        la:
          type: integer
        exactMatch:
          type: boolean
        totalFiles:
          type: integer
          description: Число найденных сутт
        totalMatches:
          type: integer
          description: Суммарное число совпадений
        hasVariantMatch:
          type: boolean
          description: Есть ли варианты чтения для этого слова где-либо в корпусе (не только в текущем scope)
        partial:
          type: boolean
          description: true — это ответ ?fast=1, root-текст/переводы для части сегментов ещё не подгружены (см. /search/enrich)
        tooShort:
          type: boolean
          description: true — keyword короче минимальной длины (3 символа), поиск не выполнялся
    SuttaResult:
      type: object
      properties:
        sutta_id:
          type: string
          example: dn1
        category:
          type: string
          enum:
          - dhamma
          - khudakka
          - vinaya
          - abhi
          - other
        dir_path:
          type: string
        titles:
          type: object
          additionalProperties:
            type: string
        mr:
          type: integer
          description: Ранг версии/релевантности (mtph из textinfo)
        count:
          type: integer
          description: Число совпадений в этой сутте
        unique_words:
          type: array
          items:
            type: string
        segments:
          type: array
          items:
            $ref: '#/components/schemas/Segment'
  parameters:
    scope:
      name: scope
      in: query
      description: 'Область поиска. Составные значения: `default` (или вообще не передавать параметр) — 4 никаи + 6 книг Кхуддаки, без Винаи/Абхидхаммы. `all` — весь корпус. Категории (каждая — целый верхнеуровневый раздел): `dhamma` — только 4 никаи (Дигха, Маджджхима, Саньютта, Ангуттара). `khudakka` — вся Кхуддака Никая (все её книги, не только 6 из `default`). `vinaya` — вся Виная-питака. `abhi` — Абхидхамма. Можно также перечислить конкретные id книг/собраний через запятую, вперемешку с категориями (например `dn,mn` или `dhamma,vinaya`) — id: `dn`, `mn`, `sn`, `an` (4 никаи); `ud`, `snp`, `dhp`, `thag`, `thig`, `iti`, `ja`, `tha-ap`, `thi-ap`, `mil`, `vv`, `pv`, `cp`, `bv`, `ps`, `ne`, `cnd`, `mnd`, `kp`, `pe` (Кхуддака Никая); `pli-tv-bi`, `pli-tv-bu`, `pli-tv-kd`, `pli-tv-pvr` (Виная).'
      schema:
        type: string
        default: default
        example: dhamma
    lb:
      name: lb
      in: query
      description: Число строк контекста ДО найденного сегмента (Пали root-текст).
      schema:
        type: integer
        default: 0
        minimum: 0
    la:
      name: la
      in: query
      description: Число строк контекста ПОСЛЕ найденного сегмента (Пали root-текст).
      schema:
        type: integer
        default: 0
        minimum: 0
    exact:
      name: exact
      in: query
      description: Точное совпадение слова целиком (grep -w), а не подстроки.
      schema:
        type: boolean
        default: false
    langs:
      name: langs
      in: query
      description: Языки переводов через запятую. `all` — все доступные языки.
      schema:
        type: string
        default: ru,en
        example: ru,en