Skip to content

REST API

Base URL (default prefix):

/{prefix}/api
→ /vgcomments/api

Blade Comments uses this API from the browser. Livewire Comments mostly talks to PHP services directly but shares the same backend rules.

All mutating routes expect a valid web session CSRF token (X-CSRF-TOKEN / _token) when called from your app.

Endpoints

MethodPathDescription
GET/commentsList comments
POST/commentsCreate comment
PUT/comments/{uuid}Update comment
DELETE/comments/{uuid}Delete comment
POST/comments/{uuid}/reactionsAdd reaction
DELETE/comments/{uuid}/reactionsRemove reaction
POST/comments/{uuid}/reportReport comment
POST/filesUpload attachment
GET/files/{uuid}.{extension}Stream attachment

Typical query / body fields

Comments are scoped by:

  • page_id — string key (e.g. blog-42, dashboard)
  • and/or morph pair commentable_id + commentable_type (type must be in allowed_commentable_types)

Common create fields:

  • content (required, length from config)
  • parent_id (reply)
  • Guest: author_name, author_email, author_url when allow_guests is true
  • recaptcha_token when reCAPTCHA is enabled

List endpoints support ordering (e.g. latest) and pagination.

File streaming

Uploaded files are not always public disk URLs. Use:

GET /{prefix}/files/{uuid}.{extension}

Custom frontends

You can skip both UI packages and build your own client against this API. Still install vgcomments, publish assets only if you need the admin UI, and migrate.

MIT · Blade-first for 2.x · Livewire 4 supported