CreateApiBody

Request body for creating an Api.

Definition

TypeScript
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

FieldTypeNotes
workspaceIdstringrequired — Owning workspace.
handlestringrequired — URL-safe slug — appears in the public API path.
namestringrequired — 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.
descriptionstring | undefinedoptional — Optional longer-form description.
cors{ allowOrigins: Array<string>; allowCredentials?: boolean | undefined; } | undefinedoptional — Default CORS policy for endpoints under this api.
rateLimit{ perMinute: number; } | undefinedoptional — Optional global rate limit applied across the whole api.
enabledboolean | undefinedoptional — Whether the api accepts traffic. Defaults to true.