Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ Please avoid submitting changes that are purely cosmetic (e.g., formatting, whit
---

Thanks for helping make Bitbybit better!
The Bit by bit developers team
- The Bit by bit developers team
22 changes: 11 additions & 11 deletions docs/api/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
sidebar_position: 2
title: Example Projects
sidebar_label: Examples
description: "Run the Bitbybit CAD Cloud API example projects locally React frontend with five interchangeable backend implementations (Node.js, Hono, .NET)."
description: "Run the Bitbybit CAD Cloud API example projects locally - React frontend with five interchangeable backend implementations (Node.js, Hono, .NET)."
tags: [examples, quickstart, api, react, threejs]
---

# Example Projects

The SDK ships with a complete set of working examples: a **shared React frontend** and **five interchangeable backend implementations**. They show how to integrate the Bitbybit CAD Cloud API into a real web application from single CAD operations to multi-step pipelines with file uploads.
The SDK ships with a complete set of working examples: a **shared React frontend** and **five interchangeable backend implementations**. They show how to integrate the Bitbybit CAD Cloud API into a real web application - from single CAD operations to multi-step pipelines with file uploads.

:::tip Source code
All examples live in the [`examples/api/`](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api) folder of the repository.
Expand All @@ -26,17 +26,17 @@ All examples live in the [`examples/api/`](https://github.com/bitbybit-dev/bitby
└─────────────────────────────┘
```

The frontend never talks to the Bitbybit API directly your **API key stays on the server**. Vite's development proxy forwards all `/api/*` requests to `localhost:3000`, so the same frontend works with any of the five backends.
The frontend never talks to the Bitbybit API directly - your **API key stays on the server**. Vite's development proxy forwards all `/api/*` requests to `localhost:3000`, so the same frontend works with any of the five backends.

## Backend Variants

| Folder | Framework | API Style | Key Difference |
|--------|-----------|-----------|----------------|
| **hono-rest** | [Hono](https://hono.dev) (Cloudflare Workers) | Raw REST | Direct `fetch` calls no SDK dependency |
| **hono-rest** | [Hono](https://hono.dev) (Cloudflare Workers) | Raw REST | Direct `fetch` calls - no SDK dependency |
| **hono-sdk** | [Hono](https://hono.dev) (Cloudflare Workers) | TypeScript SDK | Type-safe SDK with client-side validation |
| **nodejs-rest** | [Express 5](https://expressjs.com) (Node.js) | Raw REST | Direct `fetch` calls no SDK dependency |
| **nodejs-rest** | [Express 5](https://expressjs.com) (Node.js) | Raw REST | Direct `fetch` calls - no SDK dependency |
| **nodejs-sdk** | [Express 5](https://expressjs.com) (Node.js) | TypeScript SDK | Type-safe SDK with client-side validation |
| **dotnet-rest** | [ASP.NET Core](https://learn.microsoft.com/aspnet/core) (.NET 10) | Raw REST | Direct `HttpClient` calls no SDK dependency |
| **dotnet-rest** | [ASP.NET Core](https://learn.microsoft.com/aspnet/core) (.NET 10) | Raw REST | Direct `HttpClient` calls - no SDK dependency |

### REST vs SDK

Expand All @@ -51,7 +51,7 @@ The two approaches exist so you can choose the right level of abstraction:

- **Node.js** ≥ 20 (for the frontend and Node.js/Hono backends)
- **.NET** ≥ 10 (only for the `dotnet-rest` backend)
- A **Bitbybit API key** get one from [bitbybit.dev](https://bitbybit.dev)
- A **Bitbybit API key** - get one from [bitbybit.dev](https://bitbybit.dev)

### 1. Configure your API key

Expand Down Expand Up @@ -110,7 +110,7 @@ npm run dev # starts on port 5173
Navigate to **http://localhost:5173**. You should see a UI with buttons for each demo scenario.

:::info Switching backends
Stop the current backend, `cd` into a different one, and run `npm run dev`. The frontend does not need to restart the Vite proxy automatically picks up the new backend.
Stop the current backend, `cd` into a different one, and run `npm run dev`. The frontend does not need to restart - the Vite proxy automatically picks up the new backend.
:::

## What the Examples Cover
Expand Down Expand Up @@ -160,9 +160,9 @@ All five backends expose the same routes so the frontend is fully interchangeabl

The API uses a **3-step presigned URL flow** for file uploads:

1. `POST /api/v1/files/upload` request an upload slot (returns `fileId` + presigned URL).
1. `POST /api/v1/files/upload` - request an upload slot (returns `fileId` + presigned URL).
2. `PUT` the raw bytes to the presigned URL.
3. `POST /api/v1/files/:id/confirm` confirm the upload.
3. `POST /api/v1/files/:id/confirm` - confirm the upload.

The SDK handles this automatically via `client.files.uploadBytes()`. The REST examples implement it manually in `bitbybit-client.ts` (TypeScript) or `BitbybitClient.cs` (C#).

Expand All @@ -187,7 +187,7 @@ Never commit your API key to version control. `.env`, `.dev.vars`, and `appsetti
```
examples/api/
├── frontend/ # React 19 + Vite + Three.js
│ ├── src/App.tsx # Main app orchestrates panels
│ ├── src/App.tsx # Main app - orchestrates panels
│ ├── src/panels/ # UI panels for each demo
│ ├── src/components/ # Three.js viewer, shared UI
│ └── vite.config.ts # Dev proxy: /api → localhost:3000
Expand Down
92 changes: 46 additions & 46 deletions docs/api/intro.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
sidebar_position: 0
title: Bitbybit CAD Cloud API
description: Bitbybit CAD Cloud API generate parametric 3D CAD models, convert STEP files to glTF, run CAD pipelines, and download results via HTTP. TypeScript SDK available. Works with any language.
description: Bitbybit CAD Cloud API - generate parametric 3D CAD models, convert STEP files to glTF, run CAD pipelines, and download results via HTTP. TypeScript SDK available. Works with any language.
slug: /cloud-api
---

# Bitbybit CAD Cloud API

The Bitbybit CAD Cloud API lets you generate parametric 3D CAD models, convert STEP files to glTF, and run CAD kernel operations all via HTTP from any backend, in any programming language.
The Bitbybit CAD Cloud API lets you generate parametric 3D CAD models, convert STEP files to glTF, and run CAD kernel operations - all via HTTP from any backend, in any programming language.

Every request runs asynchronously on managed compute infrastructure. You submit a job, get a task ID, poll for completion, and download the result in the format you need (STEP, glTF/GLB, Decomposed Mesh, and more).

Expand All @@ -21,12 +21,12 @@ Every request runs asynchronously on managed compute infrastructure. You submit

## What you can do

- **Generate parametric models** submit parameters for registered models (e.g. Dragon Cup, Phone Nest) and get downloadable 3D files
- **Convert STEP → glTF** upload a STEP/STP file and convert it with simple or advanced options (mesh precision, face merging, coordinate adjustment, texture embedding, and more)
- **Run CAD pipelines** chain operations (primitives, booleans, transforms, fillets) in a single request where steps can reference each other's outputs
- **Execute single CAD operations** run any supported operation by its fully-qualified identifier (e.g. `occt.shapes.solid.createSphere`)
- **Manage tasks** poll status, cancel, retry, list, and download results in multiple formats
- **Upload files** upload STEP files for conversion via pre-signed URLs
- **Generate parametric models** - submit parameters for registered models (e.g. Dragon Cup, Phone Nest) and get downloadable 3D files
- **Convert STEP → glTF** - upload a STEP/STP file and convert it with simple or advanced options (mesh precision, face merging, coordinate adjustment, texture embedding, and more)
- **Run CAD pipelines** - chain operations (primitives, booleans, transforms, fillets) in a single request where steps can reference each other's outputs
- **Execute single CAD operations** - run any supported operation by its fully-qualified identifier (e.g. `occt.shapes.solid.createSphere`)
- **Manage tasks** - poll status, cancel, retry, list, and download results in multiple formats
- **Upload files** - upload STEP files for conversion via pre-signed URLs

## Authentication

Expand All @@ -37,15 +37,15 @@ curl https://api.bitbybit.dev/api/v1/models \
-H "x-api-key: YOUR_API_KEY"
```

Keys are scoped each key carries permissions for specific endpoint groups (`models`, `cad`, `convert`, `files`, `tasks`).
Keys are scoped - each key carries permissions for specific endpoint groups (`models`, `cad`, `convert`, `files`, `tasks`).

## Async task model

Every operation that creates or transforms geometry is **asynchronous**:

1. **Submit** `POST` your request → receive **202 Accepted** with a `taskId`
2. **Poll** `GET /api/v1/tasks/{taskId}` until `status` is `completed` (or `failed`)
3. **Download** `GET /api/v1/tasks/{taskId}/result/{format}` → pre-signed download URL
1. **Submit** - `POST` your request → receive **202 Accepted** with a `taskId`
2. **Poll** - `GET /api/v1/tasks/{taskId}` until `status` is `completed` (or `failed`)
3. **Download** - `GET /api/v1/tasks/{taskId}/result/{format}` → pre-signed download URL

The SDK handles polling automatically via `models.run()`, `cad.executeAndPoll()`, etc.

Expand All @@ -65,7 +65,7 @@ The SDK handles polling automatically via `models.run()`, `cad.executeAndPoll()`
| `dragon-cup` | Parametric dragon-scale cup with configurable height, radius, thickness, cell pattern |
| `phone-nest` | Parametric phone stand/nest with optional ornamental perforations |

All model parameters are optional default values produce a valid model. See the [interactive API reference](/api/openapi-docs/bitbybit-cad-cloud-api) for full parameter documentation.
All model parameters are optional - default values produce a valid model. See the [interactive API reference](/api/openapi-docs/bitbybit-cad-cloud-api) for full parameter documentation.

## Key components

Expand All @@ -75,7 +75,7 @@ The REST API at `https://api.bitbybit.dev`. All endpoints require an API key pas

### Studio

[Bitbybit Studio](https://studio.bitbybit.dev) is a browser-based dashboard where you can use all of the API's features through a visual interface generate models, convert files, build pipelines, inspect tasks, and preview 3D results. Everything you do in Studio maps directly to an API call, so it's a great way to experiment before writing code. Read more in the [Studio introduction](/api/studio/intro).
[Bitbybit Studio](https://studio.bitbybit.dev) is a browser-based dashboard where you can use all of the API's features through a visual interface - generate models, convert files, build pipelines, inspect tasks, and preview 3D results. Everything you do in Studio maps directly to an API call, so it's a great way to experiment before writing code. Read more in the [Studio introduction](/api/studio/intro).

### TypeScript SDK

Expand All @@ -88,8 +88,8 @@ npm install @bitbybit-dev/cad-cloud-sdk
## Getting an API key

1. **Create an account** at [bitbybit.dev/auth/sign-up](https://bitbybit.dev/auth/sign-up)
2. **Subscribe to an API key plan** in [Studio](https://studio.bitbybit.dev) plans include a compute-minute allowance for running CAD operations
3. **Create a scoped API key** from your Studio dashboard keys are scoped to specific capabilities (models, tasks, cad, convert, files)
2. **Subscribe to an API key plan** in [Studio](https://studio.bitbybit.dev) - plans include a compute-minute allowance for running CAD operations
3. **Create a scoped API key** from your Studio dashboard - keys are scoped to specific capabilities (models, tasks, cad, convert, files)

## Calling the API from any language

Expand Down Expand Up @@ -152,7 +152,7 @@ console.log("Download:", downloadUrl);

### Run a CAD pipeline

Chain multiple CAD operations each step can reference previous steps' outputs using `$ref:N`:
Chain multiple CAD operations - each step can reference previous steps' outputs using `$ref:N`:

```typescript
const created = await client.cad.pipeline({
Expand Down Expand Up @@ -248,46 +248,46 @@ app.listen(3000);
## Endpoints overview

### Models
- `GET /api/v1/models` list available models
- `GET /api/v1/models/{name}/params` get parameter definitions
- `POST /api/v1/models/definitions` batch-fetch model definitions
- `POST /api/v1/models/{name}` generate a model (async)
- `POST /api/v1/models/{name}/batch` generate multiple variations (async)
- `GET /api/v1/models` - list available models
- `GET /api/v1/models/{name}/params` - get parameter definitions
- `POST /api/v1/models/definitions` - batch-fetch model definitions
- `POST /api/v1/models/{name}` - generate a model (async)
- `POST /api/v1/models/{name}/batch` - generate multiple variations (async)

### CAD operations
- `POST /api/v1/cad/execute` run a single CAD operation (async)
- `POST /api/v1/cad/pipeline` run a chained pipeline (async)
- `POST /api/v1/cad/compound` run parallel operations (async)
- `POST /api/v1/cad/execute` - run a single CAD operation (async)
- `POST /api/v1/cad/pipeline` - run a chained pipeline (async)
- `POST /api/v1/cad/compound` - run parallel operations (async)

### Conversion
- `POST /api/v1/convert/step-to-gltf` simple STEP → glTF (async)
- `POST /api/v1/convert/step-to-gltf-advanced` full-control conversion (async)
- `POST /api/v1/convert/step-to-gltf` - simple STEP → glTF (async)
- `POST /api/v1/convert/step-to-gltf-advanced` - full-control conversion (async)

### Files
- `POST /api/v1/files/upload` get a pre-signed upload URL
- `POST /api/v1/files/{id}/confirm` confirm upload
- `GET /api/v1/files` list files
- `GET /api/v1/files/{id}` get file details
- `DELETE /api/v1/files/{id}` delete a file
- `POST /api/v1/files/upload` - get a pre-signed upload URL
- `POST /api/v1/files/{id}/confirm` - confirm upload
- `GET /api/v1/files` - list files
- `GET /api/v1/files/{id}` - get file details
- `DELETE /api/v1/files/{id}` - delete a file

### Tasks
- `GET /api/v1/tasks` list tasks
- `GET /api/v1/tasks/{id}` get task status
- `GET /api/v1/tasks/{id}/result` download default result
- `GET /api/v1/tasks/{id}/result/{format}` download specific format
- `DELETE /api/v1/tasks/{id}` cancel a task
- `POST /api/v1/tasks/{id}/retry` retry a failed task
- `GET /api/v1/tasks` - list tasks
- `GET /api/v1/tasks/{id}` - get task status
- `GET /api/v1/tasks/{id}/result` - download default result
- `GET /api/v1/tasks/{id}/result/{format}` - download specific format
- `DELETE /api/v1/tasks/{id}` - cancel a task
- `POST /api/v1/tasks/{id}/retry` - retry a failed task

For full request/response schemas, see the [interactive API reference](/api/openapi-docs/bitbybit-cad-cloud-api).

## Code examples

Full working examples are available in the open-source GitHub repo:

- [**Node.js + SDK**](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api/nodejs-sdk) Express server using `@bitbybit-dev/cad-cloud-sdk`
- [**Node.js + REST**](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api/nodejs-rest) Express server using raw `fetch` calls
- [**Hono + SDK**](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api/hono-sdk) Cloudflare Workers using the SDK
- [**Hono + REST**](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api/hono-rest) Cloudflare Workers using raw `fetch` calls
- [**Node.js + SDK**](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api/nodejs-sdk) - Express server using `@bitbybit-dev/cad-cloud-sdk`
- [**Node.js + REST**](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api/nodejs-rest) - Express server using raw `fetch` calls
- [**Hono + SDK**](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api/hono-sdk) - Cloudflare Workers using the SDK
- [**Hono + REST**](https://github.com/bitbybit-dev/bitbybit/tree/master/examples/api/hono-rest) - Cloudflare Workers using raw `fetch` calls

Each example includes a complete server with API routes and a browser frontend for testing.

Expand All @@ -297,10 +297,10 @@ You can also scaffold any of these example architectures instantly using our CLI
npx @bitbybit-dev/create-app my-cloud-project
```

Select the **cloud** app type when prompted, then choose your preferred backend template (Hono + SDK, Hono + REST, Node.js + SDK, Node.js + REST, or .NET + REST). The CLI generates a ready-to-run project with a React + Three.js frontend, your chosen backend, and all configuration in place just add your API key and start developing.
Select the **cloud** app type when prompted, then choose your preferred backend template (Hono + SDK, Hono + REST, Node.js + SDK, Node.js + REST, or .NET + REST). The CLI generates a ready-to-run project with a React + Three.js frontend, your chosen backend, and all configuration in place - just add your API key and start developing.

## Next steps

- [**Studio introduction**](/api/studio/intro) explore the visual dashboard
- [**API Reference**](/api/openapi-docs/bitbybit-cad-cloud-api) full endpoint documentation with schemas and examples
- [**TypeScript SDK on npm**](https://www.npmjs.com/package/@bitbybit-dev/cad-cloud-sdk) package details and changelog
- [**Studio introduction**](/api/studio/intro) - explore the visual dashboard
- [**API Reference**](/api/openapi-docs/bitbybit-cad-cloud-api) - full endpoint documentation with schemas and examples
- [**TypeScript SDK on npm**](https://www.npmjs.com/package/@bitbybit-dev/cad-cloud-sdk) - package details and changelog
2 changes: 1 addition & 1 deletion docs/api/sdk/typescript/cad-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags: [sdk, typescript, cad]

# CAD Operations

The `client.cad` endpoint lets you run raw CAD kernel operations anything from creating primitives to boolean operations and transforms. Operations are identified by their fully-qualified name (e.g. `occt.shapes.solid.createSphere`).
The `client.cad` endpoint lets you run raw CAD kernel operations - anything from creating primitives to boolean operations and transforms. Operations are identified by their fully-qualified name (e.g. `occt.shapes.solid.createSphere`).

## Execute a single operation

Expand Down
8 changes: 4 additions & 4 deletions docs/api/sdk/typescript/conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 4
title: Conversion
sidebar_label: Conversion
description: "Convert STEP files to glTF with the Bitbybit SDK simple and advanced modes with full control over tessellation and export options."
description: "Convert STEP files to glTF with the Bitbybit SDK - simple and advanced modes with full control over tessellation and export options."
tags: [sdk, typescript, conversion]
---

Expand All @@ -12,7 +12,7 @@ The `client.convert` endpoint converts STEP/STP files to glTF (.glb). Upload the

## Simple conversion

Default settings just point it at a file:
Default settings - just point it at a file:

```ts
import { readFile } from "node:fs/promises";
Expand All @@ -21,7 +21,7 @@ import { readFile } from "node:fs/promises";
const data = await readFile("model.step");
const confirmed = await client.files.uploadBytes("model.step", data);

// 2. Convert polls automatically, returns all downloads
// 2. Convert - polls automatically, returns all downloads
const { downloads } = await client.convert.stepToGltfAndPoll({
stepFileId: confirmed.fileId,
meshPrecision: 0.1,
Expand Down Expand Up @@ -95,7 +95,7 @@ const { downloads } = await client.convert.stepToGltfAdvancedAndPoll({
| `readMaterials` | `boolean` | Extract material definitions |
| `readLayers` | `boolean` | Extract layer/group structure |
| `readProps` | `boolean` | Extract custom properties (part numbers, metadata) |
| `meshDeflection` | `number` | Linear deflection `[0.005, 10]` lower = finer |
| `meshDeflection` | `number` | Linear deflection `[0.005, 10]` - lower = finer |
| `meshAngle` | `number` | Angular deflection in radians `[0.01, π]` |
| `meshParallel` | `boolean` | Parallel tessellation |
| `faceCountThreshold` | `integer` | Max triangles before LOD reduction (`-1` to disable) |
Expand Down
Loading
Loading