---
title: "Rerun Ticket Agent"
method: POST
path: "/api/psa/{team_key}/ticket/{ticket_key}/rerun"
tags: ["psa"]
---

# Rerun Ticket Agent

`POST /api/psa/{team_key}/ticket/{ticket_key}/rerun`

## Request

- Base URL: `https://api.superit.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.superit.ai/api/psa/{team_key}/ticket/{ticket_key}/rerun`
- Auth: HTTP bearer

Manually re-run one agent flow for a ticket (scope-forced).

``triage`` runs triage only; ``investigate`` / ``analyse`` run triage then
that arm. Enqueues ``rerun_workflow`` and returns its id.

Security gates (branch-review S2, all four):

- Elevated only — end-customer roles must not trigger LLM spend.
- 404 before any dispatch when the ticket isn't visible to the caller.
- Runs under the ticket's **managed** team (resolved via ``psa.team_link``)
  so the arms / AgentRun / GUC match organic intake — under the managed
  GUC ``psa.msp_tickets`` returns zero rows, closing the SP-context
  cross-customer exfil surface. Falls back to the ticket's own team.
- Concurrency-guarded, but repeatable: each run gets a UNIQUE workflow id
  ``rerun:{flow}:{ticket_key}:{run_key}``, enqueued on the ``psa.intake``
  partitioned queue keyed by ``ticket_key`` (SUP-711). Partitioned queues
  forbid ``deduplication_id`` (DBOS raises at enqueue), so instead of a
  queue-level dedup key, a prefix guard on ``rerun:{flow}:{ticket_key}:``
  finds any still-active run for the same (flow, ticket) and returns its
  id instead of dispatching a second workflow; once the prior run reaches
  a terminal state the guard no longer matches, so an operator can
  legitimately rerun a flow again over the ticket's life. The
  check-then-enqueue window is harmless — the partition serializes any
  stragglers.
- Every flow re-checks the effective team's autonomy config — a manual
  rerun must not bypass ``level_zero_tiers`` / ``ticket_analysis_enabled``.

## Path parameters

- `ticket_key` string, required
- `team_key` string, required

## Request body

- RerunRequest: Body for a manual agent re-run: which flow to re-run.
  - `flow` 'triage' | 'investigate' | 'analyse', required

## Response `200`

Successful Response

- RerunAccepted: Response for an accepted re-run — the enqueued workflow id.
  - `workflow_id` string, required

## Other responses

- `400`: Invalid input
- `401`: Not authenticated
- `403`: Forbidden
- `404`: Not found
- `405`: Method not allowed
- `409`: Conflict
- `422`: Validation Error

---

[API](https://skmtc.dev/superit/apis/super-it-api.md) - [All operations](https://skmtc.dev/superit/apis/super-it-api/llms.txt) - [OpenAPI document](https://skmtc.dev/superit/apis/super-it-api/revisions/4944d556c2bb?raw)
