StateAnchor
Documentation
Back to app →

Getting Started

Quickstart

Generate your first production-ready API wrapper in under two minutes. No installation, no signup required to try — just describe your API.

Before you start: A StateAnchor account (free — sign in with GitHub or Google) and an API you want to wrap — even one endpoint is enough.

1. Sign in

Go to stateanchor.dev/login and sign in with GitHub or Google. New accounts receive 3 free credits immediately. No credit card required. Each generation uses 1 credit (API wrapper) or 2 credits (MCP server).

2. Describe your API

On the Generate page, paste any of the following into the description box:

  • A plain-English description of your endpoints
  • Actual endpoint paths with parameters
  • A snippet of OpenAPI / Swagger YAML or JSON
  • An example curl command

Example description:

OpenWeather API:
GET /weather?q={city}&appid={key} — current conditions
GET /forecast?q={city}&cnt={days}&appid={key} — 5-day forecast
All responses include temperature (Celsius), humidity, wind speed.
Errors return { cod: number, message: string }.

3. Choose a language and style

Select your target language and code style:

StyleDescription
Class / OOPA client class with methods. Best for TypeScript and Python.
Async/awaitAsync functions. Good for Node.js and Python asyncio.
FunctionalPlain exported functions, no class wrapper. Good for Go.
Struct-basedGo struct with receiver methods.

4. Click Generate

Generation typically completes in 20–60 seconds. You'll see the result with three tabs:

  • Code — the wrapper implementation
  • README — usage documentation with examples
  • Endpoints — a structured list of all detected endpoints

5. Use your wrapper

From the output panel you can:

  • Copy the code to clipboard
  • Download as a .ts, .py, or other file
  • Save to a Project to track versions over time
  • Regenerate with different options (costs 1 credit)

The generated code is yours — no attribution required, no runtime dependency on StateAnchor.


Your first wrapper: OpenWeather example

Here's what a TypeScript generation looks like:

import fetch from "node-fetch";

export interface WeatherData {
  city: string;
  temperature: number;
  humidity: number;
  windSpeed: number;
}

export class ApiError extends Error {
  constructor(public readonly status: number, message: string) {
    super(message);
    this.name = "ApiError";
  }
}

export class OpenWeatherClient {
  private base = "https://api.openweathermap.org/data/2.5";

  constructor(private readonly apiKey: string) {}

  async getCurrentWeather(city: string): Promise<WeatherData> {
    const res = await fetch(
      `${this.base}/weather?q=${city}&appid=${this.apiKey}&units=metric`
    );
    if (!res.ok) {
      const err = await res.json().catch(() => ({ message: res.statusText }));
      throw new ApiError(res.status, err.message);
    }
    return this._normalize(await res.json());
  }
}