GET /api/partner/projects/{project_id}/components
Returns the latest stored schematic for a conversation, parsed into a list of components, a pin-to-net netlist and the declared nets, so you don't need your own .trace_sch parser. You need a token with the partner:read scope; see Partner API Overview.
Parameters
project_idstringpathrequiredThe ID of the Trace conversation whose schematic you want. It must belong to the account that owns the token. This is not a Workspaces project, branch or share-link ID.
include_rawbooleanquerydefault: trueInclude the .trace_sch text as raw. Set it to false if you don't need it.
include_datasheetsbooleanquerydefault: falseAdd datasheet data to each component. See Datasheet data.
Response
project_idstringThe conversation ID from the path.
formatstringAlways "trace_sch".
version_numberintegerThe number of the stored schematic version that was parsed.
componentsarrayOne entry per component, sorted by reference, with ref, symbol, value, footprint, mpn, manufacturer, datasheet, uid, unit and pins. pins maps each pin number to its net name. Properties the schematic doesn't set are null. Each unit of a multi-unit part is its own entry, and power symbols such as #PWR1 are listed too.
netlistobjectEach net name mapped to a sorted list of the ref.pin endpoints on it. Pins with no net aren't listed.
declared_netsarrayThe net names the schematic declares explicitly, sorted. Nets that only appear in pin assignments are in netlist but not here.
rawstringThe .trace_sch text. Only present when include_raw is true.
The mpn, manufacturer, footprint and datasheet fields come from the component's properties. Common spellings are recognized, such as MPN, Manufacturer Part Number or LCSC Part # for the part number and Mfr for the manufacturer.
Example
Load the token from your server's secret store rather than writing it in code.
from urllib.parse import quote
import requests
def get_components(conversation_id: str, partner_token: str) -> dict:
identifier = quote(conversation_id, safe="")
response = requests.get(
f"https://api.buildwithtrace.com/api/partner/projects/{identifier}/components",
headers={"Authorization": f"Bearer {partner_token}"},
params={"include_raw": "false", "include_datasheets": "false"},
timeout=(10, 30),
)
response.raise_for_status()
return response.json()
Example response for the one-resistor schematic in Get Schematic:
{
"project_id": "11111111-1111-4111-8111-111111111111",
"format": "trace_sch",
"version_number": 7,
"components": [
{
"ref": "R1",
"symbol": "Device:R",
"value": "10k",
"footprint": null,
"mpn": null,
"manufacturer": null,
"datasheet": null,
"uid": "22222222-2222-4222-8222-222222222222",
"unit": 1,
"pins": {"1": "VCC", "2": "SIG"}
}
],
"netlist": {"SIG": ["R1.2"], "VCC": ["R1.1"]},
"declared_nets": []
}
There is no raw field because the request set include_raw=false.
Datasheet data
With include_datasheets=true, each component also gets datasheet_status and datasheet_ir. datasheet_ir is Trace's structured reading of the part's datasheet, such as its specifications, pinout and electrical characteristics, or null.
datasheet_status | Meaning |
|---|---|
cached | Datasheet data for this part number is ready and included. |
refreshing | Earlier data is included while Trace updates it in the background. |
pending | No data yet. Trace starts reading the datasheet in the background; datasheet_ir is null. |
no_mpn | The component has no manufacturer part number to look up; datasheet_ir is null. |
Datasheet data is looked up by manufacturer part number, so add part numbers to your components for the best results. For pending parts, try again later with backoff; there is no set time for the data to arrive. Check pinouts and ratings against the manufacturer's datasheet before you rely on them.
Errors
See Limits and failures for every status code. This endpoint parses the schematic, so it can also return 422 when a stored schematic can't be parsed and 503 when parsing is unavailable. Neither one means the schematic has no components.
The latest version can change between calls, and the endpoints don't take a version parameter. Compare version_number when you combine results from both endpoints.