# Create an error comment

Add a comment to an error's conversation. When the error is linked to an issue in Linear and its integration syncs comments, the comment is posted there too. A comment made with OAuth is posted under your name. A comment made with a team or global API token is signed `Comment added using API`.

[endpoint]
method = "POST"
base_url = "https://errors.betterstack.com"
path = "/api/v4/applications/{application_id}/errors/{error_id}/comments"

[[path_param]]
name = "application_id"
required = true
type = "string"
description = "The ID of the application, from [List applications](/docs/errors/api/applications/list/)."

[[path_param]]
name = "error_id"
required = true
type = "string"
description = "The error's `id`, from [List errors](/docs/errors/api/errors/list/). Can contain dots."

[[body_param]]
name = "content"
required = true
type = "string"
description = "Comment text, in Markdown. A mention is a `**M_START**{...}**M_END**` block whose `id` is the team member's user ID, such as `**M_START**{\"id\":\"u123\"}**M_END**`. To mention someone, send that block with their `u123` ID or e-mail as `id`. Get the user ID via [List team members](/docs/uptime/api/team-members/list/)."

[[query_param]]
name = "team_id"
type = "string"
description = "Team to use, such as `t123`. Get the ID via [List teams](/docs/uptime/api/teams/list/). Required when you can access more than one team."

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content-Type"
description = "application/json"
required = false
type = "string"
[/endpoint]

[responses]
[[response]]
status = 201
description = "Returns the newly created error comment."
body = '''
{
  "data": {
    "id": "123456789",
    "type": "error_comment",
    "attributes": {
      "content": "Rolled back the 14:05 deploy. The error stopped.",
      "plaintext_content": "Rolled back the 14:05 deploy. The error stopped.",
      "author_name": "Jane Smith",
      "user_email": "jane@example.com",
      "posted_via": null,
      "linear_issue": null,
      "event": null,
      "created_at": "2026-11-16T07:58:02Z",
      "updated_at": "2026-11-16T07:58:02Z"
    }
  }
}
'''

[[response]]
status = 401
description = "The API token is missing or invalid."
body = '''
{
  "errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/logs/api/getting-started/#obtaining-a-logtail-api-token"
}
'''

[[response]]
status = 403
description = "The token is read-only, or its scopes don't permit the action."
body = '''
{
  "errors": "This API token is read-only and cannot be used for write operations."
}
'''

[[response]]
status = 404
description = "No application with that ID, or no error with that ID in it."

[[response]]
status = 422
description = "The `content` attribute is missing, isn't a string or is blank, and `required_attributes` names it. Also returned for an unknown attribute, which `invalid_attributes` names. A mention is refused when it names a user by anything other than a `u123` ID or e-mail, or names someone outside the application's team, and `invalid_values.content` says why."
body = '''
{
  "errors": "Sorry, some values are incorrect",
  "invalid_values": {
    "content": "Mention a user by a user ID such as u123, not `3`. Get it via List team members, or mention their e-mail."
  }
}
'''
[/responses]

[params]
title = "Response attributes"

[[param]]
name = "id"
type = "string"
description = "The ID of the error comment."

[[param]]
name = "type"
type = "string"
description = "Always `error_comment`."

[[param]]
name = "content"
type = "string"
description = "Comment text, in Markdown. A mention is a `**M_START**{...}**M_END**` block whose `id` is the team member's user ID, such as `**M_START**{\"id\":\"u123\"}**M_END**`. To mention someone, send that block with their `u123` ID or e-mail as `id`. Get the user ID via [List team members](/docs/uptime/api/team-members/list/)."

[[param]]
name = "plaintext_content"
type = "string"
description = "The comment as plain text, with each mention written as `@name`."

[[param]]
name = "author_name"
type = "string"
description = "Who wrote the comment. A comment created with a team or global API token is signed `Comment added using API`."

[[param]]
name = "user_email"
type = "string or null"
description = "The author's e-mail, when a Better Stack user wrote the comment."

[[param]]
name = "posted_via"
type = "string or null"
description = "How the comment was posted. `null` when it was written in the web app.<br/>Valid values:<br/>`mcp`: Posted through the Better Stack MCP server.<br/>`cli`: A signed-in person posted it with the Better Stack CLI.<br/>`ai_sre`: AI SRE posted it for a person.<br/>`ai_engineer`: AI Engineer posted it for a person.<br/>`api`: Posted with an API token that has no user of its own.<br/>`slack`: Someone replied in the error's Slack thread.<br/>`linear`: Synced from a comment in Linear on the issue linked to the error.<br/>`email_reply`: Arrived as a reply to an e-mail.<br/>`microsoft_teams`: Arrived from Microsoft Teams.<br/>`policy_step`: An escalation policy step posted it."

[[param]]
name = "linear_issue"
type = "string or null"
description = "The Linear issue a synced comment came from, such as `ENG-123`."

[[param]]
name = "event"
type = "string or null"
description = "The occurrence the comment was left on, as its event ID, or as its timestamp when the occurrence has no ID. `null` for a comment on the error itself."

[[param]]
name = "created_at"
type = "datetime"
description = "When the comment was created. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "updated_at"
type = "datetime"
description = "When the comment was last updated. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."
[/params]

#### Example cURL

```shell
[label Comment on an error]
curl --request POST \
  --url https://errors.betterstack.com/api/v4/applications/1234/errors/6f1c2b9a8e4d7f3012ab45cd/comments \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "content": "Rolled back the 14:05 deploy. The error stopped."
}'
```
