Quickstart
This guide will help you make your first Runtype API call and execute an AI flow.
Prerequisites
- A Runtype account (sign up free)
- An API key (get one here)
Step 1: Test Your API Key
Let’s verify your API key works by checking your profile:
Step 2: Create and Execute a Flow
The /dispatch endpoint is the main way to execute AI flows. Here’s a minimal example:
The inputs field lets you pass variables directly accessible as {{varName}} in templates.
For transient data, inputs provides cleaner syntax than record.metadata. Use record.metadata when you need data to persist with the record in the database.
Step 3: Understanding the Response
The dispatch endpoint returns a Server-Sent Events (SSE) stream:
The stream events
Every streaming endpoint (/v1/dispatch, /v1/agents/{id}/execute, and the
client chat routes) emits one shared set of event names across flows and agents,
such as execution_start, step_start, text_delta, tool_start,
tool_input_complete, and execution_complete. These are the events documented
in the API reference and the generated SDK types.
Step 4: Using the SDK (Recommended)
Install our TypeScript SDK for a better developer experience:
The withInputs() method passes data that’s accessible as {{varName}} in your prompts.
This is the recommended approach for passing dynamic data to flows.
Validate before running
Call validate() to check a flow before you run it. It surfaces structural issues, undeclared-variable warnings, and sub-optimal model selections at author time, without creating or executing the flow:
validate() runs against the public validation endpoint and does not consume execution quota. Pass an authenticated client to additionally check that referenced tools, flows, and agents exist in your account — validation.context.accountChecksPerformed reports whether those checks ran.
Import an Existing Product Spec
If you already have a product described as JSON, you can preview and create it through Runtype’s import flow instead of building it step by step.
- Use Importing Products for A2A agent cards, raw Full Product Objects, and hosted JSON imports
- Use FPO Templates when you want creators to publish reusable product templates with user-fillable variables
These flows power /now, “Deploy to Runtype” buttons, and other integrations that hand Runtype a complete product definition.