# Update a Linear integration

Updates the settings of a Linear integration, the same settings as its **Configure** page. Send only the parameters you wish to change.

Connect the integration in **Errors** → [Integrations](https://errors.betterstack.com/team/0/integrations/) first, since connecting Linear needs you to authorize Better Stack in Linear.

[endpoint]
base_url = "https://errors.betterstack.com"
path = "/api/v1/linear-integrations/{id}"
method = "PATCH"

[[path_param]]
name = "id"
description = "The ID of the Linear integration, the number in the URL of its **Configure** page."
required = true
type = "string"

[[body_param]]
name = "applications"
description = "The applications whose errors the integration handles, replacing the whole list. Each is an object with the `application_id` of an error tracking application in the integration's team and optionally its `environments`, a list of environment names where empty or left out means every environment. Send `[]` for any application."
required = false
type = "array of objects"

[[body_param]]
name = "notifications"
description = "The **Automatic issue creation** toggles to change, as booleans. Toggles you leave out keep their value. The keys are `spikes`, `new_errors`, `automatically_reopened`, `occurrence_milestones`, `occurrence_threshold`, `affected_users_threshold`."
required = false
type = "object"

[[body_param]]
name = "occurrence_threshold_count"
description = "How many occurrences within `occurrence_threshold_interval` trigger `notifications.occurrence_threshold`. A positive whole number."
required = false
type = "integer"

[[body_param]]
name = "occurrence_threshold_interval"
description = "The interval of the occurrence threshold: `minute`, `hour`, `day`, or `week`."
required = false
type = "string"

[[body_param]]
name = "affected_users_threshold_count"
description = "How many affected users in total trigger `notifications.affected_users_threshold`. A positive whole number."
required = false
type = "integer"

[[body_param]]
name = "tag_filter"
description = "Only create issues for errors where at least one exception has every tag listed, with one of its values, replacing the whole list. Each row is an object with a `tag` and its `values`, a list of strings. Use a tag once, at most 10 rows, 50 values per tag and 200 characters per tag or value. Send `[]` for every error."
required = false
type = "array of objects"

[[body_param]]
name = "name"
description = "The name that identifies the integration in Better Stack."
required = false
type = "string"

[[body_param]]
name = "linear_team_id"
description = "The ID of the Linear team issues are created in. To find Linear IDs, pick the team, assignee, statuses, project and labels on the **Configure** page once and read them back with a GET. A new team clears `linear_status_id`, `linear_resolved_status_id`, `linear_project_id` and `linear_label_ids`, unless the same request sets them."
required = false
type = "string"

[[body_param]]
name = "linear_assignee_id"
description = "The ID of the Linear user new issues are assigned to. Send an empty string for none."
required = false
type = "string"

[[body_param]]
name = "linear_status_id"
description = "The ID of the Linear status new issues get. Send an empty string to use Linear's default."
required = false
type = "string"

[[body_param]]
name = "linear_project_id"
description = "The ID of the Linear project new issues are added to. Send an empty string for none."
required = false
type = "string"

[[body_param]]
name = "linear_label_ids"
description = "The IDs of the Linear labels new issues get, replacing the whole list."
required = false
type = "array of strings"

[[body_param]]
name = "linear_priority"
description = "The priority of new issues: `no_priority`, `urgent`, `high`, `medium`, or `low`."
required = false
type = "string"

[[body_param]]
name = "auto_resolve"
description = "Keep Linear and error resolutions in sync, so resolving either side resolves the other. Needs `linear_resolved_status_id`."
required = false
type = "boolean"

[[body_param]]
name = "linear_resolved_status_id"
description = "The ID of the Linear status issues move to when their error is resolved."
required = false
type = "string"

[[body_param]]
name = "auto_reopen"
description = "Reopen the Linear issue when its error is automatically re-opened, moving it back to `linear_status_id`. Needs `linear_status_id` and `linear_resolved_status_id`."
required = false
type = "boolean"

[[body_param]]
name = "sync_comments"
description = "Sync comments between errors and their Linear issues."
required = false
type = "boolean"

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

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

[responses]
[[response]]
status = 200
description = '''Returns the updated Linear integration.'''
body = '''{
  "data": {
    "id": "66368",
    "type": "linear_integration",
    "attributes": {
      "team_id": "t123456",
      "team_name": "My team",
      "applications": [],
      "notifications": {
        "spikes": false,
        "new_errors": true,
        "automatically_reopened": true,
        "occurrence_milestones": false,
        "occurrence_threshold": true,
        "affected_users_threshold": false
      },
      "occurrence_threshold_count": 100,
      "occurrence_threshold_interval": "hour",
      "affected_users_threshold_count": 10,
      "tag_filter": [
        { "tag": "environment", "values": ["production"] }
      ],
      "name": "Platform errors",
      "linear_team_id": "9cfb482a-81e3-4154-b5b9-2c805e70a02d",
      "linear_assignee_id": "",
      "linear_status_id": "5c3a1f8e-2b7d-4e61-9a0c-7d4b8e2f1a36",
      "linear_resolved_status_id": "e2d4f6a8-1b3c-4d5e-8f70-9a1b2c3d4e5f",
      "linear_project_id": "",
      "linear_label_ids": ["0b8f3c2e-6a1d-4f97-b5e4-3c2a1d0e9f8b"],
      "linear_priority": "high",
      "auto_reopen": true,
      "auto_resolve": true,
      "sync_comments": true
    }
  }
}'''

[[response]]
status = 401
description = '''Unauthorized'''
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 = 404
description = '''Not Found'''
body = '''{
  "errors": "Resource with the provided ID was not found"
}'''

[[response]]
status = 422
description = '''Returned when a value can't be applied. The error says which and why.'''
body = '''{
  "errors": "linear_priority must be one of no_priority, urgent, high, medium, low."
}'''
[/responses]

#### Example cURL

```shell
[label Create issues for new errors]
curl --request PATCH \
  --url https://errors.betterstack.com/api/v1/linear-integrations/66368 \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
    "notifications": {
      "new_errors": true
    },
    "linear_priority": "high",
    "linear_label_ids": ["0b8f3c2e-6a1d-4f97-b5e4-3c2a1d0e9f8b"]
  }'
```
