western-digital Files API

File and folder CRUD operations.

OpenAPI Specification

western-digital-files-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: WD My Cloud Home Authentication Files API
  description: The WD My Cloud Home REST API enables off-device applications to manage files and folders on a user's My Cloud Home NAS device. It supports file upload, download, listing, search, sharing, thumbnails, and device discovery via OAuth 2.0 authentication.
  version: v2
  termsOfService: https://www.westerndigital.com/legal/terms-of-use
  contact:
    name: Western Digital Developer Support
    url: https://developer.westerndigital.com/develop/wd-my-cloud-home/forms.html
  license:
    name: Western Digital Developer Terms
    url: https://developer.westerndigital.com/develop/wd-my-cloud-home/
servers:
- url: https://config.mycloud.com
  description: Configuration service — call first to get device and auth URLs
- url: https://device.mycloud.com
  description: Device service (dynamically resolved per device)
- url: https://wdc.auth0.com
  description: Authentication service
tags:
- name: Files
  description: File and folder CRUD operations.
paths:
  /sdk/v2/files:
    get:
      operationId: listFiles
      summary: List Files
      description: Returns a paginated list of files and folders within a directory on the My Cloud Home device. Use "root" as the folder ID to list the root directory.
      tags:
      - Files
      security:
      - bearerAuth: []
      parameters:
      - name: ids
        in: query
        required: false
        schema:
          type: string
        description: Comma-separated list of file IDs to retrieve.
      - name: pageToken
        in: query
        required: false
        schema:
          type: string
        description: Token for pagination to retrieve the next page.
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 100
          maximum: 100
        description: Maximum number of results to return.
      responses:
        '200':
          description: List of files and folders.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FilesResponse'
        '401':
          description: Unauthorized.
    post:
      operationId: createFile
      summary: Create File
      description: Uploads a new file or creates a folder on the My Cloud Home device. Supports multipart/related for simultaneous metadata and content upload.
      tags:
      - Files
      security:
      - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileCreateRequest'
          multipart/related:
            schema:
              type: object
              properties:
                metadata:
                  $ref: '#/components/schemas/FileCreateRequest'
                content:
                  type: string
                  format: binary
      responses:
        '201':
          description: File or folder created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileItem'
        '401':
          description: Unauthorized.
  /sdk/v2/files/{fileId}:
    get:
      operationId: getFile
      summary: Get File
      description: Returns metadata for a specific file or folder.
      tags:
      - Files
      security:
      - bearerAuth: []
      parameters:
      - name: fileId
        in: path
        required: true
        schema:
          type: string
        description: Unique identifier of the file or folder.
      responses:
        '200':
          description: File metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileItem'
        '404':
          description: File not found.
    patch:
      operationId: updateFile
      summary: Update File
      description: Updates metadata for a file or folder (e.g., rename, move).
      tags:
      - Files
      security:
      - bearerAuth: []
      parameters:
      - name: fileId
        in: path
        required: true
        schema:
          type: string
        description: Unique identifier of the file or folder.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileUpdateRequest'
      responses:
        '200':
          description: Updated file metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileItem'
        '404':
          description: File not found.
    delete:
      operationId: deleteFile
      summary: Delete File
      description: Permanently deletes a file or folder from the device.
      tags:
      - Files
      security:
      - bearerAuth: []
      parameters:
      - name: fileId
        in: path
        required: true
        schema:
          type: string
        description: Unique identifier of the file or folder.
      responses:
        '204':
          description: File deleted.
        '404':
          description: File not found.
  /sdk/v2/files/{fileId}/content:
    get:
      operationId: downloadFile
      summary: Download File Content
      description: Downloads the content of a specific file.
      tags:
      - Files
      security:
      - bearerAuth: []
      parameters:
      - name: fileId
        in: path
        required: true
        schema:
          type: string
        description: Unique identifier of the file.
      responses:
        '200':
          description: File content.
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '404':
          description: File not found.
    put:
      operationId: uploadFileContent
      summary: Upload File Content
      description: Uploads or replaces the content of an existing file.
      tags:
      - Files
      security:
      - bearerAuth: []
      parameters:
      - name: fileId
        in: path
        required: true
        schema:
          type: string
        description: Unique identifier of the file.
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
      responses:
        '200':
          description: File content updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileItem'
components:
  schemas:
    FilesResponse:
      type: object
      properties:
        files:
          type: array
          items:
            $ref: '#/components/schemas/FileItem'
        pageToken:
          type: string
          description: Token for the next page of results. Absent if no more pages.
    FileUpdateRequest:
      type: object
      properties:
        name:
          type: string
          description: New name for the file or folder.
        parentId:
          type: string
          description: New parent folder ID (to move the file).
    FileItem:
      type: object
      properties:
        id:
          type: string
          description: Unique file/folder identifier.
        name:
          type: string
          description: File or folder name.
        mimeType:
          type: string
          description: MIME type. Use "application/x.wd.dir" for folders.
        size:
          type: integer
          description: File size in bytes.
        parentId:
          type: string
          description: ID of the parent folder. "root" for top-level items.
        createdTime:
          type: string
          format: date-time
        modifiedTime:
          type: string
          format: date-time
        thumbnailUrl:
          type: string
          format: uri
          description: URL for image/video thumbnail.
        downloadUrl:
          type: string
          format: uri
          description: Direct download URL.
    FileCreateRequest:
      type: object
      properties:
        name:
          type: string
          description: Name of the file or folder.
        mimeType:
          type: string
          description: MIME type. Use "application/x.wd.dir" to create a folder.
        parentId:
          type: string
          description: Parent folder ID. Use "root" for root directory.
      required:
      - name
      - mimeType
      - parentId
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth 2.0 Bearer token obtained via the /oauth/token endpoint. Include in Authorization header as "Bearer {token}".