---
title: "Get open draft"
method: GET
path: "/agent/{id}/branches/{branchId}/draft"
tags: ["Agent Versioning - Branches"]
---

# Get open draft

`GET /agent/{id}/branches/{branchId}/draft`

Return the currently-open draft on this branch, including per-edit history.

## Path parameters

- `id` string, required
- `branchId` string, required

## Response `200`

Successful response.

- object
  - `status` boolean
  - `data` DraftDetail — Returned by `GET /agent/{id}/branches/{branchId}/draft`.
    - `latest` Revision — An `AgentVersion` document. Represents either a committed revision (`status: published`, with `branch` + `revisionNumber`) or an in-progress draft revision (`status: draft`, with `draftId` + `draftRevision`). Fields that do not apply to a given row are `null`.
      - `_id` string
      - `agent` string
      - `status` 'published' | 'draft' | 'archived'
      - `branch` string, nullable — Owning branch (v2). `null` on legacy rows until backfilled.
      - `revisionNumber` integer, nullable — Monotonic per-branch commit number. Only set on committed rows.
      - `versionNumber` integer, nullable — Legacy v1 published-version number. `null` for branch revisions and drafts.
      - `label` string, nullable
      - `description` string, nullable
      - `isPinned` boolean
      - `publishedBy` string, nullable
      - `publishedAt` string, date-time, nullable
      - `publishedByName` string, nullable — Display name of the publisher. `null` when unresolvable.
      - `restoredFromLabel` string, nullable — On a commit produced by restore, the label of the revision it copied.
      - `draftId` string, nullable
      - `draftName` string, nullable
      - `draftRevision` integer, nullable
      - `sourceVersionId` string, nullable
      - `blocks` VersionBlocks — ObjectId references to the `AgentConfigBlock` docs that make up a revision, one per config section.
        - `workflow_prompt` string
        - `workflow_tools` string
        - `workflow_graph` string
        - `llm` string
        - `voice` string
        - `language` string
        - `call_handling` string
        - `detection` string
        - `analytics` string
        - `timeouts` string
        - `audio` string
        - `privacy` string
        - `widget` string
        - `playbooks` string — Only present on revisions created after multi-agent playbooks shipped.
      - `workflowType` string — The `WorkflowType` enum for this revision.
      - `parentVersion` string, nullable
      - `isActive` boolean
      - `activatedBy` string, nullable
      - `activatedAt` string, date-time, nullable
      - `securityCheck` object, nullable — Populated after publish. `null` on pre-feature versions.
        - `status` string — The `SecurityCheckStatus` enum.
        - `reason` string, nullable
        - `triggeredAt` string, date-time, nullable
        - `completedAt` string, date-time, nullable
      - `pendingPublish` object, nullable — Set while a publish is armed against this draft revision.
        - `state` 'active' | 'cancelled'
        - `startedBy` string
        - `startedAt` string, date-time
      - `restoredFromRevisionId` string, nullable — On a commit produced by restore, the revision it copied.
      - `sourceDraftId` string, nullable
      - `promptScore` PromptScore, nullable — Result of the prompt-scoring pass, if any.
        - `overall_score` number
        - `overall_grade` string
        - `band` string
        - `estimated_ttft_overhead_ms` number
        - `scoredAt` string, date-time
        - `dimensions` object[]
          - `tier` integer
          - `level` string
          - `evidence_span` string
          - `title` string
          - `description` string
      - `promptScoreStale` boolean
      - `createdBy` string
      - `createdAt` string, date-time
      - `updatedAt` string, date-time
    - `editCount` integer
    - `editHistory` object[]
      - `revision` Revision — An `AgentVersion` document. Represents either a committed revision (`status: published`, with `branch` + `revisionNumber`) or an in-progress draft revision (`status: draft`, with `draftId` + `draftRevision`). Fields that do not apply to a given row are `null`.
        - `_id` string
        - `agent` string
        - `status` 'published' | 'draft' | 'archived'
        - `branch` string, nullable — Owning branch (v2). `null` on legacy rows until backfilled.
        - `revisionNumber` integer, nullable — Monotonic per-branch commit number. Only set on committed rows.
        - `versionNumber` integer, nullable — Legacy v1 published-version number. `null` for branch revisions and drafts.
        - `label` string, nullable
        - `description` string, nullable
        - `isPinned` boolean
        - `publishedBy` string, nullable
        - `publishedAt` string, date-time, nullable
        - `publishedByName` string, nullable — Display name of the publisher. `null` when unresolvable.
        - `restoredFromLabel` string, nullable — On a commit produced by restore, the label of the revision it copied.
        - `draftId` string, nullable
        - `draftName` string, nullable
        - `draftRevision` integer, nullable
        - `sourceVersionId` string, nullable
        - `blocks` VersionBlocks — ObjectId references to the `AgentConfigBlock` docs that make up a revision, one per config section.
          - `workflow_prompt` string
          - `workflow_tools` string
          - `workflow_graph` string
          - `llm` string
          - `voice` string
          - `language` string
          - `call_handling` string
          - `detection` string
          - `analytics` string
          - `timeouts` string
          - `audio` string
          - `privacy` string
          - `widget` string
          - `playbooks` string — Only present on revisions created after multi-agent playbooks shipped.
        - `workflowType` string — The `WorkflowType` enum for this revision.
        - `parentVersion` string, nullable
        - `isActive` boolean
        - `activatedBy` string, nullable
        - `activatedAt` string, date-time, nullable
        - `securityCheck` object, nullable — Populated after publish. `null` on pre-feature versions.
          - `status` string — The `SecurityCheckStatus` enum.
          - `reason` string, nullable
          - `triggeredAt` string, date-time, nullable
          - `completedAt` string, date-time, nullable
        - `pendingPublish` object, nullable — Set while a publish is armed against this draft revision.
          - `state` 'active' | 'cancelled'
          - `startedBy` string
          - `startedAt` string, date-time
        - `restoredFromRevisionId` string, nullable — On a commit produced by restore, the revision it copied.
        - `sourceDraftId` string, nullable
        - `promptScore` PromptScore, nullable — Result of the prompt-scoring pass, if any.
          - `overall_score` number
          - `overall_grade` string
          - `band` string
          - `estimated_ttft_overhead_ms` number
          - `scoredAt` string, date-time
          - `dimensions` object[]
            - `tier` integer
            - `level` string
            - `evidence_span` string
            - `title` string
            - `description` string
        - `promptScoreStale` boolean
        - `createdBy` string
        - `createdAt` string, date-time
        - `updatedAt` string, date-time
      - `changedSections` string[]
      - `editorName` string, nullable — Display name of the editor who made this draft edit. `null` when the editor's display name is not resolvable.

## Other responses

- `400` — Invalid input
- `401` — Unauthorized access
- `403` — Forbidden access
- `404` — No open draft on this branch, or the branch does not exist.
- `500` — Internal server error

---

[API](https://skmtc.net/smallest-inc/apis/agent-management-api.md) · [All operations](https://skmtc.net/smallest-inc/apis/agent-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/smallest-inc/agent-management-api/revisions/c2d0eb64b01a/schema)
