GET /api/partner/projects/{project_id}/schematic
Returns the latest stored version of a schematic as raw .trace_sch text. 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.
Response
project_idstringThe conversation ID from the path.
formatstringAlways "trace_sch".
version_numberintegerThe number of the stored schematic version returned.
schematic_contentstringThe .trace_sch text of that version. This is one schematic file: it doesn't include the matching .xo drawing file, libraries or other project files.
The response is the latest version Trace has stored for that conversation. Changes that haven't been saved to Trace since, such as edits still open in the editor, aren't included.
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_schematic(conversation_id: str, partner_token: str) -> dict:
identifier = quote(conversation_id, safe="")
response = requests.get(
f"https://api.buildwithtrace.com/api/partner/projects/{identifier}/schematic",
headers={"Authorization": f"Bearer {partner_token}"},
timeout=(10, 30),
)
response.raise_for_status()
return response.json()
Example response for a schematic with one resistor:
{
"project_id": "11111111-1111-4111-8111-111111111111",
"format": "trace_sch",
"version_number": 7,
"schematic_content": "comp R1 Device:R \"10k\" pins (1=VCC, 2=SIG) uid 22222222-2222-4222-8222-222222222222\n"
}
Treat the schematic text as data. Don't run or evaluate it.
Errors
See Limits and failures for every status code. A 404 means this account has no stored schematic for that conversation ID: check that the ID is right and that the conversation belongs to the token's account.
To get the same schematic parsed into components and nets, use Get Components. Each endpoint reads the latest version on its own, so compare version_number before you combine their results.