# Create a Linear integration

Create a Linear integration for incidents. You'll get a link back to open in your browser and finish setting up the integration.

[endpoint]
method = "POST"
base_url = "https://incidents.betterstack.com"
path = "/api/v2/linear-integrations"

[[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"
[/endpoint]

[responses]
[[response]]
status = 202
description = "Returns the newly created integration authorization."
body = '''
{
  "data": {
    "id": "hD0Ms9nZ2Yd4mVq1pX7bL8cT3rF6wK5jA0eS9uG2iNy",
    "type": "integration_authorization",
    "attributes": {
      "integration_type": "slack",
      "status": "pending",
      "status_reason": null,
      "authorization_url": "https://uptime.betterstack.com/team/t123/integrations/slack/authorize?authorization_id=hD0Ms9nZ2Yd4mVq1pX7bL8cT3rF6wK5jA0eS9uG2iNy&product=uptime",
      "expires_at": "2026-11-24T16:30:00.000Z",
      "integration_id": null,
      "team_id": "t123"
    }
  }
}
'''

[[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/uptime/api/getting-started-with-uptime-api/#get-an-incidents-api-token"
}
'''

[[response]]
status = 403
description = "The token is read-only, your role doesn't allow the action, or the token can't be used for this API."
body = '''
{
  "errors": "This API token is read-only and cannot be used for write operations."
}
'''

[[response]]
status = 503
description = "Linear couldn't be connected right now. Nothing is created. Try again later."
body = '''
{
  "errors": "Linear couldn't be connected. Please try again later."
}
'''
[/responses]

[params]
title = "Response attributes"

[[param]]
name = "id"
type = "string"
description = "The ID of the integration authorization, such as `hD0Ms9nZ2Yd4mVq1pX7bL8cT3rF6wK5jA0eS9uG2iNy`."

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

[[param]]
name = "integration_type"
type = "string"
description = "The integration being connected. Possible values: `slack`, `linear`, `jira`."

[[param]]
name = "status"
type = "string"
description = "Whether the integration is connected yet.<br/>Valid values:<br/>`pending`: Waiting for a person to open `authorization_url` and finish the sign-in.<br/>`completed`: The integration is connected. `integration_id` is its ID.<br/>`failed`: The sign-in didn't connect the integration. `status_reason` says why.<br/>`expired`: Nobody finished the sign-in in time."

[[param]]
name = "status_reason"
type = "string or null"
description = "Why connecting failed, as the sign-in page showed it. `null` unless `status` is `failed`."

[[param]]
name = "authorization_url"
type = "string or null"
description = "The link that connects the integration. Open it in a browser, sign in to Better Stack, then sign in with the provider. `null` once the link expires or the sign-in ends. A link created with your own sign-in rather than an API token opens only for you."

[[param]]
name = "expires_at"
type = "datetime"
description = "When the link stops opening, 30 minutes after it was created. A sign-in started before then has 30 more minutes to finish. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "integration_id"
type = "string or null"
description = "The ID of the connected integration. `null` until `status` is `completed`."

[[param]]
name = "team_id"
type = "string"
description = "Team the integration is connected to, such as `t123`."
[/params]

#### Example cURL

```shell
[label Connect Linear]
curl --request POST \
  --url https://incidents.betterstack.com/api/v2/linear-integrations \
  --header "Authorization: Bearer $TOKEN"
```
