Lemmy Admin API

Administrative actions

Documentation

Specifications

SDKs

Schemas & Data

Other Resources

OpenAPI Specification

lemmy-admin-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Lemmy REST Account Admin 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: Admin
  description: Administrative actions
paths:
  /admin/add:
    post:
      operationId: addAdmin
      summary: Add or remove admin
      description: Grant or revoke admin privileges for a user. Requires admin.
      tags:
      - Admin
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - person_id
              - added
              properties:
                person_id:
                  $ref: '#/components/schemas/PersonId'
                added:
                  type: boolean
      responses:
        '200':
          description: Admin status updated
  /admin/ban:
    post:
      operationId: banFromSite
      summary: Ban or unban a user from the site
      description: Prohibit or restore a user's access to this instance. Requires admin.
      tags:
      - Admin
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - person_id
              - ban
              properties:
                person_id:
                  $ref: '#/components/schemas/PersonId'
                ban:
                  type: boolean
                remove_data:
                  type: boolean
                  nullable: true
                reason:
                  type: string
                  nullable: true
                expires:
                  type: integer
                  nullable: true
                  description: Unix timestamp for ban expiry
      responses:
        '200':
          description: User ban status updated
components:
  schemas:
    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/