Onshape Publication API

Access publication information.

OpenAPI Specification

onshape-publication-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Onshape REST Account Publication 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: Publication
  description: Access publication information.
paths:
  /publications:
    post:
      tags:
      - Publication
      summary: Create a new publication.
      operationId: createPublication
      requestBody:
        content:
          application/json;charset=UTF-8; qs=0.09:
            schema:
              $ref: '#/components/schemas/BTPublicationParams'
        required: true
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8; qs=0.09:
              schema:
                $ref: '#/components/schemas/BTPublicationInfo'
      deprecated: false
      security:
      - OAuth2:
        - OAuth2Write
        BasicAuth:
        - OAuth2Write
      x-BTVisibility: PRODUCTION
  /publications/{pid}:
    post:
      tags:
      - Publication
      summary: Update publication's attributes name, description, and notes.
      operationId: updatePublicationAttributes
      parameters:
      - name: pid
        in: path
        description: Publication ID.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json;charset=UTF-8; qs=0.09:
            schema:
              $ref: '#/components/schemas/BTPublicationParams'
        required: true
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8; qs=0.09:
              schema:
                type: object
      deprecated: false
      security:
      - OAuth2:
        - OAuth2Write
        BasicAuth:
        - OAuth2Write
      x-BTVisibility: PRODUCTION
    delete:
      tags:
      - Publication
      summary: Delete a publication.
      operationId: deletePublication
      parameters:
      - name: pid
        in: path
        description: Publication ID.
        required: true
        schema:
          type: string
      - name: forever
        in: query
        description: If true, publication is deleted forever.
        schema:
          type: boolean
          default: false
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8; qs=0.09:
              schema:
                type: object
      deprecated: false
      security:
      - OAuth2:
        - OAuth2Delete
        BasicAuth:
        - OAuth2Delete
      x-BTVisibility: PRODUCTION
  /publications/{pid}/item:
    post:
      tags:
      - Publication
      summary: Add an item in a publication.
      operationId: addItemToPublication
      parameters:
      - name: pid
        in: path
        description: Publication ID.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json;charset=UTF-8; qs=0.09:
            schema:
              $ref: '#/components/schemas/BTPublicationItemParams'
        required: true
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8; qs=0.09:
              schema:
                $ref: '#/components/schemas/BTPublicationInfo'
      deprecated: false
      security:
      - OAuth2:
        - OAuth2Write
        BasicAuth:
        - OAuth2Write
      x-BTVisibility: PRODUCTION
  /publications/{pid}/item/{iid}:
    delete:
      tags:
      - Publication
      summary: Remove an item from a publication.
      operationId: deletePublicationItem
      parameters:
      - name: pid
        in: path
        description: Publication ID.
        required: true
        schema:
          type: string
      - name: iid
        in: path
        description: Publication item ID.
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8; qs=0.09:
              schema:
                type: object
      deprecated: false
      security:
      - OAuth2:
        - OAuth2Write
        BasicAuth:
        - OAuth2Write
      x-BTVisibility: PRODUCTION
  /publications/{pid}/items:
    get:
      tags:
      - Publication
      summary: Get all items in a publication.
      operationId: getPublicationItems
      parameters:
      - name: pid
        in: path
        description: Publication ID.
        required: true
        schema:
          type: string
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8; qs=0.09:
              schema:
                $ref: '#/components/schemas/BTPublicationInfo'
      deprecated: false
      security:
      - OAuth2:
        - OAuth2Read
        BasicAuth:
        - OAuth2Read
      x-BTVisibility: PRODUCTION
    post:
      tags:
      - Publication
      summary: Add publication items in bulk.
      operationId: addItemsToPublication
      parameters:
      - name: pid
        in: path
        description: Publication ID.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json;charset=UTF-8; qs=0.09:
            schema:
              $ref: '#/components/schemas/BTPublicationBulkItemParams'
        required: true
      responses:
        default:
          description: default response
          content:
            application/json;charset=UTF-8; qs=0.09:
              schema:
                $ref: '#/components/schemas/BTPublicationInfo'
      deprecated: false
      security:
      - OAuth2:
        - OAuth2Write
        BasicAuth:
        - OAuth2Write
      x-BTVisibility: PRODUCTION
components:
  schemas:
    BTPublicationParams:
      type: object
      properties:
        description:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/BTPublicationItemParams'
        name:
          type: string
        notes:
          type: string
          description: Deprecated. Use the /documents/{did}/notes endpoint instead.
          deprecated: true
        oldClientNotes:
          type: string
          description: Deprecated. Use the /documents/{did}/notes endpoint instead.
          deprecated: true
        ownerId:
          type: string
        ownerType:
          type: integer
          format: int32
        parentId:
          type: string
        projectId:
          type: string
    BTUserBasicSummaryInfo:
      required:
      - jsonType
      type: object
      properties:
        jsonType:
          type: string
      discriminator:
        propertyName: jsonType
        mapping:
          user-summary: '#/components/schemas/BTUserBasicSummaryInfo'
          user-detail-summary: '#/components/schemas/BTUserDetailSummaryInfo'
      allOf:
      - $ref: '#/components/schemas/BTBaseInfo'
      - type: object
        properties:
          href:
            type: string
            description: URI to fetch complete information of the resource.
            format: uri
          id:
            type: string
            description: Id of the resource.
          image:
            type: string
          isOnshapeSupport:
            type: boolean
          name:
            type: string
            description: Name of the resource.
          state:
            type: integer
            format: int32
          viewRef:
            type: string
            description: URI to visualize the resource in a webclient if applicable.
            format: uri
    BTOwnerInfo:
      type: object
      properties:
        href:
          type: string
          description: URI to fetch complete information of the resource.
          format: uri
        id:
          type: string
          description: Id of the resource.
        image:
          type: string
        isEnterpriseOwnedResource:
          type: boolean
        name:
          type: string
          description: Name of the resource.
        type:
          type: integer
          format: int32
        viewRef:
          type: string
          description: URI to visualize the resource in a webclient if applicable.
          format: uri
    BTPublicationBulkItemParams:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/BTPublicationItemParams'
    BTPublicationInfo:
      type: object
      allOf:
      - $ref: '#/components/schemas/BTGlobalTreeNodeInfo'
      - type: object
        properties:
          defaultWorkspaceId:
            type: string
          items:
            type: array
            items:
              $ref: '#/components/schemas/BTPublicationInfoItem'
          notes:
            type: string
          sequence:
            type: string
    BTBaseInfo:
      type: object
      properties:
        href:
          type: string
          description: URI to fetch complete information of the resource.
          format: uri
        id:
          type: string
          description: Id of the resource.
        name:
          type: string
          description: Name of the resource.
        viewRef:
          type: string
          description: URI to visualize the resource in a webclient if applicable.
          format: uri
    BTGlobalTreeNodeInfo:
      required:
      - jsonType
      type: object
      properties:
        canMove:
          type: boolean
        connectionName:
          type: string
        connectionNames:
          type: array
          items:
            type: string
        createdAt:
          type: string
          format: date-time
        createdBy:
          $ref: '#/components/schemas/BTUserBasicSummaryInfo'
        description:
          type: string
        href:
          type: string
          description: URI to fetch complete information of the resource.
          format: uri
        id:
          type: string
          description: Id of the resource.
        isContainer:
          type: boolean
        isEnterpriseOwned:
          type: boolean
        isExternalConnectionResource:
          type: boolean
        isMutable:
          type: boolean
        jsonType:
          type: string
        modifiedAt:
          type: string
          format: date-time
        modifiedBy:
          $ref: '#/components/schemas/BTUserBasicSummaryInfo'
        name:
          type: string
          description: Name of the resource.
        owner:
          $ref: '#/components/schemas/BTOwnerInfo'
        parentId:
          type: string
        projectId:
          type: string
        resourceType:
          type: string
        treeHref:
          type: string
        unparentHref:
          type: string
        viewRef:
          type: string
          description: URI to visualize the resource in a webclient if applicable.
          format: uri
      discriminator:
        propertyName: jsonType
        mapping:
          document-summary: '#/components/schemas/BTGlobalTreeNodeSummaryInfo'
          folder: '#/components/schemas/BTFolderInfo'
          magic: '#/components/schemas/BTGlobalTreeMagicNodeInfo'
          project: '#/components/schemas/BTProjectInfo'
          label: '#/components/schemas/BTDocumentLabelInfo'
          team-summary: '#/components/schemas/BTTeamSummaryInfo'
          cloudstorageaccount: '#/components/schemas/BTCloudStorageAccountInfo'
          classroom: '#/components/schemas/BTClassroomInfo'
          resource-owner: '#/components/schemas/BTResourceOwnerInfo'
          external-connection: '#/components/schemas/BTExternalConnectionInfo'
          smartfolder: '#/components/schemas/BTSmartFolderInfo'
    BTPublicationInfoItem:
      required:
      - jsonType
      type: object
      properties:
        applicationTarget:
          $ref: '#/components/schemas/BTApplicationTargetInfo'
        dataType:
          type: string
        documentId:
          type: string
        elementId:
          type: string
        elementType:
          $ref: '#/components/schemas/GBTElementType'
        encodedConfiguration:
          type: string
        id:
          type: string
        jsonType:
          type: string
        partId:
          type: string
        partName:
          type: string
        partNumber:
          type: string
        revision:
          type: string
        revisionId:
          type: string
        state:
          type: integer
          format: int32
        versionId:
          type: string
        versionName:
          type: string
      discriminator:
        propertyName: jsonType
        mapping:
          publication-blob-item: '#/components/schemas/BlobItem'
    BTPublicationItemParams:
      type: object
      properties:
        dataType:
          type: string
        documentId:
          type: string
        elementId:
          type: string
        encodedConfiguration:
          type: string
        isApplication:
          type: boolean
        isAssembly:
          type: boolean
        isBlob:
          type: boolean
        isWholePartStudio:
          type: boolean
        mimeType:
          type: string
        partId:
          type: string
        partName:
          type: string
        partNumber:
          type: string
        revision:
          type: string
        revisionId:
          type: string
        versionId:
          type: string
    GBTElementType:
      type: string
      enum:
      - PARTSTUDIO
      - ASSEMBLY
      - DRAWING
      - FEATURESTUDIO
      - BLOB
      - APPLICATION
      - TABLE
      - BILLOFMATERIALS
      - VARIABLESTUDIO
      - PUBLICATIONITEM
      - UNKNOWN
    BTApplicationTargetInfo:
      type: object
      properties:
        baseHref:
          type: string
          format: uri
        clientId:
          type: string
        supportsCollaboration:
          type: boolean
        tabIconHref:
          type: string
          format: uri
  securitySchemes:
    OAuth2:
      type: oauth2
      description: Use OAuth 2.0 to authenticate requests.
      flows:
        authorizationCode:
          authorizationUrl: /oauth/authorize
          tokenUrl: /oauth/token
          refreshUrl: /oauth/token
          scopes:
            OAuth2Internal: Application is Onshape Internal
            OAuth2ReadPII: Application can read your profile information
            OAuth2Read: Application can read your documents
            OAuth2Write: Application can write to your documents
            OAuth2Delete: Application can delete your documents and workspaces
            OAuth2Purchase: Application can request purchases on your behalf
            OAuth2Share: Application can share and unshare documents on your behalf
            document.create: Atlas Application can create a document
            document.edit: Atlas Application can edit a document
            document.delete: Atlas Application can delete a document
            document.read: Atlas Application can read a document
            enterprise.create: Atlas Application can create an enterprise
            enterprise.read: Atlas Application can read from an enterprise
            enterprise.edit: Atlas Application can edit an enterprise
            enterprise.delete: Atlas Application can delete an enterprise
            enterprise.member.create: Atlas Application can create an enterprise member
            enterprise.member.read: Atlas Application can read the details of an enterprise member
            enterprise.member.edit: Atlas Application can edit the details of an enterprise member
            enterprise.member.delete: Atlas Application can delete a member from an enterprise
            webhook.create: Atlas Application can create a webhook on behalf of the logged-in user
            webhook.edit: Atlas Application can edit a webhook on behalf of the logged-in user
            webhook.read: Atlas Application can read a webhook on behalf of the logged-in user
            webhook.delete: Atlas Application can delete a webhook on behalf of the logged-in user
            PLMIntegration: PLM automation can invoke limited operations
    BasicAuth:
      type: http
      description: Use Basic Authentication with API Keys (key as username and secret as password) to authenticate requests.
      scheme: basic