Jira
The jira tracker reads issues from Jira Cloud (REST v3) and from Jira Data Center / Server (REST v2): fields, comments, attachments, links, change history and search, including raw JQL. It is read-only. This page has the profile entry, the exact reference forms it accepts, how fields and searches map, and what is still unverified.
Profile entry
- id: jira
type: jira
url: https://acme.atlassian.net
email_env: JIRA_EMAIL
token_env: JIRA_TOKEN
projects: [PAY, MOB, WEB]With the two variables set, a ticket can be read by key, by URL, or with the tracker named explicitly:
safran ticket PAY-1423 --comments --links
safran ticket https://acme.atlassian.net/browse/PAY-1423
safran ticket jira:PAY-1423import { createSafran } from "@safran/core";
await using safran = await createSafran({ profile: "safran.yaml" });
// Offline: only the reference is matched, nothing is requested.
const { tracker, key } = safran.tickets.resolve("https://acme.atlassian.net/browse/PAY-1423");
console.log(tracker.id, key); // jira PAY-1423
const ticket = await safran.tickets.get("PAY-1423");
console.log(ticket.title, ticket.statusCategory, ticket.fields["Story Points"]);Authentication
| Deployment | What is sent | What you need |
|---|---|---|
cloud (default) | Authorization: Basic with the account e-mail and an API token | email_env and token_env. email_env is required on Cloud. |
datacenter | Authorization: Bearer with a personal access token | token_env only. |
datacenter with email_env | Authorization: Basic with that user name and the token as password | For servers without personal access tokens. |
The source names no permission scope. The account behind the token needs read access to the issues you want to read: Jira answers 404 both for an issue that does not exist and for one the account may not see, and Safran reports that as NOT_FOUND with a hint that says so.
Data Center
- id: jira
type: jira
url: https://jira.acme.test/jira
deployment: datacenter
token_env: JIRA_TOKEN
projects: [PAY]url is the site root including the context path when there is one. Read the caveats before relying on a Data Center instance: most of that path is unverified.
Configuration reference
| Field | Type | Default | Required | Meaning |
|---|---|---|---|---|
id | string | yes | Name of this entry; used as jira:PAY-1423 and in Ticket.tracker. | |
type | "jira" | yes | Selects this plugin. | |
url | URL | yes | Site root, e.g. https://acme.atlassian.net, or with a context path https://jira.acme.test/jira. No credentials, query string or fragment. | |
deployment | cloud or datacenter | cloud | no | cloud: REST v3, Basic e-mail + API token. datacenter: REST v2, Bearer personal access token. |
email_env | variable name | on Cloud | Variable holding the account e-mail (Cloud), or the user name for Basic auth on Data Center. | |
token_env | variable name | yes | Variable holding the API token or personal access token. | |
projects | string[] | [] | no | Project keys this tracker owns. Restricts reference matching, listProjects and neutral searches. |
custom_fields | string[] | DEFAULT_JIRA_CUSTOM_FIELDS | no | Display names or ids of fields copied into Ticket.fields. "*" copies every non-empty custom field. |
Ticket references
matchTicketRef decides offline whether a pasted string is one of this tracker's tickets. The canonical key is PAY-1423.
| Input | With projects: [PAY, MOB, WEB] | Without projects |
|---|---|---|
PAY-1423 | PAY-1423 | PAY-1423 |
pay-1423 (from a branch name) | PAY-1423 | not matched |
PAY-0042 | PAY-42 | PAY-42 |
OPS-1 | not matched | OPS-1 |
utf-8, sha-256 | not matched | not matched |
1423, #1423 | not matched | not matched |
https://acme.atlassian.net/browse/PAY-1423 | PAY-1423 | PAY-1423 |
acme.atlassian.net/browse/PAY-1423 (no scheme) | PAY-1423 | PAY-1423 |
…/issues/PAY-1423, REST …/issue/PAY-1423 | PAY-1423 | PAY-1423 |
Service desk …/portal/3/PAY-1423 | PAY-1423 | PAY-1423 |
Board URL with ?selectedIssue=PAY-1423 | PAY-1423 | PAY-1423 |
| The same paths on another host | not matched | not matched |
The rules behind the table:
- With a
projectslist, only those projects match, in any letter case. Without one, any project matches but only written in upper case, as Jira writes it. That is what keepsutf-8andcovid-19from being taken for tickets. - URLs must be on the configured host and below the configured context path. With
url: https://jira.acme.test/jira, a link under/confluence/on the same host is not this Jira. - A bare number and
#123are never matched. Those forms belong to Azure Boards and GitHub Issues. - Inputs longer than
MAX_REF_LENGTH(2048 characters) are not looked at.
When no tracker accepts a reference, the error lists what is configured:
$ safran ticket utf-8
✘ No tracker recognises "utf-8" as a ticket reference
→ Configured trackers: jira (PAY, MOB, WEB).What a ticket contains
Ticket field | Source in Jira |
|---|---|
key, title, url | Issue key, summary, <url>/browse/<key> |
type, status | Issue type name, status name |
statusCategory | The status category key: new → todo, indeterminate → in_progress, done → done |
project | Project key |
description | Converted to Markdown: Atlassian Document Format on Cloud, wiki markup on Data Center |
priority, labels, assignee, reporter | The fields of the same name |
parent | The parent field; otherwise the issue named by an "Epic Link" field |
createdAt, updatedAt, resolvedAt | created, updated, resolutiondate |
Ticket.fields
Five standard fields are copied when they have a value: Components, Fix versions, Resolution, Due date, Environment.
Custom fields are selected with custom_fields, by display name (case-insensitive) or by id (customfield_10016). Names are resolved through the issue's own field-name map, never by a hard-coded id, so the same profile works on sites where "Story Points" has different ids. The default list is:
custom_fields: ["Story Points", "Story point estimate", "Sprint", "Acceptance Criteria", "Epic Link"]Setting custom_fields replaces that list. custom_fields: ["*"] copies every non-empty custom field.
Values are simplified so an agent reads values, not Jira's envelopes: an option or user object becomes its name, a cascading select becomes Parent / Child, a rich-text document becomes Markdown, multi-line text is converted from wiki markup, lists stay lists, and empty members are removed. An object of an unknown shape is kept without its empty parts, at most four levels deep.
Search
A neutral TicketSearchQuery is turned into JQL. Every user-supplied value ends up inside a quoted literal.
| Query field | JQL |
|---|---|
projects (or the entry's projects when absent) | project in ("PAY", "MOB") |
text | (summary ~ "…" OR description ~ "…") |
statusCategories | statusCategory in ("new", "indeterminate", "done") for todo, in_progress, done |
updatedSince | updated >= <milliseconds since the epoch> |
| always | ORDER BY updated DESC |
- In
text, the characters Jira's text search treats as operators and the wordsAND,OR,NOTare neutralised, so the text is only ever a list of words; it is cut to 250 characters. updatedSincemust be an ISO 8601 date or date-time. A time without an offset is read as UTC. Anything else isINVALID_INPUT.- Jira Cloud rejects unbounded queries, so a query with no restriction at all (and no
projectson the entry) fails withINVALID_INPUTon Cloud. On Data Center it runs asORDER BY updated DESC.
Native JQL
native is sent to Jira as written; the other query fields and the entry's projects are then ignored.
import { createSafran } from "@safran/core";
await using safran = await createSafran({ profile: "safran.yaml" });
const neutral = await safran.tickets.search({ text: "kısmi iade", projects: ["PAY"], statusCategories: ["done"] });
const native = await safran.tickets.search({ native: 'project = PAY AND labels = "iade" ORDER BY created DESC' }, { tracker: "jira", limit: 20 });
for (const item of [...neutral.items, ...native.items]) console.log(item.key, item.status, item.title);A query Jira rejects (HTTP 400 or 422) becomes INVALID_INPUT, with Jira's own message in the hint.
Comments, links, history, attachments
- Comments are paged by offset, bodies converted to Markdown.
- Links returns, in this order: the parent, issue links with their direction as Jira words it ("blocks" / "is blocked by"), sub-tasks, children, and remote links as
weblinks. Children are found by search (parent = KEYon Cloud) and capped atJIRA_MAX_CHILDREN. The child search and the remote-link lookup are best effort: when one fails for a reason other than cancellation, a missing token or a rate limit, the remaining links are still returned. - History returns one entry per changed field. Old and new values are cut to
JIRA_HISTORY_VALUE_CHARScharacters. - Attachments are listed from the issue. A download must name an attachment that belongs to that ticket (otherwise
NOT_FOUND), and is refused withINVALID_INPUTaboveMAX_ATTACHMENT_BYTES. The size is checked from the metadata first and counted again while the body streams, so a wrong size in the metadata cannot exceed the cap.
Limits
| Constant | Value | Meaning |
|---|---|---|
DEFAULT_PAGE_SIZE / MAX_PAGE_SIZE | 50 / 100 | Comments, history entries and search results per page. |
MAX_ATTACHMENT_BYTES | 50 MiB | Largest attachment that is downloaded. |
JIRA_MAX_CHILDREN | 100 | Children listed by links; an epic with more shows the first ones. |
JIRA_HISTORY_VALUE_CHARS | 500 | Characters kept of each old and new value in history. |
JIRA_MAX_PROJECT_PAGES | 20 | Pages of 100 projects read by listProjects on Cloud. |
MAX_REF_LENGTH | 2048 | Longest input looked at as a ticket reference. |
Known caveats
This connector is implemented from Atlassian's published API documents and tested against recorded-shape fixtures; it has not been run against a live Jira. See verification status. The Cloud resources it uses were checked against the Cloud OpenAPI document. The following are marked UNVERIFIED in the source:
- Status categories in Cloud JQL. A
statusCategoriesfilter is written with the keysnew,indeterminateanddone. The Data Center reference documents them; that Cloud accepts the same keys was not confirmed. If such a search is rejected, usenative. - Data Center, in general. Only personal access token authentication and the comment and remote-link resources were checked against documentation. The rest follows the long-standing REST v2 behaviour:
- search uses
POST /rest/api/2/searchwithstartAt/maxResults/total; listProjectsexpectsGET /rest/api/2/projectto answer with a plain array;- attachments are downloaded from the
contentURL of the attachment metadata, and only when that URL is on the configured site (otherwise it is rebuilt as/secure/attachment/<id>/<filename>); - children of an epic are searched with
"Epic Link" = KEY, which needs Jira Software; - history is read with
expand=changelog, which returns the whole changelog in one response and is then paged locally.
- search uses
See also
- Connectors overview for the rules shared by all connectors.
- Tickets in the SDK and the MCP ticket tools.
- Confluence, which usually shares the site and the account.