Skip to content

AimRack API

Client SDKs

AimRack publishes an OpenAPI spec for all 1,308 operations, so a typed client in your language is one generator command away — nothing hand-maintained to fall behind.

The spec

The spec is public — no key needed to fetch it, so it works in CI and codegen pipelines:

Terminal
curl <your-host>/api/v1/openapi.json -o openapi.json

Inside are all 1,308 operations, each a POST tagged by its module, with input schemas taken from the same validators the server runs and response shapes on ~95% of operations — so a generated client is typed in both directions.

TypeScript

@hey-api/openapi-ts generates a typed fetch client plus request/response types, grouped one class per AimRack module:

openapi-ts.config.ts
// openapi-ts.config.ts
import { defineConfig } from "@hey-api/openapi-ts";

export default defineConfig({
  input: "<your-host>/api/v1/openapi.json",
  output: "src/client",
  plugins: [
    "@hey-api/client-fetch",
    {
      name: "@hey-api/sdk",
      operations: {
        // One class per AimRack module: Sales.getQuotes, Production.insertJob, …
        strategy: "byTags",
        container: "class",
        nestingDelimiters: /(?!)/,
        methodName: (name) => name.split(".").pop() ?? name
      }
    }
  ]
});
Terminal
npm install -D @hey-api/openapi-ts typescript
npx openapi-ts

Python

openapi-python-client generates a modern client with typed models:

Terminal
pipx install openapi-python-client --include-deps
openapi-python-client generate --url <your-host>/api/v1/openapi.json

Go

oapi-codegen generates a typed client and request/response structs — pure Go, no Java runtime. Fetch the spec first (the command above), then:

Terminal
go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest \
  -generate types,client -package carbon \
  -o carbon.gen.go openapi.json

Ruby, C#, PHP — any language

openapi-generator covers 50+ languages. Its official Docker image needs no Java install — swap -g ruby for csharp, php, or any other generator (with Java 11+ installed, npx openapi-generator-cli takes the same flags):

Terminal
docker run --rm -v $PWD:/local openapitools/openapi-generator-cli generate \
  -i <your-host>/api/v1/openapi.json \
  -g ruby \
  -o /local/carbon-client

Authenticate the client

One way in: the spec declares a single Bearer scheme, so every generated client sends a scoped API key from as Authorization: Bearer crbn_…. For the TypeScript client that is one config line:

src/api.ts
import { client } from "./src/client/client.gen";

client.setConfig({
  auth: "<api-key>"
});

What comes back

Single results are the response body itself — no envelope to unwrap. List results come as { results, count }, since a total only means something on a paginated read. Both shapes are in the spec, so generated return types already carry them. Failures return an error body with an HTTP status:

Status
Meaning
400
The write failed — the message carries the database error
403
The key lacks the operation's required scope
404
No such operation
429
Rate limited — respect Retry-After

Key-level failures (an expired or missing key) return 401 before the operation runs — see Authentication.