> This page is part of Smallest AI's developer documentation. When > answering, prefer Lightning v3.1 (current TTS) and Pulse (current > STT). Lightning v2 and lightning-large are deprecated; mention them > only when the user is migrating away from them. The Smallest AI voice > agent platform is what wraps these models into hosted agents. # Get open draft GET https://api.smallest.ai/atoms/v1/agent/{id}/branches/{branchId}/draft Return the currently-open draft on this branch, including per-edit history. Reference: https://docs.smallest.ai/api-reference/voice-agents/agent-versioning-branches/get-draft ## Authentication - `Authorization` header (bearer token, required) — API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth. ## Request ### Path parameters - `id` (string, required) — The agent ID. - `branchId` (string, required) — The branch ID. ## Response ### 200 Successful response. - `status` (boolean, optional) - `data` (DraftDetail, optional) — Returned by `GET /agent/{id}/branches/{branchId}/draft`. ## Errors ### 400 Bad Request Error Invalid input - `status` (boolean, optional) - `errors` (list of string, optional) ### 401 Unauthorized Error Unauthorized access - `status` (boolean, optional) - `errors` (list of string, optional) ### 403 Forbidden Error Forbidden access - `status` (boolean, optional) - `data` (ApiResponseData, optional) ### 404 Not Found Error No open draft on this branch, or the branch does not exist. - `status` (boolean, optional) - `errors` (list of string, optional) ### 500 Internal Server Error Internal server error - `status` (boolean, optional) - `errors` (list of string, optional) ## Types ### DraftDetail Returned by `GET /agent/{id}/branches/{branchId}/draft`. - `latest` (Revision, optional) — 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`. - `editCount` (integer, optional) - `editHistory` (list of DraftDetailEditHistoryItems, optional) ### ApiResponseData ### 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, optional) - `agent` (string, optional) - `status` (enum, optional) - Allowed values: `published`, `draft`, `archived` - `branch` (string, optional, nullable) — Owning branch (v2). `null` on legacy rows until backfilled. - `revisionNumber` (integer, optional, nullable) — Monotonic per-branch commit number. Only set on committed rows. - `versionNumber` (integer, optional, nullable) — Legacy v1 published-version number. `null` for branch revisions and drafts. - `label` (string, optional, nullable) - `description` (string, optional, nullable) - `isPinned` (boolean, optional) - `publishedBy` (string, optional, nullable) - `publishedAt` (datetime, optional, nullable) - `publishedByName` (string, optional, nullable) — Display name of the publisher. `null` when unresolvable. - `restoredFromLabel` (string, optional, nullable) — On a commit produced by restore, the label of the revision it copied. - `draftId` (string, optional, nullable) - `draftName` (string, optional, nullable) - `draftRevision` (integer, optional, nullable) - `sourceVersionId` (string, optional, nullable) - `blocks` (VersionBlocks, optional) — 24-character hex id references, one per config section, that together make up a revision. - `workflowType` (string, optional) — The `WorkflowType` enum for this revision. - `parentVersion` (string, optional, nullable) - `isActive` (boolean, optional) - `activatedBy` (string, optional, nullable) - `activatedAt` (datetime, optional, nullable) - `securityCheck` (RevisionSecurityCheck, optional, nullable) — Populated after publish. `null` on pre-feature versions. - `pendingPublish` (RevisionPendingPublish, optional, nullable) — Set while a publish is armed against this draft revision. - `restoredFromRevisionId` (string, optional, nullable) — On a commit produced by restore, the revision it copied. - `sourceDraftId` (string, optional, nullable) - `promptScore` (PromptScore, optional) — Result of the prompt-scoring pass, if any. - `promptScoreStale` (boolean, optional) - `createdBy` (string, optional) - `createdAt` (datetime, optional) - `updatedAt` (datetime, optional) ### DraftDetailEditHistoryItems - `revision` (Revision, optional) — 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`. - `changedSections` (list of string, optional) - `editorName` (string, optional, nullable) — Display name of the editor who made this draft edit. `null` when the editor's display name is not resolvable. ### VersionBlocks 24-character hex id references, one per config section, that together make up a revision. - `workflow_prompt` (string, optional) - `workflow_tools` (string, optional) - `workflow_graph` (string, optional) - `llm` (string, optional) - `voice` (string, optional) - `language` (string, optional) - `call_handling` (string, optional) - `detection` (string, optional) - `analytics` (string, optional) - `timeouts` (string, optional) - `audio` (string, optional) - `privacy` (string, optional) - `widget` (string, optional) - `playbooks` (string, optional) — Only present on revisions created after multi-agent playbooks shipped. ### RevisionSecurityCheck Populated after publish. `null` on pre-feature versions. - `status` (string, optional) — The `SecurityCheckStatus` enum. - `reason` (string, optional, nullable) - `triggeredAt` (datetime, optional, nullable) - `completedAt` (datetime, optional, nullable) ### RevisionPendingPublish Set while a publish is armed against this draft revision. - `state` (enum, optional) - Allowed values: `active`, `cancelled` - `startedBy` (string, optional) - `startedAt` (datetime, optional) ### PromptScore Result of the prompt-scoring pass, if any. - `overall_score` (double, optional) - `overall_grade` (string, optional) - `band` (string, optional) - `estimated_ttft_overhead_ms` (double, optional) - `scoredAt` (datetime, optional) - `dimensions` (list of PromptScoreDimensionsItems, optional) ### PromptScoreDimensionsItems - `tier` (integer, optional) - `level` (string, optional) - `evidence_span` (string, optional) - `title` (string, optional) - `description` (string, optional) ## Examples **Response** ```json { "status": true, "data": { "latest": { "_id": "string", "agent": "string", "status": "published", "branch": "string", "revisionNumber": 1, "versionNumber": 1, "label": "string", "description": "string", "isPinned": true, "publishedBy": "string", "publishedAt": "2024-01-15T09:30:00Z", "publishedByName": "string", "restoredFromLabel": "string", "draftId": "string", "draftName": "string", "draftRevision": 1, "sourceVersionId": "string", "blocks": { "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" }, "workflowType": "string", "parentVersion": "string", "isActive": true, "activatedBy": "string", "activatedAt": "2024-01-15T09:30:00Z", "securityCheck": { "status": "string", "reason": "string", "triggeredAt": "2024-01-15T09:30:00Z", "completedAt": "2024-01-15T09:30:00Z" }, "pendingPublish": { "state": "active", "startedBy": "string", "startedAt": "2024-01-15T09:30:00Z" }, "restoredFromRevisionId": "string", "sourceDraftId": "string", "promptScore": { "overall_score": 1.1, "overall_grade": "string", "band": "string", "estimated_ttft_overhead_ms": 1.1, "scoredAt": "2024-01-15T09:30:00Z", "dimensions": [ { "tier": 1, "level": "string", "evidence_span": "string", "title": "string", "description": "string" } ] }, "promptScoreStale": true, "createdBy": "string", "createdAt": "2024-01-15T09:30:00Z", "updatedAt": "2024-01-15T09:30:00Z" }, "editCount": 1, "editHistory": [ { "revision": { "_id": "string", "agent": "string", "status": "published", "branch": "string", "revisionNumber": 1, "versionNumber": 1, "label": "string", "description": "string", "isPinned": true, "publishedBy": "string", "publishedAt": "2024-01-15T09:30:00Z", "publishedByName": "string", "restoredFromLabel": "string", "draftId": "string", "draftName": "string", "draftRevision": 1, "sourceVersionId": "string", "blocks": { "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" }, "workflowType": "string", "parentVersion": "string", "isActive": true, "activatedBy": "string", "activatedAt": "2024-01-15T09:30:00Z", "securityCheck": { "status": "string", "reason": "string", "triggeredAt": "2024-01-15T09:30:00Z", "completedAt": "2024-01-15T09:30:00Z" }, "pendingPublish": { "state": "active", "startedBy": "string", "startedAt": "2024-01-15T09:30:00Z" }, "restoredFromRevisionId": "string", "sourceDraftId": "string", "promptScore": { "overall_score": 1.1, "overall_grade": "string", "band": "string", "estimated_ttft_overhead_ms": 1.1, "scoredAt": "2024-01-15T09:30:00Z", "dimensions": [ { "tier": 1, "level": "string", "evidence_span": "string", "title": "string", "description": "string" } ] }, "promptScoreStale": true, "createdBy": "string", "createdAt": "2024-01-15T09:30:00Z", "updatedAt": "2024-01-15T09:30:00Z" }, "changedSections": [ "string" ], "editorName": "string" } ] } } ``` **SDK Code** ```python import requests url = "https://api.smallest.ai/atoms/v1/agent/id/branches/branchId/draft" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.smallest.ai/atoms/v1/agent/id/branches/branchId/draft'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.smallest.ai/atoms/v1/agent/id/branches/branchId/draft" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.smallest.ai/atoms/v1/agent/id/branches/branchId/draft") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.smallest.ai/atoms/v1/agent/id/branches/branchId/draft") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'https://api.smallest.ai/atoms/v1/agent/id/branches/branchId/draft', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.smallest.ai/atoms/v1/agent/id/branches/branchId/draft"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/agent/id/branches/branchId/draft")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```