Policy Purpose and Details

On February 20th, Onshape will begin enforcing their annual call limit policy. (A per-minute and per-day has already existed.) This policy is designed to further reduce PTC's AWS server costs associated with hosting Onshape.

The limit depends on the subscription, but most notably:

  • 5,000 per user for Professional subscriptions
  • 10,000 per user for Enterprise subscriptions

Beyond this, API calls must be purchased.

Notable exceptions include:

  • Publicly available apps in the Onshape app store
  • FeatureScripts contained in your Onshape models
    • This is because the call comes from Onshape's server and not a separate server
  • Webhook notifications

Lastly, although certain API calls are likely more expensive than others, Onshape is currently treating all API calls as equally expensive for simplicity.

Tips and Tricks for Developers

Savvy Onshape developers will be rewarded. Unsavvy ones will be punished. If you have a private Onshape app, be sure to rewrite portions of your code that make unnecessary API calls. For example:

  • Make a call once and then cache retrieved information for later use rather than repeating calls.
  • Avoid API calls in "simple" loops that run on every assembly part, configuration, custom property, etc.
  • Be careful with event-driven calls or timed calls that will automatically update the data in your app.
    • Instead, give the user the ability to update your app with recent changes to their model.
  • Use client messaging rather than API calls to obtain user selections in the model.
    • This gives developers a way to attach to Onshape selections by subscribing to native message events in the browser. More specifically, these are HTML specifications for events that can be fired with JavaScript (including languages and frameworks that compile to JS, like TypeScript, Razor, and Blazor).
  • Warn users that API usage might be high if they run a function on large or complex models.
  • Look for "efficient" API calls that collect all of the data you need instead of just some of the data you need.
    • See the next section for examples.

Examples of "Efficient" API Calls

The following are examples of API calls that might be inefficient in certain scenarios.

  • Getting BOM data for each sub-assembly versus the entire assembly using Assembly/getBillOfMaterials
    • Inefficient: Setting multiLevel equal to false
    • Efficient: Setting multiLevel equal to true
  • Getting a part's body details by querying individual parts versus an entire part studio
    • Inefficient: GET /parts/d////e//partid//bodydetails
    • Efficient: GET /partstudios/d////e//bodydetails
  • Getting a part's tessellation data by querying individual parts versus an entire part studio
    • Inefficient: GET /parts/d////e//partid//tessellatedfaces
    • Efficient: GET /partstudios/d////e//tessellatedfaces
  • Getting the metadata for a part versus all parts in a document
    • Inefficient: GET /metadata/d////e///
    • Efficient: GET /metadata/d////e//p
  • Getting the data for a specific revision in a document versus all revisions in a document
    • Inefficient: GET /revisions/c//partnumber/
    • Efficient: GET /revisions/d/
  • Getting all sketch information for a sketch, including its bounding box, versus only its bounding box
    • Inefficient: GET /partstudios/d////e//sketches//boundingboxes
    • Efficient: GET /partstudios/d////e//sketches
  • Getting a part's shaded views by querying individual parts versus an entire part studio
    • Inefficient: GET /parts/d////e//partid//shadedviews
    • Efficient: GET /partstudios/d////e//shadedviews

Don't Guess – Hire the Best

Imagine writing an app yourself or hiring someone to write you app, making that app a key part of your team's workflow, and then it stops working halfway through the year in because your company's API call limit has been reached. That's what you can expect from unseasoned developers.

On the other hand, if you want expert Onshape developers who can navigate around such pitfalls, contact us to discuss your project. Alternatively, if you're interested in developing FeatureScripts yourself, check out the world's only zero-to-hero FeatureScript training course.