Lemmy Search API

Search across posts, comments, communities, and users

Documentation

Specifications

SDKs

Schemas & Data

Other Resources

OpenAPI Specification

lemmy-search-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Lemmy REST Account Search API
  description: The Lemmy REST API provides programmatic access to all core platform features of Lemmy, a free, open-source, self-hostable federated link aggregator and discussion platform. Developers can create and manage posts, comments, communities, and user accounts; vote on content; follow communities; search across the federated network; moderate communities; send private messages; and administer instances. Authentication uses JWT bearer tokens obtained via the login endpoint. The API is versioned at /api/v4/ and available on any public Lemmy instance.
  version: 4.0.0
  license:
    name: AGPL-3.0
    url: https://github.com/LemmyNet/lemmy/blob/main/LICENSE
  contact:
    url: https://join-lemmy.org/docs/
servers:
- url: https://lemmy.world/api/v4
  description: Lemmy.world (largest public instance)
- url: https://{instance}/api/v4
  description: Any Lemmy instance
  variables:
    instance:
      default: lemmy.world
      description: The hostname of a Lemmy instance
security:
- bearerAuth: []
tags:
- name: Search
  description: Search across posts, comments, communities, and users
paths:
  /search:
    get:
      operationId: search
      summary: Search for content
      description: Search posts, comments, communities, and users across the federated network.
      tags:
      - Search
      security: []
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
      - name: community_id
        in: query
        schema:
          $ref: '#/components/schemas/CommunityId'
      - name: community_name
        in: query
        schema:
          type: string
      - name: creator_id
        in: query
        schema:
          $ref: '#/components/schemas/PersonId'
      - name: type_
        in: query
        schema:
          type: string
          enum:
          - All
          - Comments
          - Posts
          - Communities
          - Users
          - Url
      - name: sort
        in: query
        schema:
          $ref: '#/components/schemas/SortType'
      - name: listing_type
        in: query
        schema:
          $ref: '#/components/schemas/ListingType'
      - name: page
        in: query
        schema:
          type: integer
      - name: limit
        in: query
        schema:
          type: integer
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                type: object
                properties:
                  type_:
                    type: string
                  comments:
                    type: array
                    items:
                      type: object
                  posts:
                    type: array
                    items:
                      type: object
                  communities:
                    type: array
                    items:
                      type: object
                  users:
                    type: array
                    items:
                      type: object
components:
  schemas:
    SortType:
      type: string
      enum:
      - Active
      - Hot
      - New
      - Old
      - TopDay
      - TopWeek
      - TopMonth
      - TopYear
      - TopAll
      - MostComments
      - NewComments
      - TopHour
      - TopSixHour
      - TopTwelveHour
      - TopThreeMonths
      - TopSixMonths
      - TopNineMonths
      - Controversial
      - Scaled
    CommunityId:
      type: integer
      description: Unique identifier for a community
    ListingType:
      type: string
      enum:
      - All
      - Local
      - Subscribed
      - ModeratorView
    PersonId:
      type: integer
      description: Unique identifier for a person/user
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
externalDocs:
  description: Lemmy Documentation
  url: https://join-lemmy.org/docs/