Skip to content

The REST API

Need to fetch your comments programmatically? The JamComments REST API lets you access your comments via HTTP request. All API requests go to https://go.jamcomments.com.

Fetch a paginated list of comments for a specific page or your entire site. Only approved comments are returned.

GET /api/comments

Include your API token in the Authorization header:

Authorization: Bearer 12345-YOUR-API-TOKEN

You can create or view your API token in the JamComments admin.

ParameterRequired?Description
domainYesYour site’s domain (as configured in your account).
pathNoThe page path for the comments you want. Leave blank to get all comments for the domain.
per_pageNoHow many top-level comments to return per page. Default is 50.
fetch(
"https://go.jamcomments.com/api/comments?domain=example.com&path=/posts/my-post",
{
headers: {
Authorization: "Bearer YOUR_API_TOKEN_HERE",
},
},
)
.then((response) => response.json())
.then((data) => console.log(data));

The API returns a JSON object with your comments and pagination info:

{
"data": [
{
"created_at": "2023-11-26T06:30:07.000000Z",
"content": "This is some example content.",
"html": "<p>This is some example content.</p>\n",
"status": "approved",
"name": "Jane Doe",
"path": "/posts/my-blog-post",
"children": [
{
"created_at": "2023-11-26T06:30:07.000000Z",
"content": "Totally agree!",
"html": "<p>Totally agree!</p>\n",
"status": "approved",
"name": "John Smith",
"path": "/posts/my-blog-post"
}
]
}
],
"links": {
"first": "https://go.jamcomments.com/api/comments?page=1",
"last": "https://go.jamcomments.com/api/comments?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"per_page": 50,
"to": 16,
"total": 16
}
}

Note: The children array contains reply comments nested under their parent comment.

If you have suggestions for the API or need additional endpoints, send me an email!