---
title: "CreateApiBody"
description: "Request body for creating an Api."
section: "Reference"
group: "Types"
order: 12
---

## Definition

```ts
interface CreateApiBody {
  workspaceId: string;
  handle: string;
  name: string;
  auth:
    | { kind: "public"; rateLimitPerMinute?: number | undefined }
    | { kind: "workspace_api_key" }
    | { kind: "oauth"; scope: string }
    | { kind: "event_signature"; secretSource: "secret_ref"; secretId: string };
  description?: string | undefined;
  cors?:
    | { allowOrigins: Array<string>; allowCredentials?: boolean | undefined }
    | undefined;
  rateLimit?: { perMinute: number } | undefined;
  enabled?: boolean | undefined;
}
```

## Fields

| Field         | Type                                                                                                                                                                                                                 | Notes                                                                 |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `workspaceId` | `string`                                                                                                                                                                                                             | `required` — Owning workspace.                                        |
| `handle`      | `string`                                                                                                                                                                                                             | `required` — URL-safe slug — appears in the public API path.          |
| `name`        | `string`                                                                                                                                                                                                             | `required` — Human-readable name.                                     |
| `auth`        | `{ kind: "public"; rateLimitPerMinute?: number \| undefined; } \| { kind: "workspace_api_key"; } \| { kind: "oauth"; scope: string; } \| { kind: "event_signature"; secretSource: "secret_ref"; secretId: string; }` | `required` — Default auth policy for endpoints under this api.        |
| `description` | `string \| undefined`                                                                                                                                                                                                | `optional` — Optional longer-form description.                        |
| `cors`        | `{ allowOrigins: Array<string>; allowCredentials?: boolean \| undefined; } \| undefined`                                                                                                                             | `optional` — Default CORS policy for endpoints under this api.        |
| `rateLimit`   | `{ perMinute: number; } \| undefined`                                                                                                                                                                                | `optional` — Optional global rate limit applied across the whole api. |
| `enabled`     | `boolean \| undefined`                                                                                                                                                                                               | `optional` — Whether the api accepts traffic. Defaults to true.       |
