---
title: "CreateEndpointBody"
description: "Request body for creating an Endpoint."
section: "Reference"
group: "Types"
order: 83
---

## Definition

```ts
interface CreateEndpointBody {
  apiId: string;
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
  path: string;
  handlerType: "function" | "workflow" | "agent" | "swarm";
  handlerId: string;
  auth?:
    | { kind: "public"; rateLimitPerMinute?: number | undefined }
    | { kind: "workspace_api_key" }
    | { kind: "oauth"; scope: string }
    | { kind: "event_signature"; secretSource: "secret_ref"; secretId: string }
    | undefined;
  cors?:
    | { allowOrigins: Array<string>; allowCredentials?: boolean | undefined }
    | undefined;
  timeoutSeconds?: number | undefined;
  enabled?: boolean | undefined;
}
```

## Fields

| Field            | Type                                                                                                                                                                                                                              | Notes                                                                                       |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `apiId`          | `string`                                                                                                                                                                                                                          | `required` — Parent API.                                                                    |
| `method`         | `"GET" \| "POST" \| "PUT" \| "PATCH" \| "DELETE"`                                                                                                                                                                                 | `required` — HTTP method served at this path.                                               |
| `path`           | `string`                                                                                                                                                                                                                          | `required` — Path within the API (e.g. `/orders/{id}`). Path params use `{name}` syntax.    |
| `handlerType`    | `"function" \| "workflow" \| "agent" \| "swarm"`                                                                                                                                                                                  | `required` — What kind of primitive handles this route (`agent` / `function` / `workflow`). |
| `handlerId`      | `string`                                                                                                                                                                                                                          | `required` — ID of the handler (an agent, function, or workflow id).                        |
| `auth`           | `{ kind: "public"; rateLimitPerMinute?: number \| undefined; } \| { kind: "workspace_api_key"; } \| { kind: "oauth"; scope: string; } \| { kind: "event_signature"; secretSource: "secret_ref"; secretId: string; } \| undefined` | `optional` — Per-endpoint auth override. Falls back to the API's default when omitted.      |
| `cors`           | `{ allowOrigins: Array<string>; allowCredentials?: boolean \| undefined; } \| undefined`                                                                                                                                          | `optional` — Per-endpoint CORS override. Falls back to the API's default when omitted.      |
| `timeoutSeconds` | `number \| undefined`                                                                                                                                                                                                             | `optional` — Hard timeout in seconds (max 300). Defaults to 60.                             |
| `enabled`        | `boolean \| undefined`                                                                                                                                                                                                            | `optional` — Whether the route accepts traffic. Defaults to true.                           |
