Attachments
Issue attachments allow you to link external resources to issues and display them inside Linear similarly to GitHub Pull Requests. They are designed with API developers in mind and we also use them for upcoming integrations inside Linear.
Example use cases:
    Customer support software where an agent can create a Linear issue
    Release bot that attached release version to an issue
Attachments functionality is still in alpha and subject to change.
Unique URLs are a core concept with attachments. They enable building stateless applications and integrations which interact with Linear's API. Attachment URL is used as an idempotent value if used in conjunction with the same issue id so if you try to re-create an attachment with the same URL on the same issue, the original attachment is updated instead. This enables simple scripts which update the attachment content without storing the attachment ID. You can also query an attachment, and the associated issue, by its URL. This makes creating links to Linear issues from external application easy and again you don't need to track the attachment ID.
It's recommended to create attachments through Linear's OAuth authentication. Then the application icon is used for the attachment by default, but an icon image URL can be specified when creating the attachment that overrides the application icon. For API key auth, you can also provide an icon URL when creating an attachment. The image provided by URL must be of png or jpg format.
Attachments also support key-value metadata. Values can be any string or number and you can store information there related to your integration. Right now metadata is only exposed through the API but we're also considering exposing it in the UI.
Linear's webhooks also support attachments so you can subscribe to get updates for new and updated attachments.
Create an attachment:
1
mutation{
2
attachmentCreate(input:{
3
issueId: "590a1127-f98b-49fc-ba74-2df8751c089e"
4
title: "Exception"
5
subtitle: "Open"
6
url: "http://exception.com/123"
7
iconUrl: "https://exception.com/assets/icon.png"
8
metadata: {exceptionId: "exc-123"}
9
}){
10
success
11
attachment{
12
id
13
}
14
}
15
}
Copied!
Update an attachment with id:
1
mutation{
2
attachmentUpdate(id: "47e14163-404c-4a34-b775-5c536d67760a", input: {
3
title: "Exception"
4
subtitle: "Resolved"
5
metadata: {exceptionId: "exc-123"}
6
}){
7
success
8
attachment{
9
id
10
}
11
}
12
}
Copied!
Query for attachments with a URL or for a specific attachment with an id:
1
query {
2
attachment(id: "47e14163-404c-4a34-b775-5c536d67760a") {
3
id
4
issue {
5
id
6
identifier
7
title
8
}
9
}
10
}
11
12
query {
13
attachmentsForURL(url: "http://exception.com/123") {
14
nodes {
15
id
16
issue {
17
id
18
identifier
19
title
20
}
21
}
22
}
23
}
Copied!

Formatting

Format
Variable Type
Output example
{variableName__since}
Date as ISO string
"2 days ago", "23 hours ago"
{variableName__relativeTimestamp}
Date as ISO string
If +/- 6 days from current: "today at 9:30 AM", "Friday at 9:30 AM"
If > 6 days from current: "Oct 20, 9:30 AM"
In order to use the date formatting, when creating an attachment provide a date variable (in ISO string format) in the attachment's metadata. You may then add that date with the format {variableName__since} into the attachment subtitle. When the attachment is rendered, we will format the time since that date, or format that date and time relative to current time, depending on which format is being used.
1
mutation{
2
attachmentCreate(input:{
3
issueId: "590a1127-f98b-49fc-ba74-2df8751c089e"
4
title: "Exception"
5
subtitle: "Detected {detectedAt__since}"
6
url: "http://exception.com/123"
7
iconUrl: "https://exception.com/assets/icon.png"
8
metadata: {detectedAt: "2021-07-06T17:10:32.090Z"}
9
}){
10
success
11
attachment{
12
id
13
}
14
}
15
}
Copied!
The above query would yield output like the following:
Attachment using since date formatting
Last modified 2mo ago
Copy link
Contents
Formatting