OpenMetadata Files API

A `File` is a document or resource stored in a Drive Service.

OpenAPI Specification

openmetadata-files-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: OpenMetadata APIs Agent Executions Files API
  description: Common types and API definition for OpenMetadata
  contact:
    name: OpenMetadata
    url: https://open-metadata.org
    email: openmetadata-dev@googlegroups.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: '1.13'
servers:
- url: /api
  description: Current Host
- url: http://localhost:8585/api
  description: Endpoint URL
security:
- BearerAuth: []
tags:
- name: Files
  description: A `File` is a document or resource stored in a Drive Service.
paths:
  /v1/drives/files/{id}/followers:
    put:
      tags:
      - Files
      summary: Add a follower
      description: Add a user identified by `userId` as follower of this file
      operationId: addFollowerToFile
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        description: Id of the user to be added as follower
        content:
          application/json:
            schema:
              type: string
              format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeEvent'
        '404':
          description: File for instance {id} is not found
  /v1/drives/files/{id}/sampleData:
    get:
      tags:
      - Files
      summary: Get sample data
      description: Get sample data from the file.
      operationId: getSampleData_1
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: The file with sample data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
    put:
      tags:
      - Files
      summary: Add sample data
      description: Add sample data to the file.
      operationId: addSampleData_1
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TableData'
      responses:
        '200':
          description: The file with sample data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
    delete:
      tags:
      - Files
      summary: Delete sample data
      description: Delete sample data from the file.
      operationId: deleteSampleData_1
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: The file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
  /v1/drives/files/bulk:
    put:
      tags:
      - Files
      summary: Bulk create or update files
      description: Create or update multiple files in a single operation.
      operationId: bulkCreateOrUpdateFiles
      parameters:
      - name: async
        in: query
        schema:
          type: boolean
          default: false
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/CreateFile'
      responses:
        '200':
          description: Bulk operation results
        '202':
          description: Bulk operation accepted for async processing
        '400':
          description: Bad request
  /v1/drives/files:
    get:
      tags:
      - Files
      summary: List files
      description: Get a list of files, optionally filtered by `service` or `directory` it belongs to. Use `fields` parameter to get only necessary fields. Use cursor-based pagination to limit the number entries in the list using `limit` and `before` or `after` query params.
      operationId: listFiles
      parameters:
      - name: fields
        in: query
        description: Fields requested in the returned resource
        schema:
          type: string
          example: owners,directory,usageSummary,tags,fileExtension,extension,domains,sourceHash,lifeCycle,votes,followers,columns,sampleData
      - name: service
        in: query
        description: Filter files by service name
        schema:
          type: string
          example: googleDrive
      - name: directory
        in: query
        description: Filter files by directory fully qualified name
        schema:
          type: string
      - name: fileType
        in: query
        description: Filter files by file type
        schema:
          type: string
      - name: root
        in: query
        description: List files at the root level (without parent) when `true`
        schema:
          type: boolean
          default: false
      - name: limit
        in: query
        description: Limit the number files returned. (1 to 1000000, default = 10)
        schema:
          maximum: 1000000
          minimum: 0
          type: integer
          format: int32
          default: 10
      - name: before
        in: query
        description: Returns list of files before this cursor
        schema:
          type: string
      - name: after
        in: query
        description: Returns list of files after this cursor
        schema:
          type: string
      - name: include
        in: query
        description: Include all, deleted, or non-deleted entities.
        schema:
          type: string
          default: non-deleted
          enum:
          - all
          - deleted
          - non-deleted
      responses:
        '200':
          description: List of files
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileList'
    put:
      tags:
      - Files
      summary: Create or update a file
      description: Create a new file, if it does not exist or update an existing file.
      operationId: createOrUpdateFile
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFile'
      responses:
        '200':
          description: The file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '400':
          description: Bad request
    post:
      tags:
      - Files
      summary: Create a file
      description: Create a new file under an existing `directory`.
      operationId: createFile
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFile'
      responses:
        '200':
          description: The file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '400':
          description: Bad request
  /v1/drives/files/name/{fqn}:
    get:
      tags:
      - Files
      summary: Get a file by fully qualified name
      description: Get a file by fully qualified name.
      operationId: getFileByFQN
      parameters:
      - name: fqn
        in: path
        description: Fully qualified name of the file
        required: true
        schema:
          type: string
      - name: fields
        in: query
        description: Fields requested in the returned resource
        schema:
          type: string
          example: owners,directory,usageSummary,tags,fileExtension,extension,domains,sourceHash,lifeCycle,votes,followers,columns,sampleData
      - name: include
        in: query
        description: Include all, deleted, or non-deleted entities.
        schema:
          type: string
          default: non-deleted
          enum:
          - all
          - deleted
          - non-deleted
      - name: includeRelations
        in: query
        description: 'Per-relation include control. Format: field:value,field2:value2. Example: owners:non-deleted,followers:all. Valid values: all, deleted, non-deleted. If not specified for a field, uses the entity''s include value.'
        schema:
          type: string
          example: owners:non-deleted,followers:all
      responses:
        '200':
          description: The file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '404':
          description: File for instance {fqn} is not found
    delete:
      tags:
      - Files
      summary: Delete a file by fully qualified name
      description: Delete a file by `fullyQualifiedName`.
      operationId: deleteFileByFQN
      parameters:
      - name: hardDelete
        in: query
        description: Hard delete the entity. (Default = `false`)
        schema:
          type: boolean
          default: false
      - name: fqn
        in: path
        description: Fully qualified name of the file
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
        '404':
          description: File for instance {fqn} is not found
    patch:
      tags:
      - Files
      summary: Update a file by name.
      description: Update an existing file using JsonPatch.
      externalDocs:
        description: JsonPatch RFC
        url: https://tools.ietf.org/html/rfc6902
      operationId: patchFile
      parameters:
      - name: fqn
        in: path
        description: Name of the file
        required: true
        schema:
          type: string
      requestBody:
        description: JsonPatch with array of operations
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/JsonPatch'
            example: '[{op:remove, path:/a},{op:add, path: /b, value: val}]'
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /v1/drives/files/{id}:
    get:
      tags:
      - Files
      summary: Get a file by Id
      description: Get a file by `Id`.
      operationId: getFileByID
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      - name: fields
        in: query
        description: Fields requested in the returned resource
        schema:
          type: string
          example: owners,directory,usageSummary,tags,fileExtension,extension,domains,sourceHash,lifeCycle,votes,followers,columns,sampleData
      - name: include
        in: query
        description: Include all, deleted, or non-deleted entities.
        schema:
          type: string
          default: non-deleted
          enum:
          - all
          - deleted
          - non-deleted
      - name: includeRelations
        in: query
        description: 'Per-relation include control. Format: field:value,field2:value2. Example: owners:non-deleted,followers:all. Valid values: all, deleted, non-deleted. If not specified for a field, uses the entity''s include value.'
        schema:
          type: string
          example: owners:non-deleted,followers:all
      responses:
        '200':
          description: The file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '404':
          description: File for instance {id} is not found
    delete:
      tags:
      - Files
      summary: Delete a file by Id
      description: Delete a file by `Id`.
      operationId: deleteFile
      parameters:
      - name: hardDelete
        in: query
        description: Hard delete the entity. (Default = `false`)
        schema:
          type: boolean
          default: false
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
        '404':
          description: File for instance {id} is not found
    patch:
      tags:
      - Files
      summary: Update a file
      description: Update an existing file using JsonPatch.
      externalDocs:
        description: JsonPatch RFC
        url: https://tools.ietf.org/html/rfc6902
      operationId: patchFile_1
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        description: JsonPatch with array of operations
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/JsonPatch'
            example: '[{op:remove, path:/a},{op:add, path: /b, value: val}]'
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /v1/drives/files/async/{id}:
    delete:
      tags:
      - Files
      summary: Asynchronously delete a file by Id
      description: Asynchronously delete a file by `Id`.
      operationId: deleteFileAsync
      parameters:
      - name: hardDelete
        in: query
        description: Hard delete the entity. (Default = `false`)
        schema:
          type: boolean
          default: false
      - name: recursive
        in: query
        description: Recursively delete this entity and its children. (Default `false`)
        schema:
          type: boolean
          default: false
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
        '404':
          description: File for instance {id} is not found
  /v1/drives/files/{id}/followers/{userId}:
    delete:
      tags:
      - Files
      summary: Remove a follower
      description: Remove the user identified `userId` as a follower of the file.
      operationId: removeFollowerFromFile
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      - name: userId
        in: path
        description: Id of the user being removed as follower
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeEvent'
  /v1/drives/files/{id}/versions/{version}:
    get:
      tags:
      - Files
      summary: Get a specific version of the file
      description: Get a specific version of the file identified by `Id`
      operationId: getSpecificFileVersion
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      - name: version
        in: path
        description: File version number in the form `major`.`minor`
        required: true
        schema:
          type: string
          example: 0.1 or 1.1
      responses:
        '200':
          description: File
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '404':
          description: File for instance {id} and version {version} is not found
  /v1/drives/files/history:
    get:
      tags:
      - Files
      summary: List all entity versions within a time range
      description: 'Get a paginated list of all entity versions within a given time range specified by `startTs` and `endTs` in milliseconds since epoch. '
      operationId: listAllEntityVersionsByTimestamp_25
      parameters:
      - name: startTs
        in: query
        description: Start timestamp in milliseconds since epoch
        required: true
        schema:
          type: integer
          format: int64
      - name: endTs
        in: query
        description: End timestamp in milliseconds since epoch
        required: true
        schema:
          type: integer
          format: int64
      - name: limit
        in: query
        description: Limit the number of entity returned (1 to 1000000, default = 10)
        schema:
          maximum: 500
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: before
        in: query
        description: Returns list of entity versions before this cursor
        schema:
          type: string
      - name: after
        in: query
        description: Returns list of entity versions after this cursor
        schema:
          type: string
      responses:
        '200':
          description: List of all versions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResultList'
  /v1/drives/files/{id}/versions:
    get:
      tags:
      - Files
      summary: List file versions
      description: Get a list of all the versions of a file identified by `Id`
      operationId: listAllFileVersion
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: List of file versions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntityHistory'
  /v1/drives/files/restore:
    put:
      tags:
      - Files
      summary: Restore a soft deleted file by id
      description: Restore a soft deleted file by id.
      operationId: restoreFileById
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestoreEntity'
      responses:
        '200':
          description: Successfully restored the file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
  /v1/drives/files/{id}/restore:
    put:
      tags:
      - Files
      summary: Restore a soft deleted file
      description: Restore a soft deleted file.
      operationId: restoreFile
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: 'Successfully restored the file '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
  /v1/drives/files/{id}/vote:
    put:
      tags:
      - Files
      summary: Update Vote for a file
      description: Update vote for a file
      operationId: updateVoteForFile
      parameters:
      - name: id
        in: path
        description: Id of the file
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoteRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeEvent'
        '404':
          description: File for instance {id} is not found
components:
  schemas:
    TagLabelRecognizerMetadata:
      required:
      - recognizerId
      - recognizerName
      - score
      type: object
      properties:
        recognizerId:
          type: string
          format: uuid
        recognizerName:
          type: string
        score:
          type: number
          format: double
        target:
          type: string
          enum:
          - content
          - column_name
        patterns:
          type: array
          items:
            $ref: '#/components/schemas/PatternMatch'
    FileList:
      required:
      - data
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/File'
        paging:
          $ref: '#/components/schemas/Paging'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/EntityError'
        warningsCount:
          type: integer
          format: int32
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/EntityError'
    ColumnProfile:
      required:
      - name
      - timestamp
      type: object
      properties:
        name:
          type: string
        timestamp:
          type: integer
          format: int64
        valuesCount:
          type: number
          format: double
        valuesPercentage:
          type: number
          format: double
        validCount:
          type: number
          format: double
        duplicateCount:
          type: number
          format: double
        nullCount:
          type: number
          format: double
        nullProportion:
          type: number
          format: double
        missingPercentage:
          type: number
          format: double
        missingCount:
          type: number
          format: double
        uniqueCount:
          type: number
          format: double
        uniqueProportion:
          type: number
          format: double
        distinctCount:
          type: number
          format: double
        distinctProportion:
          type: number
          format: double
        min:
          type: object
        max:
          type: object
        minLength:
          type: number
          format: double
        maxLength:
          type: number
          format: double
        mean:
          type: number
          format: double
        sum:
          type: number
          format: double
        stddev:
          type: number
          format: double
        variance:
          type: number
          format: double
        median:
          type: number
          format: double
        firstQuartile:
          type: number
          format: double
        thirdQuartile:
          type: number
          format: double
        interQuartileRange:
          type: number
          format: double
        nonParametricSkew:
          type: number
          format: double
        histogram:
          $ref: '#/components/schemas/Histogram'
        customMetrics:
          type: array
          items:
            $ref: '#/components/schemas/CustomMetricProfile'
        cardinalityDistribution:
          $ref: '#/components/schemas/CardinalityDistribution'
    ChangeSummaryMap:
      type: object
    AccessDetails:
      required:
      - timestamp
      type: object
      properties:
        timestamp:
          type: integer
          format: int64
        accessedBy:
          $ref: '#/components/schemas/EntityReference'
        accessedByAProcess:
          type: string
    RestoreEntity:
      required:
      - id
      type: object
      properties:
        id:
          type: string
          format: uuid
    FieldChange:
      type: object
      properties:
        name:
          type: string
        oldValue:
          type: object
        newValue:
          type: object
    CoverImage:
      type: object
      properties:
        url:
          type: string
        position:
          type: string
    LifeCycle:
      type: object
      properties:
        created:
          $ref: '#/components/schemas/AccessDetails'
        updated:
          $ref: '#/components/schemas/AccessDetails'
        accessed:
          $ref: '#/components/schemas/AccessDetails'
    EntityHistory:
      required:
      - entityType
      - versions
      type: object
      properties:
        entityType:
          type: string
        versions:
          type: array
          items:
            type: object
    AssetCertification:
      required:
      - appliedDate
      - expiryDate
      - tagLabel
      type: object
      properties:
        tagLabel:
          $ref: '#/components/schemas/TagLabel'
        appliedDate:
          type: integer
          format: int64
        expiryDate:
          type: integer
          format: int64
    CustomMetricProfile:
      type: object
      properties:
        name:
          type: string
        value:
          type: number
          format: double
    CreateFile:
      required:
      - name
      - service
      type: object
      properties:
        name:
          maxLength: 256
          minLength: 1
          pattern: ^((?!::).)*$
          type: string
        displayName:
          type: string
        description:
          type: string
        service:
          maxLength: 3072
          minLength: 1
          type: string
        directory:
          maxLength: 3072
          minLength: 1
          type: string
        fileType:
          type: string
          enum:
          - Document
          - Spreadsheet
          - Presentation
          - Image
          - Video
          - Audio
          - PDF
          - Archive
          - Code
          - Data
          - CSV
          - Text
          - Other
        mimeType:
          type: string
        fileExtension:
          type: string
        path:
          type: string
        size:
          type: integer
          format: int32
        columns:
          type: array
          items:
            $ref: '#/components/schemas/Column'
        checksum:
          type: string
        webViewLink:
          type: string
          format: uri
        downloadLink:
          type: string
          format: uri
        isShared:
          type: boolean
        fileVersion:
          type: string
        sourceUrl:
          type: string
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagLabel'
        owners:
          type: array
          items:
            $ref: '#/components/schemas/EntityReference'
        dataProducts:
          type: array
          items:
            type: string
        domains:
          type: array
          items:
            type: string
        lifeCycle:
          $ref: '#/components/schemas/LifeCycle'
        sourceHash:
          maxLength: 32
          minLength: 1
          type: string
        extension:
          type: object
        reviewers:
          type: array
          items:
            $ref: '#/components/schemas/EntityReference'
    CardinalityDistribution:
      type: object
      properties:
        categories:
          type: array
          items:
            type: string
        counts:
          type: array
          items:
            type: integer
            format: int32
        percentages:
          type: array
          items:
            type: number
            format: double
        allValuesUnique:
          type: boolean
    ResultList:
      required:
      - data
      type: object
      properties:
        data:
          type: array
          items:
            type: object
        paging:
          $ref: '#/components/schemas/Paging'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/EntityError'
        warningsCount:
          type: integer
          format: int32
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/EntityError'
    VoteRequest:
      type: object
      properties:
        updatedVoteType:
          type: string
          enum:
          - votedUp
          - votedDown
          - unVoted
    TableData:
      type: object
      properties:
        columns:
          type: array
          items:
            type: string
        rows:
          type: array
          items:
            type: array
            items:
              type: object
    Paging:
      required:
      - total
      type: object
      properties:
        before:
          type: string
        after:
          type: string
        offset:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
        total:
          type: integer
          format: int32
    JsonPatch:
      type: object
    CustomMetric:
      required:
      - expression
      - name
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          maxLength: 256
          minLength: 1
          pattern: ^((?!::).)*$
          type: string
        description:
          type: string
        columnName:
          type: string
        expression:
          type: string
        owners:
          type: array
          items:
            $ref: '#/components/schemas/EntityReference'
        updatedAt:
          type: integer
          format: int64
        updatedBy:
          type: string
    ChangeDescription:
      type: object
      properties:
        fieldsAdded:
          type: array
          items:
            $ref: '#/components/schemas/FieldChange'
        fieldsUpdated:
          type: array
          items:
            $ref: '#/components/schemas/FieldChange'
        fieldsDeleted:
          type: array
          items:
            $ref: '#/components/schemas/FieldChange'
        previousVersion:
          type: number
          format: double
        changeSummary:
          $ref: '#/components/schemas/ChangeSummaryMap'
    ChangeEvent:
      required:
      - entityId
      - entityType
      - eventType
      - id
      - timestamp
      type: object
      properties:
        id:
          type: string
          format: uuid
        eventType:
          type: string
          enum:
          - entityCreated
          - entityUpdated
          - entityFieldsChanged
          - entityNoChange
          - entitySoftDeleted
          - entityDeleted
          - entityRestored
          - threadCreated
          - threadUpdated
          - postCreated
          - postUpdated
          - taskResolved
          - taskClosed
          - logicalTestCaseAdded
          - suggestionCreated
          - suggestionUpdated
          - suggestionAccepted
          - suggestionRejected
          - suggestionDeleted
          - userLogin
          - userLogout
        entityType:
          type: string
        entityId:
          type: string
          format: uuid
        domains:
          type: array
          items:
            type: string
            format: uuid
        entityFullyQualifiedName:
          type: string
        previousVersion:
          type: number
          format: double
        currentVersion:
          type: number
          format: double
        userName:
          type: string
        impersonatedBy:
          type: string
        timestamp:
          type: integer
          format: int64
        changeDescription:
          $ref: '#/components/schemas/ChangeDescription'
        incrementalChangeDescription:
          $ref: '#/components/schemas/ChangeDescription'
        entity:
          type: object
    File:
      required:
      - id
      - name
      - service
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          maxLength: 256
          minLength: 1
          pattern: ^((?!::).)*$
          type: string
        fullyQualifiedName:
          maxLength: 3072
          minLength: 1
          type: string
        displayName:
          type: string
        description:
          type: string
        service:
          $ref: '#/components/schemas/EntityReference'
        serviceType:
          type: string
          enum:
          - GoogleDrive
          - SharePoint
          - Sftp
          - CustomDrive
        directory:
          $ref: '#/components/schemas/EntityReference'
        fileType:
          type: string
          enum:
          - Document
          - Spreadsheet
          - Presentation
          - Image
          - Video
          - Audio
          - PDF
          - Archive
          - Code
          - Data
          - CSV
          - Text
          - Other
        mimeType:
          type: string
        fileExtension:
          type: string
        path:
          type: string
        size:
          type: integer
          format: int32
        columns:
          ty

# --- truncated at 32 KB (43 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openmetadata/refs/heads/main/openapi/openmetadata-files-api-openapi.yml