Setting up an API Surface
An API Surface turns your Flows and Agents into ready-to-use REST API endpoints. Once set up, any application can call your AI Capabilities using standard HTTP requests.
You can create an API Surface when setting up a new Product with the REST API template, or add one to an existing Product at any time. If you need more context first, see What are Surfaces?.
Before you begin: You need a Product with at least one Capability attached. If you have not created the Product yet, see Creating a Product.
Creating an API Surface
Add to an existing Product
Go to Products in the sidebar.
Open the Product you want to update.
Scroll to the Surfaces section.
Click Add Surface or Add Another Surface.
Select REST API.
Click Save.
Runtype creates the API Surface and generates a REST endpoint for each Capability attached to the Product.
First-time setup may show a Launch Your API guide with steps for getting your API key and trying an example request.
Create with the REST API template
Go to Products in the sidebar.
Click + New Product.
Select the REST API template.
Name your Product.
Click Use Existing to attach a Flow or Agent.
Select the Capability you want to expose.
Click Create REST API.
Runtype creates the Product and API Surface together, then generates endpoints and a test API key so you can start right away.
Navigating your API Surface
Use the tabs in the Surface panel to configure and manage your API Surface.
Tab | What it's for |
|---|---|
Overview | Surface name, status, and response settings |
Endpoints | Your Capabilities, request URLs, and OpenAPI spec |
Keys | Create and manage API keys |
Ship | Integration code snippets and SDK examples |
Setting up authentication
API Surfaces use API keys for authentication. Every request must include a valid key.
Creating an API key
Open your Product and select the API Surface.
Go to the Keys tab.
Click Create API Key.
Enter a name for the key.
Choose the key environment: Test or Production.
Click Create.
Copy the generated key right away. It will not be shown again.
All API keys use the papi_ prefix. You can send them with the Authorization header as a Bearer token or with the X-API-Key header.
Store API keys securely. Test keys are rate-limited for development. Use a Production key when you are ready to go live.
Setting Surface status
Use the Overview tab to control whether the API Surface is available.
Status | Behavior |
|---|---|
Draft | Endpoints are not accessible |
Active | Endpoints are live and accepting requests |
Paused | Endpoints are temporarily disabled without removing the Surface |
Use Paused when you need to take the API offline for maintenance without changing the rest of the configuration.
Configuring response shape
In the Overview tab, response settings control how your API returns results.
Raw returns only the Capability output.
Wrapped includes metadata such as execution time and token usage.
For multi-step Flows, you can also choose which step output to return as the final response.
Accessing your OpenAPI spec
Runtype automatically generates an OpenAPI 3.0 specification for every API Surface. You can use it with tools like Postman, Swagger UI, or code generators.
Find the spec in the Endpoints tab in JSON or YAML format, or access it directly at:
https://api.runtype.com/v1/products/{productId}/surfaces/{surfaceId}/api/openapi.jsonThe spec updates automatically when you add or change Capabilities.
Use the Ship tab for ready-to-use TypeScript and cURL examples.
Making your first API call
Once the API Surface is active, each Capability gets its own endpoint. Find the exact URLs in the Endpoints or Ship tab.
curl -X POST https://api.runtype.com/v1/products/{productId}/surfaces/{surfaceId}/api/{capabilitySlug} \
-H "Authorization: Bearer papi_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"input": "Your input text here"
}'The {capabilitySlug} value is generated from the Capability name. For example, Summarize Article becomes summarize-article.
Next steps
Creating a Product — Create a Product before adding more Surfaces or Capabilities
What are Surfaces? — Understand when to use API, Chat, MCP, and other Surface types