🚀 GraphQL API

Публичное API для доступа к новеллам, мангам и главам

Быстрый старт

1. Получите API ключ

Создайте API ключ в разделе "Мои API ключи" выше

2. Endpoint

POST https://lorachi.xyz/api/graphql

3. Пример запроса

curl -X POST https://lorachi.xyz/api/graphql \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "query": "{ novels(page: 1, limit: 10) { novels { id title type author } } }"
  }'

API Reference

novels(page, limit, type, sort)

Получить список новелл с пагинацией

{
  novels(page: 1, limit: 20, type: "novel", sort: "updatedAt") {
    novels {
      id
      title
      type
      author
      coverUrl
      description
      chapters
      views
      rating
    }
    pagination {
      page
      total
      totalPages
    }
  }
}

novel(id)

Получить информацию о конкретной новелле

{
  novel(id: "NOVEL_ID") {
    id
    title
    type
    author
    artist
    coverUrl
    description
    alternativeTitles
    releaseYear
    ageRating
    status
    chapters
    views
    rating
    badges
  }
}

novelWithChapters(id)

Получить новеллу со всеми главами

{
  novelWithChapters(id: "NOVEL_ID") {
    novel {
      id
      title
      type
    }
    chapters {
      id
      chapter
      title
      volume
      views
      isPaid
      price
    }
  }
}

chapter(novelId, chapterNumber)

Получить содержимое текстовой главы

{
  chapter(novelId: "NOVEL_ID", chapterNumber: "1") {
    id
    title
    content
    volume
    views
    isPaid
    price
  }
}
⚠️ Платные главы возвращают предупреждение вместо контента

mangaChapter(novelId, chapterNumber)

Получить страницы манга-главы

{
  mangaChapter(novelId: "NOVEL_ID", chapterNumber: "1") {
    id
    title
    volume
    pages {
      pageNumber
      imageUrl
    }
    isPaid
    price
  }
}

searchNovels(query, limit)

Поиск новелл по названию или автору

{
  searchNovels(query: "vampire", limit: 10) {
    id
    title
    type
    author
    coverUrl
  }
}

Rate Limits

30 запросов в минуту на API ключ

Максимум 5 активных API ключей на пользователя

Примеры кода

JavaScript / Node.js

const response = await fetch('https://lorachi.xyz/api/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    query: `{
      novels(page: 1, limit: 10) {
        novels {
          id
          title
          author
        }
      }
    }`
  })
});

const data = await response.json();
console.log(data.data.novels);

Python

import requests

query = '''
{
  novels(page: 1, limit: 10) {
    novels {
      id
      title
      author
    }
  }
}
'''

response = requests.post(
    'https://lorachi.xyz/api/graphql',
    json={'query': query},
    headers={'x-api-key': 'YOUR_API_KEY'}
)

data = response.json()
print(data['data']['novels'])