Skip to content
safran

Type to search. Enter opens the first result.

    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-1423
    read-ticket.ts
    import { 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

    DeploymentWhat is sentWhat you need
    cloud (default)Authorization: Basic with the account e-mail and an API tokenemail_env and token_env. email_env is required on Cloud.
    datacenterAuthorization: Bearer with a personal access tokentoken_env only.
    datacenter with email_envAuthorization: Basic with that user name and the token as passwordFor 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

    FieldTypeDefaultRequiredMeaning
    idstringyesName of this entry; used as jira:PAY-1423 and in Ticket.tracker.
    type"jira"yesSelects this plugin.
    urlURLyesSite root, e.g. https://acme.atlassian.net, or with a context path https://jira.acme.test/jira. No credentials, query string or fragment.
    deploymentcloud or datacentercloudnocloud: REST v3, Basic e-mail + API token. datacenter: REST v2, Bearer personal access token.
    email_envvariable nameon CloudVariable holding the account e-mail (Cloud), or the user name for Basic auth on Data Center.
    token_envvariable nameyesVariable holding the API token or personal access token.
    projectsstring[][]noProject keys this tracker owns. Restricts reference matching, listProjects and neutral searches.
    custom_fieldsstring[]DEFAULT_JIRA_CUSTOM_FIELDSnoDisplay 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.

    InputWith projects: [PAY, MOB, WEB]Without projects
    PAY-1423PAY-1423PAY-1423
    pay-1423 (from a branch name)PAY-1423not matched
    PAY-0042PAY-42PAY-42
    OPS-1not matchedOPS-1
    utf-8, sha-256not matchednot matched
    1423, #1423not matchednot matched
    https://acme.atlassian.net/browse/PAY-1423PAY-1423PAY-1423
    acme.atlassian.net/browse/PAY-1423 (no scheme)PAY-1423PAY-1423
    …/issues/PAY-1423, REST …/issue/PAY-1423PAY-1423PAY-1423
    Service desk …/portal/3/PAY-1423PAY-1423PAY-1423
    Board URL with ?selectedIssue=PAY-1423PAY-1423PAY-1423
    The same paths on another hostnot matchednot matched

    The rules behind the table:

    • With a projects list, 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 keeps utf-8 and covid-19 from 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 #123 are 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 fieldSource in Jira
    key, title, urlIssue key, summary, <url>/browse/<key>
    type, statusIssue type name, status name
    statusCategoryThe status category key: new → todo, indeterminate → in_progress, done → done
    projectProject key
    descriptionConverted to Markdown: Atlassian Document Format on Cloud, wiki markup on Data Center
    priority, labels, assignee, reporterThe fields of the same name
    parentThe parent field; otherwise the issue named by an "Epic Link" field
    createdAt, updatedAt, resolvedAtcreated, 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.

    A neutral TicketSearchQuery is turned into JQL. Every user-supplied value ends up inside a quoted literal.

    Query fieldJQL
    projects (or the entry's projects when absent)project in ("PAY", "MOB")
    text(summary ~ "…" OR description ~ "…")
    statusCategoriesstatusCategory in ("new", "indeterminate", "done") for todo, in_progress, done
    updatedSinceupdated >= <milliseconds since the epoch>
    alwaysORDER BY updated DESC
    • In text, the characters Jira's text search treats as operators and the words AND, OR, NOT are neutralised, so the text is only ever a list of words; it is cut to 250 characters.
    • updatedSince must be an ISO 8601 date or date-time. A time without an offset is read as UTC. Anything else is INVALID_INPUT.
    • Jira Cloud rejects unbounded queries, so a query with no restriction at all (and no projects on the entry) fails with INVALID_INPUT on Cloud. On Data Center it runs as ORDER BY updated DESC.

    Native JQL

    native is sent to Jira as written; the other query fields and the entry's projects are then ignored.

    search-jql.ts
    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 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 web links. Children are found by search (parent = KEY on Cloud) and capped at JIRA_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_CHARS characters.
    • Attachments are listed from the issue. A download must name an attachment that belongs to that ticket (otherwise NOT_FOUND), and is refused with INVALID_INPUT above MAX_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

    ConstantValueMeaning
    DEFAULT_PAGE_SIZE / MAX_PAGE_SIZE50 / 100Comments, history entries and search results per page.
    MAX_ATTACHMENT_BYTES50 MiBLargest attachment that is downloaded.
    JIRA_MAX_CHILDREN100Children listed by links; an epic with more shows the first ones.
    JIRA_HISTORY_VALUE_CHARS500Characters kept of each old and new value in history.
    JIRA_MAX_PROJECT_PAGES20Pages of 100 projects read by listProjects on Cloud.
    MAX_REF_LENGTH2048Longest 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 statusCategories filter is written with the keys new, indeterminate and done. The Data Center reference documents them; that Cloud accepts the same keys was not confirmed. If such a search is rejected, use native.
    • 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/search with startAt / maxResults / total;
      • listProjects expects GET /rest/api/2/project to answer with a plain array;
      • attachments are downloaded from the content URL 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.

    See also