terminal TypeAPI
v0.1

TypeAPI - An OpenAPI alternative for type-safe code generation.

An OpenAPI alternative to describe REST APIs for type-safe code generation. Clean syntax, human-readable, and developer-first.

How TypeAPI Works

Explore how TypeAPI handles everything from simple endpoints to complex technical scenarios with type-safe code generation.

typeapi.json
SIMPLE API
{
  "operations": {
    "getMessage": {
      "method": "GET",
      "path": "/hello/world",
      "return": {
        "schema": {
          "type": "reference",
          "target": "Hello_World"
        }
      }
    }
  },
  "definitions": {
    "Hello_World": {
      "type": "struct",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Client SDK
TypeScript
const client = new Client()
const response = await client.getMessage()

interface HelloWorld {
    message?: string
}

Simple API

A simple GET endpoint which returns a hello world message.

typeapi.json
ARGUMENT QUERY
{
  "operations": {
    "getAll": {
      "method": "GET",
      "path": "/todo",
      "arguments": {
        "startIndex": {
          "in": "query",
          "schema": {
            "type": "integer"
          }
        },
        "count": {
          "in": "query",
          "schema": {
            "type": "integer"
          }
        }
      },
      "return": {
        "schema": {
          "type": "reference",
          "target": "Todos"
        }
      }
    }
  }
}
Client SDK
TypeScript
const client = new Client()
const response = await client.getAll(0, 10)

interface Todos {
    entries?: Todo[]
}

Argument Query

Map values from the HTTP request to arguments, in this example we map query parameters to startIndex and count.

typeapi.json
ARGUMENT BODY
{
  "operations": {
    "create": {
      "method": "POST",
      "path": "/todo",
      "arguments": {
        "payload": {
          "in": "body",
          "schema": {
            "type": "reference",
            "target": "Todo"
          }
        }
      },
      "return": {
        "schema": {
          "type": "reference",
          "target": "Message"
        }
      }
    }
  }
}
Client SDK
TypeScript
const client = new Client()
const response = await client.create({
    title: "hello world"
})

interface Message {
    success?: boolean
    message?: string
}

Argument Body

In this example we map the HTTP request body to the payload argument.

typeapi.json
THROWS
{
  "operations": {
    "getMessage": {
      "method": "GET",
      "path": "/hello/world",
      "throws": [{
        "code": 500,
        "schema": {
          "type": "reference",
          "target": "Error"
        }
      }]
    }
  }
}
Client SDK
TypeScript
try {
    const response = await client.getMessage()
} catch (e) {
    if (e instanceof ErrorException) {
        const error = e.getPayload()
    }
}

Throws

Define specific error payloads, the generated client will then also throw an exception in case of error codes.

typeapi.json
OPERATION GROUP
{
  "operations": {
    "todo.create": {
      "method": "POST",
      "path": "/todo"
    },
    "product.create": {
      "method": "POST",
      "path": "/product"
    }
  }
}
Client SDK
TypeScript
const client = new Client()

await client.todo().create(payload)
await client.product().create(payload)

Operation Group

Through the dot notation at the operation key you can group your operations into logical units.

Built for Modern Teams

Our code generator uses proven technology to generate fully type-safe client/server pairs across the most popular ecosystems. From C# to TypeScript, we've got you covered.

integration_instructions SDK Generation
hub API Discovery
security Type Safety
speed Performance
Language Client Server
C# HttpClient ASP Web-API
Java Apache Spring
TypeScript Fetch NestJS
PHP Guzzle Symfony
Python Requests FastAPI

Ready to build better APIs?

Join the ecosystem of tools designed for the next generation of type-safe backend development.

part of the Apioo-Project