openapi: 3.1.0 info: title: Lemmy REST Account Comment 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: Comment description: Creating and managing comments paths: /comment: get: operationId: getComment summary: Get a comment description: Retrieve a specific comment by ID. tags: - Comment security: [] parameters: - name: id in: query required: true schema: $ref: '#/components/schemas/CommentId' responses: '200': description: Comment details post: operationId: createComment summary: Create a comment description: Post a new comment on a post or reply to an existing comment. tags: - Comment requestBody: required: true content: application/json: schema: type: object required: - post_id - content properties: post_id: $ref: '#/components/schemas/PostId' parent_id: $ref: '#/components/schemas/CommentId' content: type: string language_id: $ref: '#/components/schemas/LanguageId' responses: '200': description: Comment created content: application/json: schema: $ref: '#/components/schemas/CommentResponse' put: operationId: editComment summary: Edit a comment description: Update the content of an existing comment. Requires comment author. tags: - Comment requestBody: required: true content: application/json: schema: type: object required: - comment_id properties: comment_id: $ref: '#/components/schemas/CommentId' content: type: string nullable: true language_id: $ref: '#/components/schemas/LanguageId' responses: '200': description: Comment updated delete: operationId: deleteComment summary: Delete a comment description: Delete or restore a comment. Requires comment author. tags: - Comment requestBody: required: true content: application/json: schema: type: object required: - comment_id - deleted properties: comment_id: $ref: '#/components/schemas/CommentId' deleted: type: boolean responses: '200': description: Comment deleted/restored /comment/list: get: operationId: listComments summary: List comments description: Retrieve a paginated list of comments for a post or community. tags: - Comment security: [] parameters: - name: type_ in: query schema: $ref: '#/components/schemas/ListingType' - name: sort in: query schema: $ref: '#/components/schemas/CommentSortType' - name: post_id in: query schema: $ref: '#/components/schemas/PostId' - name: parent_id in: query schema: $ref: '#/components/schemas/CommentId' - name: community_id in: query schema: $ref: '#/components/schemas/CommunityId' - name: max_depth in: query schema: type: integer - name: page in: query schema: type: integer - name: limit in: query schema: type: integer - name: saved_only in: query schema: type: boolean responses: '200': description: List of comments /comment/like: post: operationId: likeComment summary: Vote on a comment description: Upvote or downvote a comment (score 1, 0, or -1). tags: - Comment requestBody: required: true content: application/json: schema: type: object required: - comment_id - score properties: comment_id: $ref: '#/components/schemas/CommentId' score: type: integer enum: - -1 - 0 - 1 responses: '200': description: Vote recorded /comment/save: put: operationId: saveComment summary: Save or unsave a comment description: Bookmark/unbookmark a comment for the current user. tags: - Comment requestBody: required: true content: application/json: schema: type: object required: - comment_id - save properties: comment_id: $ref: '#/components/schemas/CommentId' save: type: boolean responses: '200': description: Save status updated /comment/report: post: operationId: createCommentReport summary: Report a comment description: Submit a report for a comment to the instance moderators. tags: - Comment requestBody: required: true content: application/json: schema: type: object required: - comment_id - reason properties: comment_id: $ref: '#/components/schemas/CommentId' reason: type: string responses: '200': description: Report submitted components: schemas: CommunityId: type: integer description: Unique identifier for a community ListingType: type: string enum: - All - Local - Subscribed - ModeratorView LanguageId: type: integer description: Unique identifier for a language PersonId: type: integer description: Unique identifier for a person/user CommentResponse: type: object properties: comment_view: type: object description: The comment view with associated metadata recipient_ids: type: array items: $ref: '#/components/schemas/PersonId' CommentId: type: integer description: Unique identifier for a comment CommentSortType: type: string enum: - Hot - Top - New - Old - Controversial PostId: type: integer description: Unique identifier for a post securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT externalDocs: description: Lemmy Documentation url: https://join-lemmy.org/docs/