Docs

TypeScript API SDK

@alienplatform/platform-api is generated from the same OpenAPI document as the REST API reference.

Install

pnpm add @alienplatform/platform-api

The package is ESM-only and supports Node.js 18 or newer.

Create a client

Create an Alien API key with the smallest scope and role required by the backend service. Keep it in a secret manager:

import { Alien } from "@alienplatform/platform-api"

const alien = new Alien({
  apiKey: process.env.ALIEN_API_KEY ?? "",
})

The SDK sends the key as an HTTP Bearer credential. Do not instantiate it in browser code.

Call a resource group

Methods are grouped by the API resource. For example, list projects in a workspace:

const response = await alien.projects.list({
  workspace: "my-workspace",
})

console.log(response)

Create a project:

await alien.projects.create({
  workspace: "my-workspace",
  requestBody: {
    name: "my-app",
    gitRepository: {
      type: "github",
      repo: "my-org/my-app",
    },
  },
})

Check the exact request type in the generated SDK or the Projects API reference; the OpenAPI schema remains the source of truth.

Standalone functions

Use generated standalone functions when bundle size or tree-shaking matters:

import { AlienCore } from "@alienplatform/platform-api/core.js"
import { projectsList } from "@alienplatform/platform-api/funcs/projectsList.js"

const alien = new AlienCore({ apiKey: process.env.ALIEN_API_KEY ?? "" })
const result = await projectsList(alien, { workspace: "my-workspace" })

if (!result.ok) throw result.error
console.log(result.value)

Errors and retries

Typed API errors include the API error code, message, retryability, request ID, and optional remediation hint. Retry only when the error or SDK retry policy marks the failure as retryable; validation, authorization, and conflict errors usually require a code or state change.

The generated SDK source and per-operation examples are available in the public repository.

On this page