API Explorer

We document all available Onshape REST API endpoints in our Glassworks API Explorer:

https://cad.onshape.com/glassworks/explorer/


This API Explorer site enables you to run API requests directly within its interface and provides the output from the API call. To try an endpoint in the API Explorer, follow these steps or follow along with the video below:

  1. Open this public Onshape document in your browser: https://cad.onshape.com/documents/e60c4803eaf2ac8be492c18e/w/d2558da712764516cc9fec62/e/6bed6b43463f6a46a37b4a22
  2. Open the API Explorer in a new browser tab: https://cad.onshape.com/glassworks/explorer/
    • Note: For Enterprise accounts, substitue cad in this URL with your company name.
  3. Scroll down to Document.
  4. Click to expand the getDocument endpoint. (Hint: it appears in the API Ref as GET /documents/{did}).
  5. Go back to the public document you opened in Step 2, and copy the document ID from the Onshape URL (e60c4803eaf2ac8be492c18e). image
  6. Paste the document ID into the did field in the API Explorer.
    • Note: If you can’t edit the did field, click the Try it out button. This will toggle to a Cancel button when the fields are editable.
  7. Scroll down and click Execute.
    • Note: If you receive a 403 error, see the Authentication section for help.
  8. Scroll to the bottom of the 200 response body. We have correctly returned Onshape API Guide as the document name.

gif of using glassworks

IMPORTANT NOTE: The documentation in the API Explorer reflects the supported interface. Some API calls may, for historical reasons, return additional undocumented fields. Unless the return fields are documented in the API Explorer, you should NOT use them, as they may be removed without warning. Your application should always ignore unexpected or undocumented return data. Onshape reserves the right to add, remove or change any undocumented fields.

Authentication

You can authenticate in the API Explorer in one of three ways:

  1. Onshape:
    1. Open Onshape in a new tab in your browser.
    2. Sign in with your Onshape credentials. Onshape will pass your credentials to the API Explorer.
  2. API Keys:
    1. Click Authorize in the top-right of the API Explorer page and scroll to the bottom of the dialog.
      Glassworks Authorize button
    2. Provide your API access key in the Username field and your secret key in the Password field. See API Keys for help creating your API Keys. Do NOT enter your Onshape credentials.
      drawing
    3. Click Authorize, and then click Close.
  3. Oauth:
    1. Click Authorize in the top-right of the API Explorer page.
      Glassworks Authorize button
    2. Fill out the OAuth fields. See OAuth for more information on autheneticating with OAuth2.
    3. Click Authorize, and then click Close.

Use the Auto-fill feature

  1. Expand the endpoint you want to use in the API Explorer.
  2. Paste an entire Onshape URL into the top field.
  3. Click Auto-fill. The document ID, workspace/version/microversion ID, and element ID are pushed from the URL into the correct fields.
  4. Confirm all fields are filled out as expected. Not every parameter can be extracted from an Onshape URL, so there may be more fields to fill out.

glassworks api explorer auto fill feature

View response body docs

  1. Expand the endpoint you want to use the in API Explorer.
  2. Scroll down to the Responses section.
  3. Click Schema.
  4. Click the [...] symbols to expand the docs for the response JSON.

glassworks api explorer response json docs

View request body docs

  1. Expand the endpoint you want to use the in API Explorer.
  2. Click the Cancel button to make the schema viewable.
  3. Click Schema.
  4. Click the [...] symbols to expand the docs for the response JSON.

glassworks api explorer response json docs

Copy a cURL

  1. Expand the endpoint you want to use in the API Explorer.
  2. Fill out the parameter fields.
  3. Click Execute in the API Explorer.
  4. Copy the curl from the Curl field.

api explorer curl copy

Troubleshooting

  • If the parameter fields in the API Explorer are grayed out, click the Try it Out! button to toggle it to a Cancel button. The parameter fields should become editable.
  • If you can’t see the request body JSON docs, click the Cancel button to toggle it back to the Try it Out! button.
  • If you see authentication issues, review the Authentication section above.