REST API #

View this page as Markdown

On this page

Use the REST API to read and update a tzTrack space from a script or integration. It also supports the full configuration and release records, which the MCP tools do not expose.

For a plain-language explanation of the records and their fields, read What the database stores. The API uses the same tzTrack token as an AI tool's signed-in connection, with the same access level and rules.

The OpenAPI 3.1 document for this REST API is served at /tztrack/openapi.json for client generators and API tools.

Requests and responses #

Send a POST to https://tztrack.dev.turnzero.ai/v1/<act>, such as /v1/find. The body is a JSON object containing the action's request fields and, when needed, space. An empty body counts as {}.

The same host serves issue pages at GET /issues/<space-id>/<number> for a signed-in browser. These return HTML; the REST actions below keep their bearer-token authentication.

Except for list_spaces, leave out space to use your default space, the one you set with the MCP tool choose_space (tztrack_choose_space on the Turn Zero connection). Until you set one, the first space your account creates is your default, and if you can reach exactly one space, owned or shared, it is used. The project's setting file records the selected space. A request that leaves out space is refused with HTTP 409 when no default can be chosen:

  • space_needed: The account has no space its tzTrack issue tools can work in. If the detail names Turn Zero feedback, use the Turn Zero Cloud actions it gives. Otherwise, create your first space with tzTrack's MCP tools or on the Turn Zero account page, then retry.
  • default_space_needed: you can reach several spaces and none is your default. Pass space.
  • default_space_changed: your default changed in the last 24 hours. For 24 hours after the change, a request that changes the space, its issues, settings, or sharing, and leaves out space is refused; one that only reads proceeds. Pass space; the refusal's next.space is the new default's ID.

The request body can be up to 65,536 bytes, or 3,145,728 bytes for raise and comment, which support images.

A successful call other than list_spaces returns HTTP 200 and four JSON fields:

  • space: the selected space's ID;
  • space_chosen_by: named when the request gave space, and account_default when it used your default;
  • act: the action's name;
  • result: the response fields listed in the action table below.

list_spaces selects no space. It returns act and result. The result holds default, spaces, and window_ends_at while the default-change window is active.

A failed call returns an error status and two JSON fields: error, the refusal code, and detail, an explanation of what to do next. renamed also returns successor, the new call’s name. default_space_changed also returns next, holding space, the ID to pass. Use error in program logic; the wording of detail can change. A refused call changes nothing.

The token #

Send a tzTrack token in the authorization header as Bearer <token>. It is the token Turn Zero signs for tzTrack, the same token an AI tool holds after you sign in.

A script or CI job can obtain a token in either of these ways:

  • From a signed-in Turn Zero Cloud session, call mint_token with grant tztrack and a label. Run the returned token claim command in your terminal so the token value stays out of chat. See Mint a token.
  • Use device sign-in with https://tztrack.ai/mcp as the resource. A person approves the sign-in in a browser. See Sign in from a script.

Store the token as a secret. The REST API verifies it using the same rules as an AI tool's signed-in connection.

Other credentials, including tokens for another Turn Zero product, return credential_refused. A missing authorization header returns credential_required. Both responses include a www-authenticate header identifying the sign-in endpoint.

Your own space lists you as Owner at owner, with no member row. Shared-space names are Viewer (view), Reporter (report), Contributor (contribute) and Admin (owner). Only the Owner manages membership. A row's restricted setting and any accounts bound govern visibility. Sharing a space gives each level's actions and what it reads.

Connect a script with no AI tool #

Obtain a tzTrack token through Mint a token or Sign in from a script, and store it as TZTRACK_TOKEN in your secret store.

For example, this shell command lists open issues:

curl -s -X POST https://tztrack.dev.turnzero.ai/v1/find -H "authorization: Bearer $TZTRACK_TOKEN" -H "content-type: application/json" -d '{"state":"open","limit":20}'

If you have several spaces, include the chosen space's id as space in the JSON body. Use your shell's environment-variable syntax; the example uses a POSIX shell.

Supported actions #

The table lists each action's minimum access level, request fields, and response fields under result. A view member can use find, read, and read_attachment on unrestricted issues only; this level is separate from the ranked levels below. Where supported, supply an idempotency key to prevent a retried write from being applied twice.

tzTrack attributes writes to your account and token label. To show a name beside a write, add name to the actor object alongside kind, provider and session. The name is optional and must be one line of 1 to 64 characters. A name outside that length, or one containing a control character, email address, telephone number, card number or credential, is refused with invalid_request at actor.name.

Identify an issue by its number, such as 12 or "#12", or its ID. This applies to issue, close.target, add_report.repeat_of, and relate.target except an arising_from or tracked_in reference.

Action Minimum access Request result
raise report origin, kind, title; where you have them, text, impact, workaround, proposed_resolution, seen_in, evidence, evidence_basis, restricted, component, problem_key, attachments, amends, withdraws, key; from contribute, requirements, labels, and priority, each refused grant_required below it report, issue, outcome, candidates, masked, personal_removed
add_report report report, repeat_of, key report, issue, outcome. If outcome is related, relation gives the visible relation or null.
find view on unrestricted issues, or report With query: text to search, filters state, kind, component, reporter_accounts, and limit, cursor. Without query: the filters state, outcome, kind, component, path, requirement, label, priority, effective_priority, alarm, origin, waiting_for, claimed_by, plan, reporter, reporter_accounts, proposed, related, since, due_before; order, limit, cursor issues, cursor; optional note
read view on unrestricted issues, or report issue A full read gives issue, watchers, reports, links, history, comments, relations, landings, checks, and proposals. An unbounded Reporter gets the full read for an unrestricted issue. Bounded members get their group's view and no watchers.
watch report issue and exactly one of handle or email: true. Optional until. issue, state, until, lapses_at, and watchers for unbounded members. With until: closed on a closed issue, lapses_at is null.
unwatch report issue and exactly one of handle or email: true. issue, removed, and watchers for unbounded members.
read_attachment view on unrestricted issues, or contribute id, one image's id as a report or a comment lists it media_type, the image's media type, and content, its bytes in base64url
update contribute issue, fields, key issue, mentioned
claim contribute issue and as only. Use as for your session or agent label. This action takes no actor object. issue, mentioned
comment contribute issue, text, attachments, key comment, issue, mentioned
relate contribute issue, type, target, withdraw, key issue, relation
take_next contribute role, branch, component, paths, plan, key issue, check, secret, packet
give_back contribute Exactly one of issue or check, and reason. Supply secret for a branch lease or a check. key is optional. issue and check, with the unused field null.
wait contribute issue, waiting_for, resolution, key issue
cache contribute since for a refresh link, expires_at, space, since, count, numbers, gone
land owner issue, commit, trailer, test, proof, remainder, component, key landing, issue
"deploy" owner release_line, version, order, commit, environment, live, withdrawn, key build
ship owner build, landings, key build, shipped
record_check owner check, covers, result, builds, cause, component, evidence, withdraw, key check, issue, outcome
close contribute for tasks; owner otherwise issue and outcome. resolution is required except with noted or duplicate. target is required only with duplicate. fixed_in applies to done. key is optional. Below Admin, tasks alone with any outcome their state admits except duplicate. issue, related_open
reopen contribute for tasks; owner otherwise issue, key issue
unmerge owner issue, key issue
configure_space owner components, release_lines, credential_forms, personal_forms, automation, critical_actions, constants configuration
export_space owner limit (1 to 500; 50 if omitted), optional kinds (1 to 5 distinct names: issues, comments, landings, builds, checks; omit for all kinds), cursor; keep the same kinds with each cursor issues, comments, landings, builds, checks, cursor; lists not selected by kinds are empty
count owner the filters state, outcome, kind, component, label, exclude_label, waiting_for, claimed_by, effective_priority, requirement; group_by total, groups; optional note
read_rates owner since, until, grain, component, kind, label, exclude_label since, until, grain, steps, time_to_close
read_space owner nothing space, counts, configuration, sampled_merges, restores, pass_runs
list_spaces Account No fields. Send {}. default, spaces, and window_ends_at while the default-change window is active.

When marking a bug or friction issue done, include fixed_in if it has a report with origin test, beta, field, or platform and no recorded landing. Give the build that serves the fix, or null if no build serves it yet.

A new take_next skips a check linked to a restricted issue you cannot read. If a repeated take_next or a give_back returns a check, the check's issue is null when it has no linked issue or you cannot read its linked restricted issue. record_check follows the same rule and its top-level issue is also null when you cannot read the check's linked restricted issue. The service keeps the stored link.

With query, find takes only state, kind, component, and reporter_accounts filters. List-only filters are refused invalid_request; omit query to use them.

In a request, update's fields takes due_date, note_to_reporters, and impact_assessment. It also takes labels_add and labels_remove, each a list of 1 to 20 labels. The service applies them to the issue's labels as they stand, so two writers' additions are both kept. labels replaces the whole list and is refused invalid_request beside either. An update that would leave more than 20 labels is refused state_conflict.

Every build names its release line as release_line: the body of "deploy", the build of ship, the builds of record_check, each entry of seen_in, and the fixed_in of close. Without query, find and count filter by effective_priority, find orders by ranking score with order: "ranking_score", and count groups by effective priority with group_by: "effective_priority".

watch sends messages to handle, or, with email: true, emails the token's own account at its verified sign-in addresses. unwatch stops the selected delivery. Name exactly one of handle and email: true; both or neither, any other email value, or a handle starting with email:, is refused invalid_request.

Use /v1/watch to set an email watch on production and /v1/unwatch to stop it. A credential that names no account, such as a Cloud backend's space credential, or a call through relay_issue_act, is refused watch_refused for email. Watching an issue gives the confirmation, messages and emails, lapse, and limit. Neither call takes a key: a repeated watch renews the standing watch and sends nothing.

An email's stop link is https://tztrack.ai/v2/archive/stop/<token>. GET shows a page and changes nothing; the button makes a POST that stops the watch. These are HTML pages, not JSON API responses. An invalid or expired link answers 401. The link's lifetime and the way to stop a watch after it expires are in Watching an issue.

Responses identify a report's submitter in reporter, and a comment's writer and number in author and number. History entries, relationships, landings, and checks identify their creator in performed_by. Issues include effective_priority, ranking_score, and claim_stale; the last is true when a claim has gone untouched for a day. On the 0.3.0 wire, a whole issue includes url, its page address, or null if no issue-page origin is set. A reading actor's projection omits url.

The Issue Tracking contract defines the types, limits, and meaning of every request and response field.

The list_spaces response gives your level, its name in role, restricted, any accounts bound, admitted actions and the space's owner. The company feedback space appears for an operator-granted member, with owner: null, no configure action and the group's account bound.

A bounded row reads only the group's reports and no restricted issue. Within its level, it admits only reads, filing, updating, commenting, watching, stopping a watch, closing and reopening tasks the group opened. Other calls refuse grant_required. Outside issues answer as absent; a bounded filing opens its own issue and joins none.

For membership, the Turn Zero connection's "share_space" HTTP action takes space, the sign-in email in add, and optional level, restricted and accounts. Use remove instead of add to remove a member. These are forwarded platform calls, not the underlying contract's member_set or member_remove actions.

New rows default to restricted: false; Viewer, Reporter and bounded rows never read restricted issues. Existing rows without that setting keep their earlier level-based access. accounts names 1 to 19 other account IDs, at most 20 with the member's own. Leaving either setting out keeps it; accounts: null removes the bound. Only the Owner changes membership.

The direct MCP door's sharing call takes action, email and level, with optional restricted and accounts when action is add. The platform validates those settings. With remove, either setting is refused invalid_request and nothing changes. Its "list_space_members" answer gives each member's level, role, restricted and any accounts bound.

API restrictions #

The REST API sets some values itself and restricts others. A request that exceeds these restrictions is refused.

The API sets these values regardless of the request body:

  • Writes identify your account and token label as an agent actor.
  • A report defaults to evidence_basis: "claimed" when the field is omitted.
  • Reports submitted below owner access use origin: "field".

These restrictions apply to request fields:

  • An evidence_basis other than claimed is refused invalid_request. So is a seen_in entry other than { release_line, version, environment } with a repository commit as its version.
  • A body that names relayed_level is refused invalid_request. Your level in the space decides which restricted issues your filings join.
  • A waiting_for of person:<account> names the space's owner or one of its members, and any other account is refused invalid_request. A text value of waiting_for is at most 200 characters, including its prefix. A longer person: or outside: value is refused invalid_request, with the bound and its length in detail.
  • Below the owner's level, an update that lowers restricted or names alarm is refused grant_required. A relate of type arising_from or tracked_in whose target is a number sign followed by a positive integer is refused invalid_request there too. A change to or from kind task also needs Admin (owner).
  • configure_space accepts the fields listed in the table. Supported constants are report_text_retention_days, priority_boost_report_threshold, priority_boost_window_days, max_counted_reports_per_account, and internal_report_ranking_weight. It refuses every other constant, including model_calls_per_day.
  • Enabling background reviews can also initialize the model budget; see Background AI reviews.
  • If your waiting_for value matches no accepted form, find without query returns an empty page and count returns 0, each with a note listing those forms.
  • Any other unsupported field or value is refused invalid_request. Read detail for the correction, and use the current names listed on this page.

Contract actions not listed here, including mint, revoke, "rename_space", and "delete_space", return grant_required at every access level. The direct tzTrack server's MCP tools "rename_space" and "delete_space" forward instead to the platform's HTTP actions with those names. They do not call these REST actions. The server also forwards "share_space", "list_space_members", "create_space", and submit_feedback to the platform.

Background AI reviews #

This section is for an AI tool or integration configuring the space. Use tztrack_configure_space on the Turn Zero connection to turn reviews on or off (The tools). A script uses the REST configure_space below, with owner access.

Name only the automation field you want to change. configure_space takes automation: { ai_reviews_enabled, upstream_sharing }. Setting ai_reviews_enabled to true turns this setting on; false turns it off and is the default.

Reviews also need the space's tzTrack AI reviews option. With that option off, a new issue opens open, whatever the setting says; the setting is kept. Space limits and tzTrack AI reviews explains the option. The call keeps an omitted upstream_sharing field unchanged and refuses a field set to null as invalid_request.

When reviews are enabled on a space with no model budget, the API sets a budget of 200 model calls per day. An existing budget is unchanged. Callers cannot set model_calls_per_day through this API.

Ask the person before enabling reviews unless their request already authorizes it. Issues and kinds explains when reviews are useful and the tzTrack AI reviews option. Read the configuration back after the change before reporting success.

Refusals #

A refusal names itself in error. Refusals gives each one's status, cause, and remedy, from credential_required to rate_limited.

Old REST names are refused as renamed, with the new name in successor. The call makes no change.

Old name Current name
submit raise
follow add_report
list, search find
attachment read_attachment
settle close
next take_next
check record_check
configure configure_space
export export_space
rates read_rates

An unknown action path returns HTTP 404 not_found; check its spelling against the table. A method other than POST on a supported action path returns HTTP 405 method_not_allowed, with allow: POST.

Submit an issue #

To submit an issue in a selected space, use this POSIX shell example with the token in TZTRACK_TOKEN:

curl -s -X POST https://tztrack.dev.turnzero.ai/v1/raise -H "authorization: Bearer $TZTRACK_TOKEN" -H "content-type: application/json" -d '{"space": "<id>", "origin": "workspace", "kind": "bug", "title": "The nightly build fails on the login test", "text": "Seen on three runs since Monday."}'

Replace <id> with the space's ID. Other HTTP clients use the same method, header, and JSON body.

  • The tools lists the tzTrack tools on the Turn Zero connection, which support some of the same actions and permissions.
  • Refusals lists every refusal with its remedy.
  • Sharing a space explains member access levels.
  • The setting file gives the file that holds a project's space id.