Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
API Bug: 500 Internal Server Error when creating newSketch with a circle

Hello all,
I'm encountering a consistent 500 Internal Server Error
when trying to create a simple sketch containing a single circle via the /api/partstudios/.../features
endpoint.
I have confirmed that my authentication, API key permissions, and environment are all correct. I can successfully create new documents and even create other features, like the built-in cube
feature, using the same API keys. This indicates the issue is specific to the newSketch
feature payload.
Steps to Reproduce
The following minimal Python script reliably reproduces the error. It successfully creates a new document and then fails on the add_part_studio_feature
call.
Python
from onshape_client.client import Client# 1. Provide valid API Keys ACCESS_KEY = "my_KEY = "myt_KEY"# 2. Configure Clientclient = Client(configuration={"base_url": "https://cad.onshape.com", "access_key": ACCESS_KEY, "secret_key": SECRET_KEY})# 3. Create a Document (This step succeeds)doc_params = {"name": "API Bug Report - Sketch Test", "isPublic": True}doc = client.documents_api.create_document(bt_document_params=doc_params)print(f"Document created successfully: {doc.id}")# 4. Define the Sketch Payloadsketch_payload = { "bt_type": "BTFeatureDefinitionCall-1406", "feature": { "bt_type": "BTMFeature-134", "feature_type": "newSketch", "name": "FailingSketch", "parameters": [ { "bt_type": "BTMParameterQueryList-148", "parameter_id": "sketchPlane", "queries": [{"bt_type": "BTMIndividualQuery-138", "query_string": "mateConnector(\"Front\")"}] } ], "entities": [ { "bt_type": "BTMSketchCircle-551", "entity_id": "theCircle", "is_construction": False, "radius": 0.5, "x_center": 0.0, "y_center": 0.0 } ] }}# 5. Attempt to Add the Sketch Feature (This is the call that fails)print("Attempting to add sketch...")try: part_studio_id = client.documents_api.get_elements_in_document(did=doc.id, wvm='w', wvmid=doc.default_workspace.id)[0].id client.part_studios_api.add_part_studio_feature( did=doc.id, wvm='w', wvmid=doc.default_workspace.id, eid=part_studio_id, bt_feature_definition_call_1406=sketch_payload )except Exception as e: print("\\n--- ERROR ---") print("The API call failed as expected.") print(e)
Expected Result
The API call should return a 200 OK
status, and the new Part Studio should contain a sketch with a single circle.
Actual Result
The API call fails with a 500 Internal Server Error
. The response body is:
JSON
{ "supportCode" : "7e906a5ae044c5e75662e359", "moreInfoUrl" : "", "message" : "An internal error has occurred; support code 7e906a5ae044c5e75662e359", "status" : 500, "code" : 0}
I have also confirmed that attempting to use feature_type: 'cylinder'
or feature_type: 'executeScript'
results in a 400 Bad Request
with the message "Feature has invalid type"
, suggesting they are not supported via this endpoint for direct creation.
Thank you for your help.