OpenAPI Specification
openapi: 3.0.1
info:
title: Onshape REST Account Drawing API
description: '## Welcome to the Onshape REST API Explorer
**See the [API Explorer Guide](https://onshape-public.github.io/docs/api-intro/explorer/) for help navigating this page.**
### Using this page
1. Sign in to your [Onshape](https://cad.onshape.com) account in another tab.
2. Click the `Try it out` button below. It toggles to a `Cancel` button when selected.
### Authenticating
To authenticate your calls, click the `Authorize` button. See [API Explorer Guide: Authentication](https://onshape-public.github.io/docs/api-intro/explorer/#authentication) for details. Calls made when authenticated via API Keys or OAuth count against your annual [API limits](https://onshape-public.github.io/docs/auth/limits/#annual-api-call-limits).
* **Tip:** To ensure the current session isn''t used when trying other authentication techniques, make sure to [remove the Onshape cookie](https://support.google.com/chrome/answer/95647#zippy=%2Cdelete-cookies-from-a-site) as per the instructions for your browser, or use a private or incognito window.
### Additional resources
* [Onshape API Guide](https://onshape-public.github.io/docs/): Our full suite of developer guides, to be used as an accompaniment to this API Explorer.
* [Onshape Developer Portal](https://cad.onshape.com/appstore/dev-portal): The Onshape portal for managing your API keys, OAuth2 credentials, your Onshape applications, and your Onshape App Store entries.
* [Authentication Guide](https://onshape-public.github.io/docs/auth/): Our guide to using API keys, request signatures, and OAuth2 in your Onshape applications.'
termsOfService: https://www.onshape.com/legal/terms-of-use
contact:
email: api-support@onshape.zendesk.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.218.84032-34acba44be17
x-logo:
url: images/logo-onshape-gray-green-nav-bar.svg
backgroundColor: '#ffffff'
altText: Onshape
href: images/logo-onshape-gray-green-nav-bar.svg
x-indeterministic-schemas:
- BTDiffInfo
- BTParameterSpecArray-2600
- BTSplineDescription-2118
- NodeModel
- BTPFunctionDeclaration-246
- BTPFunctionOrPredicateDeclaration-247
- BTPExpression-9
- SkinModel
- BTMAnnotation-4664
x-filter-info: ?restUserRole=PUBLIC
servers:
- url: https://cad.onshape.com/api/v16
description: Current
security:
- BasicAuth: []
tags:
- name: Drawing
description: Access, create, and translate drawings.
paths:
/drawings/d/{did}/w/{wid}/create:
post:
tags:
- Drawing
summary: Create a new drawing in a document.
description: 'This endpoint takes a JSON Schema as input. See the schema docs below for details, and see [API Guide: Drawings](https://onshape-public.github.io/docs/api-adv/drawings/) for more information.'
operationId: createDrawingAppElement
parameters:
- name: did
in: path
description: ID of the document in which to create the drawing.
required: true
schema:
type: string
- name: wid
in: path
description: ID of the workspace in which to create the drawing.
required: true
schema:
type: string
requestBody:
content:
application/json;charset=UTF-8; qs=0.09:
schema:
$ref: '#/components/schemas/BTDrawingParams'
required: true
responses:
default:
description: default response
content:
application/json;charset=UTF-8; qs=0.09:
schema:
$ref: '#/components/schemas/BTDocumentElementInfo'
deprecated: false
security:
- OAuth2:
- OAuth2Write
BasicAuth:
- OAuth2Write
x-BTVisibility: PRODUCTION
/drawings/d/{did}/w/{wid}/e/{eid}/modify:
post:
tags:
- Drawing
summary: Modify a drawing via JSON payload.
description: 'See [API Guide: Drawings](https://onshape-public.github.io/docs/api-adv/drawings/) for more information.When polling for drawing modifications to complete, use a reasonable interval (e.g., avoid polling multiple times a second, use an exponential backoff strategy, etc.). See [Rate Limiting](/docs/api-adv/errors/#429) and [API Limits](/docs/auth/limits) for more information.'
operationId: modifyDrawing
parameters:
- name: did
in: path
description: The id of the document in which to perform the operation.
required: true
schema:
type: string
- name: linkDocumentId
in: query
description: The id of the document through which the above document should be accessed; only applicable when accessing a version of the document. This allows a user who has access to document a to see data from document b, as long as document b has been linked to document a by a user who has permission to both.
schema:
type: string
default: ''
- name: wid
in: path
description: The id of the workspace in which to perform the operation.
required: true
schema:
type: string
- name: eid
in: path
description: The id of the element in which to perform the operation.
required: true
schema:
type: string
requestBody:
content:
application/json;charset=UTF-8; qs=0.09:
schema:
$ref: '#/components/schemas/BTDrawingModificationParams'
required: true
responses:
default:
description: default response
content:
application/json;charset=UTF-8; qs=0.09:
schema:
$ref: '#/components/schemas/BTAppModificationRequestInfo'
deprecated: false
security:
- OAuth2:
- OAuth2Write
BasicAuth:
- OAuth2Write
x-BTVisibility: PRODUCTION
/drawings/d/{did}/w/{wid}/e/{eid}/translationformats:
get:
tags:
- Drawing
summary: Get a list of all valid formats the drawing can be translated (exported) to.
description: 'See [API Guide: Translations](https://onshape-public.github.io/docs/api-adv/translation/#export-a-drawing-as-a-json) for more information.'
operationId: getDrawingTranslatorFormats
parameters:
- name: did
in: path
required: true
schema:
type: string
- name: wid
in: path
required: true
schema:
type: string
- name: eid
in: path
required: true
schema:
type: string
responses:
default:
description: default response
content:
application/json;charset=UTF-8; qs=0.09:
schema:
type: array
items:
$ref: '#/components/schemas/BTModelFormatInfo'
deprecated: false
x-BTVisibility: PRODUCTION
/drawings/d/{did}/{wvm}/{wvmid}/e/{eid}/views:
get:
tags:
- Drawing
summary: Get details of all drawing views.
operationId: getDrawingViews_1
parameters:
- name: did
in: path
description: The id of the document in which to perform the operation.
required: true
schema:
type: string
- name: linkDocumentId
in: query
description: The id of the document through which the above document should be accessed; only applicable when accessing a version of the document. This allows a user who has access to document a to see data from document b, as long as document b has been linked to document a by a user who has permission to both.
schema:
type: string
default: ''
- name: wvm
in: path
description: Indicates which of workspace (w), version (v), or document microversion (m) id is specified below.
required: true
schema:
type: string
enum:
- w
- v
- m
- name: wvmid
in: path
description: The id of the workspace, version or document microversion in which the operation should be performed.
required: true
schema:
type: string
- name: eid
in: path
description: The id of the element in which to perform the operation.
required: true
schema:
type: string
- name: transactionId
in: query
description: The id of the transaction in which this operation should take place. Transaction ids can be generated through the AppElement startTransaction API.
schema:
type: string
default: ''
- name: changeId
in: query
description: The id of the last change made to this application element. This can be retrieved from the response for any app element modification endpoint.
schema:
type: string
default: ''
responses:
default:
description: default response
content:
application/json;charset=UTF-8; qs=0.09:
schema:
$ref: '#/components/schemas/BTAppArrayInfoBTAppDrawingViewInfo'
deprecated: false
security:
- OAuth2:
- OAuth2Read
BasicAuth:
- OAuth2Read
x-BTVisibility: PRODUCTION
/drawings/d/{did}/{wvm}/{wvmid}/e/{eid}/views/{viewid}/jsongeometry:
get:
tags:
- Drawing
summary: Get view geometry of a drawing view in JSON format.
operationId: getDrawingViewJsonGeometry_1
parameters:
- name: did
in: path
description: The id of the document in which to perform the operation.
required: true
schema:
type: string
- name: linkDocumentId
in: query
description: The id of the document through which the above document should be accessed; only applicable when accessing a version of the document. This allows a user who has access to document a to see data from document b, as long as document b has been linked to document a by a user who has permission to both.
schema:
type: string
default: ''
- name: wvm
in: path
description: Indicates which of workspace (w), version (v), or document microversion (m) id is specified below.
required: true
schema:
type: string
enum:
- w
- v
- m
- name: wvmid
in: path
description: The id of the workspace, version or document microversion in which the operation should be performed.
required: true
schema:
type: string
- name: eid
in: path
description: The id of the element in which to perform the operation.
required: true
schema:
type: string
- name: viewid
in: path
description: The id of the view in which to perform the operation.
required: true
schema:
type: string
- name: transactionId
in: query
description: The id of the transaction in which this operation should take place. Transaction ids can be generated through the AppElement startTransaction API.
schema:
type: string
default: ''
- name: changeId
in: query
description: The id of the last change made to this application element. This can be retrieved from the response for any app element modification endpoint.
schema:
type: string
default: ''
- name: scale
in: query
description: Scale for measurements.
schema:
type: number
format: double
responses:
default:
description: default response
content:
application/json;charset=UTF-8; qs=0.09:
schema:
type: object
deprecated: false
security:
- OAuth2:
- OAuth2Read
BasicAuth:
- OAuth2Read
x-BTVisibility: PRODUCTION
/drawings/d/{did}/{wv}/{wvid}/e/{eid}/translations:
post:
tags:
- Drawing
summary: Translate (export) a drawing to a different format.
description: 'Export a drawing to a different format within a document. Use `getDrawingTranslatorFormats` for a list of supported translation (i.e., import/export) formats. See [API Guide: Translations](https://onshape-public.github.io/docs/api-adv/translation/#export-a-drawing-as-a-json) for more information.'
operationId: createDrawingTranslation
parameters:
- name: did
in: path
required: true
schema:
type: string
- name: wv
in: path
required: true
schema:
type: string
- name: wvid
in: path
required: true
schema:
type: string
- name: eid
in: path
required: true
schema:
type: string
requestBody:
content:
application/json;charset=UTF-8; qs=0.09:
schema:
$ref: '#/components/schemas/BTTranslateFormatParams'
required: true
responses:
default:
description: default response
content:
application/json;charset=UTF-8; qs=0.09:
schema:
$ref: '#/components/schemas/BTTranslationRequestInfo'
deprecated: false
security:
- OAuth2:
- OAuth2Read
BasicAuth:
- OAuth2Read
x-BTVisibility: PRODUCTION
/drawings/modify/status/{mrid}:
get:
tags:
- Drawing
summary: Get the status of a drawing modification operation.
operationId: getModificationStatus
parameters:
- name: mrid
in: path
required: true
schema:
type: string
responses:
default:
description: default response
content:
application/json;charset=UTF-8; qs=0.09:
schema:
$ref: '#/components/schemas/BTAppModificationRequestInfo'
deprecated: false
security:
- OAuth2:
- OAuth2Read
BasicAuth:
- OAuth2Read
x-BTVisibility: PRODUCTION
components:
schemas:
BTThumbnailSizeInfo:
type: object
properties:
href:
type: string
format: uri
mediaType:
type: string
renderMode:
type: string
sheetName:
type: string
size:
type: string
uniqueId:
type: string
viewOrientation:
type: string
BTAppArrayInfoBTAppDrawingViewInfo:
type: object
properties:
changeId:
type: string
errorCode:
type: integer
description: '`0: OK (healthy) | 1: INFO | 2: WARNING | 3: ERROR (dangling or view generation call failed) | 4: UNKNOWN`'
format: int32
errorDescription:
type: string
description: A human-readable value for the error that occurred, if one occurred.
errorValue:
$ref: '#/components/schemas/BTAppElementErrorCode'
items:
type: array
items:
$ref: '#/components/schemas/BTAppDrawingViewInfo'
parentChangeId:
type: string
BTDrawingHiddenLineOption:
type: string
enum:
- drafting
- excluded
- marked
BTAppElementErrorCode:
type: string
enum:
- OK
- TRANSACTION_CONFLICT
- NOT_FOUND
- INCONSISTENT_CHANGES
BTElementLocationParams:
type: object
properties:
elementId:
type: string
description: The id of an element which provides context for the position value specified.
position:
type: integer
description: An indicator for the relative placement of the new element. If elementId is specified, a negative number indicates insertion prior to the element and a non-negative number indicates insertion following the element. If no elementId is specified, a negative value indicates insertion at the end of the element list and a non-negative number indicates insertion at the start of the element list.
format: int32
description: The location at which the new element should be inserted.
BTDrawingParams:
type: object
properties:
border:
type: boolean
description: Set to `true` to include a border in the drawing.
default: false
computeIntersection:
type: boolean
description: Set to `true` to compute and display virtual edges (curves drawn where parts intersect). Leave as `false` to improve performance.
default: false
decimalSeparator:
type: string
description: '`PERIOD` | `COMMA`'
default: PERIOD
displayStateId:
type: string
description: Apply this display state's properties to the drawing.
documentId:
type: string
description: The document in which to create the drawing. If used, this value must match the document ID (`did`) value provided in the URL.
documentMicroversionId:
type: string
description: Create a drawing of a part or assembly from this microversion.
drawingName:
type: string
description: Provide a name for the drawing.
elementConfiguration:
type: string
description: Apply this configuration from the source element to the drawing.
elementId:
type: string
description: The id of the element in which to perform the operation.
elementMicroversionId:
type: string
description: The id of the element microversion in which to perform the operation.
explosionId:
type: string
description: Apply this exploded view to the drawing.
externalDocumentId:
type: string
description: Create a drawing of an element from this external document.
externalDocumentVersionId:
type: string
description: Create a drawing of an element from this external document version.
hiddenLines:
$ref: '#/components/schemas/BTDrawingHiddenLineOption'
includeSurfaces:
type: boolean
description: Set to `true` to include surfaces in the drawing.
default: false
includeWires:
type: boolean
description: Set to `true` to include wires in the drawing.
default: false
isFlattenedPart:
type: boolean
description: Set to `true` if creating a drawing from a flattened part.
default: false
isSketchOnly:
type: boolean
description: Set to `true` if creating a drawing of a sketch.
default: false
isSurface:
type: boolean
description: Set to `true` if creating a drawing from a surface.
default: false
language:
type: string
description: Set the language for the drawing. Accepts any ISO 639-1 standard language code.
default: en-us
location:
$ref: '#/components/schemas/BTElementLocationParams'
modelType:
type: string
description: 'The type of model to include in the drawing: `partstudio` | `assembly`'
namedPositionId:
type: string
description: Apply this named view to the drawing.
numberHorizontalZones:
type: integer
description: The number of horizontal zones to include in the drawing's graphics area.
format: int32
example: 2
default: 0
numberVerticalZones:
type: integer
description: The number of vertical zones to include in the drawing's graphics area.
format: int32
example: 2
default: 0
partId:
type: string
description: Include this part in the drawing.
partNumber:
type: string
description: Include this part in the drawing.
partQuery:
type: string
description: Include all parts found by the query in the drawing.
projection:
type: string
description: Apply this projection to the drawing.
pureSketch:
type: boolean
description: Set to `true` if creating the drawing of an empty sketch.
default: false
qualityOption:
type: string
description: '`BEST_PERFORMANCE` | `BEST_QUALITY` | `BALANCED` | `ADAPTIVE`'
referenceType:
type: integer
description: 'Specify the type of element to create the drawing from. `0: UNKNOWN` | `1: PARTSTUDIO` | `2: ASSEMBLY` | `3: PART` | `4: FLATTENED_PART` | `5: COMPOSITE_PART` | `6: MESH_PART` | `7: SURFACE` | `8: SKETCH` | `9: CURVE`'
format: int32
referenceTypeEnum:
$ref: '#/components/schemas/GBTAppElementReferenceType'
revision:
type: string
description: Create the drawing from this specific revision.
showCutGeomOnly:
type: boolean
description: Set to `true` to show only cut geometry in the drawing.
default: false
showMbdAnnotations:
type: boolean
description: Set to `true` to include MBD data in the drawing.
default: false
simplificationOption:
type: string
description: '`NONE` | `ABSOLUTE` | `RATIO_TO_MODEL` | `RATIO_TO_BODY` | `AUTOMATIC`'
simplificationThreshold:
type: number
description: '`NONE` | `UNKNOWN` | `SMOOTH` | `DRAFTING`'
format: double
size:
type: string
description: Provide a size for the drawing.
sketchIds:
type: array
description: Include these sketches in the drawing.
items:
type: string
description: Include these sketches in the drawing.
standard:
type: string
description: Provide the Standard to use in the drawing.
example: ANSI
startZones:
type: string
description: The zone in which to start the drawing.
example: A1
templateArgs:
type: array
description: Provide any additional arguments for the template being used for this drawing.
items:
type: string
description: Provide any additional arguments for the template being used for this drawing.
templateDocumentId:
type: string
description: Apply the template from this document to the drawing.
templateElementId:
type: string
description: Apply the template from this element to the drawing.
templateName:
type: string
description: Apply this template to the drawing.
templateVersionId:
type: string
description: Apply the template from this version to the drawing.
templateWorkspaceId:
type: string
description: Apply the template from this workspace to the drawing.
titleblock:
type: boolean
description: Set to `true` to include a title block in the drawing.
default: false
units:
type: string
description: 'Units for the element: `METER` | `CENTIMETER` | `MILLIMETER` | `INCH` | `FOOT` | `YARD`'
views:
type: string
description: Add these views to the drawing.
workspaceId:
type: string
description: Create a drawing of a part or assembly from this workspace.
description: JSON schema for creating or updating a drawing.
BTTranslateFormatParams:
required:
- formatName
type: object
properties:
allowFaultyParts:
type: boolean
description: If true, parts with faults are imported. If false, faulty parts are omitted.
default: false
angularTolerance:
type: number
description: Determines the maximum angular deviation, between the analytical surface and its triangulation. Lower values result in a finer geometry and higher values result in coarser geometry.
format: double
example: 0.001
annotationsFontHeightInMillimeters:
type: number
description: Determines the font size in workspace units used for the MBD annotations text export
format: double
example: 4
blobElementId:
type: string
blobMicroversionId:
type: string
cloudObjectId:
type: string
description: Folder id where to store the exported model.
cloudStorageAccountId:
type: string
description: Account id to access the cloud storage.
colorMethod:
type: string
configuration:
type: string
description: URL-encoded string of configuration values (separated by `;`). See the [Configurations API Guide](https://onshape-public.github.io/docs/api-adv/configs/) for details.
connectionId:
type: string
createComposite:
type: boolean
currentSheetOnly:
type: boolean
destinationName:
type: string
description: The name of the exported file.
distanceTolerance:
type: number
description: Determines the maximum distance deviation, between the analytical surface and its triangulation. Lower values result in a finer geometry and higher values result in coarser geometry.
format: double
example: 0.001
dxfVersion:
type: string
elementId:
type: string
description: The id of the element in which to perform the operation.
elementIds:
type: array
description: An array of element ids for multi-element export.
items:
type: string
description: An array of element ids for multi-element export.
emailLink:
type: boolean
description: Use `true` if a link in an email should be sent.
emailMessage:
type: string
description: Message to send in the email body along with the download link.
emailSubject:
type: string
description: Subject to send the email with.
emailTo:
type: array
description: List of email addresses to send the email to.
items:
type: string
description: List of email addresses to send the email to.
evaluateExportRule:
type: boolean
description: Set to `true` to evaluate the export rule for the given `formatName` and to include an `exportRuleFileName` value in the response.
default: false
excludeHiddenEntities:
type: boolean
description: Whether or not to exclude hidden parts from export.
excludeOffSheetContent:
type: boolean
extractAssemblyHierarchy:
type: boolean
flatPatternAsync:
type: boolean
flatten:
type: boolean
flattenAssemblies:
type: boolean
foreignId:
type: string
formatName:
type: string
description: The name of the file format.
fromUserId:
type: string
description: Id of the user who does the export.
getyAxisIsUp:
type: boolean
grouping:
type: boolean
description: Whether parts should be exported as a group or individually in a .zip file.
hideInspectionItems:
type: boolean
ignoreExportRulesForContents:
type: boolean
description: For multiple elements export, use `true` if export rule shouldn't be applied for all elements.
imageHeight:
type: integer
format: int32
imageWidth:
type: integer
format: int32
importAppearances:
type: boolean
importInBackground:
type: boolean
importMaterialDensity:
type: boolean
importWithinDocument:
type: boolean
includeBendCenterlines:
type: boolean
includeBendLines:
type: boolean
includeCboreCsink:
type: boolean
includeDerivedTolerances:
type: boolean
includeExportIds:
type: boolean
description: Whether topology ids should be exported as parasolid attributes.
includeFormedCentermarks:
type: boolean
includeFormedOutlines:
type: boolean
includeSketches:
type: boolean
joinAdjacentSurfaces:
type: boolean
level:
type: string
linkDocumentId:
type: string
description: The id of the document through which the above document should be accessed; only applicable when accessing a version of the document. This allows a user who has access to document a to see data from document b, as long as document b has been linked to document a by a user who has permission to both.
linkDocumentWorkspaceId:
type: string
description: The id of the workspace through which the above document should be accessed; only applicable when accessing a version of the document. This allows a user who has access to document a to see data from document b, as long as document b has been linked to document a by a user who has permission to both.
maximumChordLength:
type: number
description: Determines the maximum of a triangle edge length. Lower values result in a finer geometry and higher values result in coarser geometry.
format: double
example: 0.01
notifyUser:
type: boolean
description: Send notification to the user client.
occurrencesToExport:
type: string
description: 'IDs of the occurrences to retrieve. Use comma-separated IDs for multiple instances (example: occurrencesToExport=JHK,JHD).'
onePartPerDoc:
type: boolean
originalForeignId:
type: string
parasolidMode:
$ref: '#/components/schemas/GBTParasolidEncodingType'
parentId:
type: string
partIds:
type: string
description: 'IDs of the parts to retrieve. Use comma-separated IDs for multiple parts (example: partIds=JHK,JHD).'
partsExportFilter:
$ref: '#/components/schemas/BTPartsExportFilter-4308'
password:
type: string
description: A password to protect the email with.
passwordRequired:
type: boolean
description: Use `true` if the email should be protected with a password.
pdfVersion:
type: string
processedForeignId:
type: string
projectId:
type: string
proxyDocumentId:
type: string
proxyElementId:
type: string
proxyWorkspaceVersion:
type: string
proxyWorkspaceVersionId:
type: string
resolution:
type: string
description: Determines export resolution of fine, medium, or coarse
example: fine
enum:
- fine
- medium
- coarse
rhinoVersion:
$ref: '#/components/schemas/GBTRhinoVersions'
selectablePdfText:
type: boolean
sendCopyToMe:
type: boolean
description: Use `true` if email copy should be sent to the user who does the export.
sheetIndices:
type: array
items:
type: integer
format: int32
sheetMetalFlat:
type: boolean
showOverriddenDimensions:
type: boolean
skipBodyshop:
type: boolean
sourceName:
type: string
specifyMaterialData:
type: boolean
specifyUnits:
type: boolean
splinesAsPolylines:
type: boolean
splitAssembliesIntoMultipleDocuments:
type: boolean
stepParasolidPreprocessingOption:
$ref: '#/components/schemas/GBTPreProcessParasolidOption'
stepVersionString:
type: string
# --- truncated at 32 KB (50 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/onshape/refs/heads/main/openapi/onshape-drawing-api-openapi.yml