---
title: build (latest version)
description: API reference for samplomatic.build in the latest version of samplomatic
source: https://quantum.cloud.ibm.com/docs/en/api/samplomatic/auto/build
---

# samplomatic.build

`samplomatic.build(circuit: QuantumCircuit, debug: bool = False) → tuple[QuantumCircuit, Samplex]`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/builders/build.py#L97-L115)

Build a circuit template and samplex for the given boxed-up circuit.

> **Note**
>
> The template circuit does not preserve the `global_phase` of the input circuit, it is always set to zero.

**Parameters**

- **circuit** – The circuit to build.
- **debug** – Whether to populate samplex nodes with information that traces them back to the boxes that generated them. Tracing information is based on `ref` attributes of box annotations.

**Returns**

The built template circuit and the corresponding samplex.
