Skip to main content

Type Reference

All API responses are parsed into typed Python dataclasses. Every dataclass has a from_dict(data) classmethod and a .raw attribute containing the full API response dict.

from onshape_sdk import Document, Part, TranslationStatus  # etc.

Dataclass Reference

ClassKey FieldsUsed By
PaginatedList[T]items, next, previous, hrefInternal pagination
UserInfoid, name, email, company_name, imagetest_auth()
Ownerid, name, typeDocument
Workspaceid, name, descriptiondocuments.get_workspaces()
DocumentVersionid, name, description, created_at, creatordocuments.get_versions()
Documentid, name, owner, created_at, modified_at, default_workspace_iddocuments.*
Elementid, name, element_type, data_typedocuments.get_elements()
Partname, part_id, body_type, material, appearanceparts.*
FeatureParameterid, type, valueFeature
Featureid, name, feature_type, suppressed, parameterspart_studios.get_features()
Variablename, value, expression, descriptionpart_studios.get_variables()
Occurrencepath, hidden, transformassemblies.get_occurrences()
BomRowitem_name, quantity, item_sourceBomTable
BomTableheaders, rowsassemblies.get_bom()
MateFeatureid, name, mate_type, suppressedassemblies.get_features()
AssemblyDefinitionroot_parts, parts, sub_assembliesassemblies.get_definition()
DrawingViewid, name, view_type, scaledrawings.get_views()
TranslationStatusid, request_state, result_external_data_ids, failure_reason, nametranslations.*
MetadataPropertyname, property_id, value, value_typemetadata.*
ThumbnailSizesize, hrefThumbnailInfo
ThumbnailInfosizesthumbnails.get_info()
Webhookid, url, events, optionswebhooks.*

Common Patterns

Accessing Raw Data

Every dataclass exposes the full API response via .raw:

doc = client.documents.get(did)
print(doc.name) # Typed field
print(doc.raw["createdBy"]) # Access any field from the raw API response

from_dict Pattern

All types use the same factory pattern:

data = {"id": "abc", "name": "Test", ...}
doc = Document.from_dict(data)

This makes it easy to construct types from custom API calls:

resp = client.get("/api/v6/documents/abc123")
doc = Document.from_dict(resp.json())

TranslationStatus Helpers

TranslationStatus has convenience properties for polling:

status = client.translations.get_status(job_id)
status.is_done # True if request_state == "DONE"
status.is_failed # True if request_state == "FAILED"
status.is_active # True if request_state == "ACTIVE"