> 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.

# Create surface

POST https://api.runtype.com/v1/products/{id}/surfaces
Content-Type: application/json

Create a new surface for a product.

Reference: https://docs.runtype.com/api-reference/runtype-api/products/create-surface

## 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)

### Body (application/json)

This endpoint expects an object.

- `name` (string, required)
- `type` (enum, required)
  - Allowed values: `chat`, `mcp`, `mcp_code`, `api`, `webhook`, `schedule`, `a2a`, `email`, `slack`, `sms`, `imessage`, `discord`, `whatsapp`, `telegram`, `hosted-page`, `chrome_extension`
- `behavior` (any, optional)
- `config` (any, optional)
- `inbound` (map from string to any, optional) — Inbound config. Slack, Telegram and iMessage accept channelResponseMode (mention, the default; always; or judge, which asks the platform response-gate judgment whether to reply and waits for a mention when the judgment fails), responseRules (free text up to 2000 characters the judgment reads), eagerness (conservative, balanced or eager), onUncertain (silent or reply), responseGateShadow (opt-in: judge and record without changing behavior in mention or always mode), keywords, channelOverrides (per-channel channelResponseMode and eagerness) and contextBackfill (\{ mode: window (default), judged (only the messages the judgment finds relevant, falling back to window on failure) or none, maxMessages up to 20, maxAgeMinutes up to 1440 }).
- `outbound` (map from string to any, optional)
- `status` (enum, optional)
  - Allowed values: `draft`, `active`, `paused`

## Response

### 201

Surface created

- `createdAt` (string, required)
- `endpoint` (string, required, nullable) — Canonical public URL of this surface (MCP, API, A2A, AG-UI, webhook, chat). Null for surface types reached through their own channels (Slack, email, schedule, ...). Clients should use this instead of constructing the URL themselves.
- `id` (string, required)
- `items` (list of any, required)
- `keys` (list of any, required)
- `name` (string, required)
- `productId` (string, required)
- `status` (string, required)
- `type` (string, required)
- `updatedAt` (string, required)
- `webhookHealth` (WebhookHealth, required)
- `behavior` (any, optional)
- `inbound` (any, optional)
- `outbound` (any, optional)
- `warnings` (list of V1ProductsIdSurfacesPostResponsesContentApplicationJsonSchemaWarningsItems, optional) — Advisory findings about this surface configuration. Present only when non-empty; never blocks the mutation.

## Errors

### 400 Bad Request Error

Validation 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.

### 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

- `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

Product 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.

### 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

### WebhookHealth

- `lastDeliveryAt` (string, required, nullable) — ISO timestamp of the most recent accepted inbound delivery.
- `recentFailures` (list of WebhookHealthRecentFailuresItems, required) — Most recent inbound rejections, newest first, capped at a small fixed number. A failure newer than lastDeliveryAt means the webhook is currently rejecting events (commonly a credential mismatch such as a wrong Slack signing secret).

### V1ProductsIdSurfacesPostResponsesContentApplicationJsonSchemaWarningsItems

- `code` (string, required) — Stable advisory code, e.g. `MODEL_NOT_ENABLED` when `behavior.conversationTitles.model` names a model this account cannot run.
- `message` (string, required)
- `path` (string, required)
- `severity` (enum, required)
  - Allowed values: `warning`, `recommendation`
- `suggestedFix` (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, …).

### WebhookHealthRecentFailuresItems

- `at` (string, required)
- `reason` (string, required)
- `statusCode` (double, optional)

## Examples

**Request**

```json
{
  "name": "Public API",
  "type": "api",
  "config": {
    "rateLimit": {
      "perDay": 5000,
      "perMinute": 60
    },
    "type": "api"
  },
  "status": "active"
}
```

**Response**

```json
{
  "createdAt": "string",
  "endpoint": "string",
  "id": "string",
  "items": [
    null
  ],
  "keys": [
    null
  ],
  "name": "string",
  "productId": "string",
  "status": "string",
  "type": "string",
  "updatedAt": "string",
  "webhookHealth": {
    "lastDeliveryAt": "string",
    "recentFailures": [
      {
        "at": "string",
        "reason": "string",
        "statusCode": 1.1
      }
    ]
  },
  "warnings": [
    {
      "code": "string",
      "message": "string",
      "path": "string",
      "severity": "warning",
      "suggestedFix": "string"
    }
  ]
}
```

**SDK Code**

```python Create Surface
import requests

url = "https://api.runtype.com/v1/products/id/surfaces"

payload = {
    "name": "Public API",
    "type": "api",
    "config": {
        "rateLimit": {
            "perDay": 5000,
            "perMinute": 60
        },
        "type": "api"
    },
    "status": "active"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Create Surface
const url = 'https://api.runtype.com/v1/products/id/surfaces';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"Public API","type":"api","config":{"rateLimit":{"perDay":5000,"perMinute":60},"type":"api"},"status":"active"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Create Surface
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.runtype.com/v1/products/id/surfaces"

	payload := strings.NewReader("{\n  \"name\": \"Public API\",\n  \"type\": \"api\",\n  \"config\": {\n    \"rateLimit\": {\n      \"perDay\": 5000,\n      \"perMinute\": 60\n    },\n    \"type\": \"api\"\n  },\n  \"status\": \"active\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Create Surface
require 'uri'
require 'net/http'

url = URI("https://api.runtype.com/v1/products/id/surfaces")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Public API\",\n  \"type\": \"api\",\n  \"config\": {\n    \"rateLimit\": {\n      \"perDay\": 5000,\n      \"perMinute\": 60\n    },\n    \"type\": \"api\"\n  },\n  \"status\": \"active\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.runtype.com/v1/products/id/surfaces")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Public API\",\n  \"type\": \"api\",\n  \"config\": {\n    \"rateLimit\": {\n      \"perDay\": 5000,\n      \"perMinute\": 60\n    },\n    \"type\": \"api\"\n  },\n  \"status\": \"active\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.runtype.com/v1/products/id/surfaces', [
  'body' => '{
  "name": "Public API",
  "type": "api",
  "config": {
    "rateLimit": {
      "perDay": 5000,
      "perMinute": 60
    },
    "type": "api"
  },
  "status": "active"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create Surface
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/products/id/surfaces");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Public API\",\n  \"type\": \"api\",\n  \"config\": {\n    \"rateLimit\": {\n      \"perDay\": 5000,\n      \"perMinute\": 60\n    },\n    \"type\": \"api\"\n  },\n  \"status\": \"active\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Surface
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Public API",
  "type": "api",
  "config": [
    "rateLimit": [
      "perDay": 5000,
      "perMinute": 60
    ],
    "type": "api"
  ],
  "status": "active"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.runtype.com/v1/products/id/surfaces")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```