> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Export flow for runtime (limited preview)

GET https://api.runtype.com/v1/flows/{id}/export-runtime

Export a fully-resolved, self-contained flow definition that the @runtypelabs/runtime package can consume directly at boot. All step configs are inlined; no live DB queries are needed at execution time. A configured `decision_judge` tool carries its published question set (questions, model, version, input mapping and current calibration) at `config.questionSet`, resolved once at export so a self-hosted runtime never looks the question set up; a question set that is missing, unpublished, owned by another account, or pinned to an unpublished version is reported in `warnings` with reason `question_set_unresolved` instead of failing the export. An export that would carry a literal credential typed into a tool config or MCP server is refused with `422` and code `raw_credential_in_export`. Requires the `RUNTIME:EXPORT` scope and an Enterprise plan (the `byoc` entitlement); an unentitled account receives `403` with code `BYOC_PLAN_REQUIRED` in every environment.

The response carries `hostDependencies`: the runtime seams the exported artifact needs a host to wire before it can run everything it describes. A durable-class step (`wait-until` or `crawl`) anywhere in the flow's executable closure declares a `durable-pause-host` dependency; a detached-capable dynamic subagent pool or a detached inline subagent tool declares a `background-run-coordinator` dependency. The array is empty when nothing needs wiring, and the export is never refused for a declared dependency.

The response also carries `warnings`: each Claude Managed agent the flow references (embedded only as a stub the runtime cannot run), and each child flow or sub-agent that an embedded agent could not include, with the reason, and each configured decision tool whose question set could not be resolved (`question_set_unresolved`). The array is empty when every child was embedded.

Reference: https://docs.runtype.com/api-reference/runtype-api/flows/export-flow-for-runtime-limited-preview

## Authentication

- `Authorization` header (bearer token, required) — API key or Clerk session token

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Path parameters

- `id` (string, required)

## Response

### 200

Exported flow definition

- `hostDependencies` (list of RuntimeHostDependency, required)
- `id` (string, required)
- `name` (string, required)
- `steps` (list of map from string to any, required)
- `warnings` (list of RuntimeExportWarning, required) — Referenced sub-agents, flows and question sets the export could not embed, each with the reason. The export still returns `200`; a tool or capability that names a dropped child is absent from the artifact. Empty when every child was embedded.
- `agents` (map from string to map from string to any, optional)
- `dependencyRefs` (V1FlowsIdExportRuntimeGetResponsesContentApplicationJsonSchemaDependencyRefs, optional)
- `description` (string, optional, nullable)

## Errors

### 400 Bad Request Error

Invalid flow ID

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 401 Unauthorized Error

Unauthorized

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 403 Forbidden Error

Insufficient permissions, or the account plan does not include runtime extraction (code `BYOC_PLAN_REQUIRED`, Enterprise plans only)

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 404 Not Found Error

Flow not found

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 422 Unprocessable Entity Error

The export would carry a literal credential (code `raw_credential_in_export`); `details` names each tool or MCP server field without echoing the value

- `error` (string, required)
- `code` (string, optional) — Stable refusal code: `raw_credential_in_export` or `selector_unsupported_agent_type`.
- `details` (list of RuntimeExportErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

### 500 Internal Server Error

Internal server error

- `error` (string, required)
- `code` (string, optional) — Stable error code. `insufficient_scope` marks an API key that lacks a scope this request needs.
- `details` (list of ErrorDetailsItems, optional)
- `requiredScopes` (list of string, optional) — On `insufficient_scope`: every API key scope this request needs.

## Types

### RuntimeHostDependency

- RuntimeHostDependency0
- RuntimeHostDependency1
- RuntimeHostDependency2

### RuntimeExportWarning

- `childKind` (enum, required) — What kind of child the warning is about. `question_set` names the question set id in `childId`.
  - Allowed values: `agent`, `flow`, `question_set`
- `code` (enum, required) — `child_dropped`: the child is absent from the artifact. `child_stubbed`: the artifact carries a stub the runtime cannot run, or a configured decision tool without its question set.
  - Allowed values: `child_dropped`, `child_stubbed`
- `message` (string, required)
- `reason` (enum, required) — Why the export could not embed the child. `question_set_unresolved`: a configured `decision_judge` tool references a question set that is missing, unpublished, owned by another account, or pinned to a version that is not published; the tool stays in the artifact without `config.questionSet`, so a self-hosted runtime in own-key mode refuses its calls (platform and hybrid modes resolve it through Runtype).
  - Allowed values: `not_found`, `claude_managed_unsupported`, `max_depth_exceeded`, `invalid_flow_config`, `unresolved_tool_ref`, `unsupported_mcp_auth`, `question_set_unresolved`
- `childId` (string, optional)
- `parentId` (string, optional) — The agent whose capability referenced the child, when the child came from one.
- `toolName` (string, optional) — The capability or tool name that referenced the child.

### V1FlowsIdExportRuntimeGetResponsesContentApplicationJsonSchemaDependencyRefs

- `agentIds` (list of string, optional)

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### RuntimeExportErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### RuntimeHostDependency0

- `interface` (string, required)
- `kind` (enum, required)
  - Allowed values: `durable-pause-host`
- `reason` (string, required)
- `steps` (list of RuntimeHostDependencyOneOf0StepsItems, required)

### RuntimeHostDependency1

- `agents` (list of RuntimeHostDependencyOneOf1AgentsItems, required)
- `interface` (string, required)
- `kind` (enum, required)
  - Allowed values: `background-run-coordinator`
- `reason` (string, required)

### RuntimeHostDependency2

Forward-compatibility member: a host dependency whose `kind` this API version does not define. Render `interface` and `reason`; kind-specific evidence arrives as additional properties.

- `interface` (string, required)
- `kind` (string, required)
- `reason` (string, required)

### RuntimeHostDependencyOneOf0StepsItems

- `ownerKind` (enum, required)
  - Allowed values: `flow`, `agent`, `capability`, `inline-tool`
- `stepId` (string, required)
- `stepType` (string, required)
- `ownerId` (string, optional)
- `ownerName` (string, optional)

### RuntimeHostDependencyOneOf1AgentsItems

- `ownerKind` (enum, required)
  - Allowed values: `flow`, `agent`, `capability`, `inline-tool`
- `ownerId` (string, optional)
- `ownerName` (string, optional)
- `stepId` (string, optional)

## Examples

**Response**

```json
{
  "hostDependencies": [
    {
      "interface": "string",
      "kind": "durable-pause-host",
      "reason": "string",
      "steps": [
        {
          "ownerId": "string",
          "ownerKind": "flow",
          "ownerName": "string",
          "stepId": "string",
          "stepType": "string"
        }
      ]
    }
  ],
  "id": "string",
  "name": "string",
  "steps": [
    {}
  ],
  "warnings": [
    {
      "childKind": "agent",
      "code": "child_dropped",
      "message": "string",
      "reason": "not_found",
      "childId": "string",
      "parentId": "string",
      "toolName": "string"
    }
  ],
  "agents": {},
  "dependencyRefs": {
    "agentIds": [
      "string"
    ]
  },
  "description": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.runtype.com/v1/flows/id/export-runtime"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.runtype.com/v1/flows/id/export-runtime';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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.runtype.com/v1/flows/id/export-runtime"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	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.runtype.com/v1/flows/id/export-runtime")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.runtype.com/v1/flows/id/export-runtime")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.runtype.com/v1/flows/id/export-runtime', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/flows/id/export-runtime");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/flows/id/export-runtime")! 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()
```