> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deeppcb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart: Route a Board with the DeepPCB API

> Upload a board, start a routing job, follow progress over webhooks, and download the result — the DeepPCB REST API in four calls.

The API runs the same engine as the web app, so the workflow is the same: create a board, confirm it to start the job, follow progress, download a revision. Four calls, plus a webhook endpoint if you want live progress.

## Before You Start

You need an **API key** — copy it from **Integration** in the app, or see [Getting Your API Key](https://docs.deeppcb.com/account-setup/getting-your-api-key.md). Every request carries it in the `x-deeppcb-api-key` header:

```bash theme={null}
export DEEPPCB_API_KEY="your_api_key_here"
export DEEPPCB_API="<your base URL>"
```

> [!NOTE]
>
> Your base URL ends in `/api/v1`. Copy the exact host from the **Integration** page in the app — it differs for enterprise and self-hosted deployments. The [API reference](https://docs.deeppcb.com/api/overview.md) lists every endpoint and schema.

> [!WARNING]
>
> Treat the key like a password: anyone holding it can submit jobs and spend the compute time on your account. Keep it in an environment variable or a secrets manager, never in source control.

A request coming back `400` or `401`? See [API Issues](https://docs.deeppcb.com/troubleshooting.md#api-issues) for the cause and the fix of each.

## 1. Create the Board

Post the board file. Which field you use tells DeepPCB the format — the file extension does not, which is how DeepPCB JSON and EasyEDA Standard both live on `.json` without ambiguity.

```bash theme={null}
curl -X POST "$DEEPPCB_API/boards" \
  -H "x-deeppcb-api-key: $DEEPPCB_API_KEY" \
  -F "requestId=my-first-board" \
  -F "boardName=my-board" \
  -F "routingType=EmptyBoard" \
  -F "kicadBoardFile=@/path/to/board.kicad_pcb" \
  -F "kicadProjectFile=@/path/to/board.kicad_pro" \
  -F "webhookUrl=https://your-app.example.com/webhook" \
  -F "webhookToken=a-token-you-choose"
```

The response is the **board ID** — keep it, every later call needs it.

| Field | What it's for |
| - | - |
| `requestId` | Your own identifier for this board. Omit it and one is generated. Look the board up later with `GET /boards/requests/{requestId}`. |
| `routingType` | What happens to wiring already on the board: `EmptyBoard`, `CurrentProtectedWiring`, or `CurrentUnprotectedWiring`. Set it here — `confirm` inherits it. |
| `webhookUrl`, `webhookToken` | Where progress, revisions, and billing events are delivered, and the token that authenticates them. |
| `smartConstraints` | `true` by default: DeepPCB extracts constraints and classifies nets for you. Set `false` only if your board already carries everything. |

### Which File Field for Which Format

| Format | Fields |
| - | - |
| KiCad | `kicadBoardFile` (`.kicad_pcb`) + `kicadProjectFile` (`.kicad_pro`), and `kicadSchematicsFiles` (`.kicad_sch`, one or more) |
| Altium | `altiumFile` (`.pcbdoc`) |
| EasyEDA Standard | `easyEdaFile` (`.json`), and `easyEdaStdSchematicFile` (`.json`) |
| EasyEDA Pro | `easyEdaProFile` (`.epro`) |
| Zuken | `zukenDesignFile` (`.dsgf` or `.pcf`) + `zukenFootprintFile` (`.ftf`) + `zukenRulesFile` (`.rulf`) |
| Specctra DSN | `dsnFile` (`.dsn`) |
| DeepPCB | `jsonFile` (`.json` or `.deeppcb`), or `jsonFileUrl` |

Send files for **one** format only. Companion files — the KiCad project and schematics, the Zuken footprint and rules, the EasyEDA Standard schematic — belong to their parent format and don't count as a second input. Maximum file size is 100 MB.

> [!TIP]
>
> Uploading the same large board repeatedly? Push it once to temporary storage with `POST /files/uploads/board-file`, then pass the returned URL as `jsonFileUrl` instead of the file. The URL is valid for 24 hours. AI agents using the [MCP server](https://docs.deeppcb.com/integrations/mcp.md) upload local files the same way.

The board is now **Pending**. Nothing is running and no compute time has been spent.

## 2. Start the Job

```bash theme={null}
curl -X PATCH "$DEEPPCB_API/boards/$BOARD_ID/confirm" \
  -H "x-deeppcb-api-key: $DEEPPCB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jobType": "Routing",
    "timeout": 60,
    "maxBatchTimeout": 60,
    "timeToLive": 300,
    "responseBoardFormat": 5
  }'
```

| Field | Unit | What it means |
| - | - | - |
| `jobType` | — | `Routing` or `Placement`. Two separate jobs — run placement first if the board needs it, then route. |
| `timeout` | minutes | Your time budget. The engine keeps improving the board until this runs out, or until you stop it. |
| `maxBatchTimeout` | seconds | How often finished solutions are pushed to your webhook. |
| `timeToLive` | seconds | How long this request may wait for capacity before it expires. |
| `responseBoardFormat` | — | The format revisions come back in: `1` JSON full board, `2` JSON wiring only, `3` DSN, `4` Specctra SES, `5` KiCad `.kicad_pcb`, `6` Zuken, `7` Altium `.rte`, `8` Altium `.PcbDoc`. |

The board moves to **Running**. Compute time starts being consumed here, not at upload.

## 3. Follow Progress

Progress arrives at your webhook — there is nothing to poll. Each event and the fields it carries are listed under [Webhook Events](https://docs.deeppcb.com/api/overview.md#webhook-events) in the API reference.

Read `numConnectionsMissing` against `numConnections` in the stats to see how complete each revision is, and watch `numVias` and `wireLength` to judge quality between two equally complete revisions.

## 4. Download a Revision

```bash theme={null}
curl "$DEEPPCB_API/boards/$BOARD_ID/revision-artifact?revision=3&type=KicadFile" \
  -H "x-deeppcb-api-key: $DEEPPCB_API_KEY" \
  -o routed-board.kicad_pcb
```

`revision` is the revision number from the webhook, counting from 1. `type` accepts `JsonFile`, `DsnFile`, `SesFile`, `RteFile`, `ScrFile`, `KicadFile`, `ZukenFile`, and `AltiumFile`. Add `includeRatsNest=false` for a clean file with only completed wiring.

## Stopping Early

Happy with a revision before the budget runs out? Stop the job and keep the unused time:

```bash theme={null}
curl -X PATCH "$DEEPPCB_API/boards/$BOARD_ID/stop" \
  -H "x-deeppcb-api-key: $DEEPPCB_API_KEY"
```

The stop is accepted and completes asynchronously, and the unused time is credited back to your balance. A stopped board can be resumed later with `PATCH /boards/{boardId}/resume` to keep improving the same result.

## Where to Go Next

> [card] [API Reference](https://docs.deeppcb.com/api/overview.md)
>
> Every endpoint, parameter, and schema.

> [card] [MCP Server](https://docs.deeppcb.com/integrations/mcp.md)
>
> Give an AI coding agent direct access to DeepPCB.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.