> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixpeek.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get document lineage

> Get the complete processing lineage for a document. Shows the full chain of transformations from the root bucket object through all collection processing stages.



## OpenAPI

````yaml get /v1/collections/{collection_id}/documents/{document_id}/lineage
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security:
  - BearerAuth: []
paths:
  /v1/collections/{collection_id}/documents/{document_id}/lineage:
    get:
      tags:
        - Document Lineage
      summary: Get document lineage
      description: >-
        Get the complete processing lineage for a document. Shows the full chain
        of transformations from the root bucket object through all collection
        processing stages.
      operationId: >-
        get_document_lineage_v1_collections__collection_id__documents__document_id__lineage_get
      parameters:
        - name: collection_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the collection containing the document
            title: Collection Id
          description: ID of the collection containing the document
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the document to trace
            title: Document Id
          description: ID of the document to trace
      responses:
        '200':
          description: Document lineage information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentLineageResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
          NamespaceHeader: []
components:
  schemas:
    DocumentLineageResponse:
      properties:
        document_id:
          type: string
          title: Document Id
          description: Document that was traced.
        collection_id:
          type: string
          title: Collection Id
          description: Collection it was traced in.
        lineage:
          anyOf:
            - $ref: '#/components/schemas/DocumentLineage'
            - type: 'null'
          description: >-
            Null when the document carries no lineage, in which case `message`
            says why. Null is not an error and the response is still 200.
        depth:
          type: integer
          title: Depth
          description: >-
            ALWAYS 0 TODAY. Reserved for depth in the decomposition tree,
            pending calculation from lineage_path. Do not read 0 as 'this is a
            root document'.
          default: 0
        total_steps:
          type: integer
          title: Total Steps
          description: >-
            ALWAYS 0 TODAY, for the same reason as `depth`. Do not read 0 as 'no
            processing happened'.
          default: 0
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: >-
            Present only when `lineage` is null, explaining the absence. Absent
            on a successful trace.
          examples:
            - >-
              Document does not have lineage information (created before Phase
              2)
      type: object
      required:
        - document_id
        - collection_id
      title: DocumentLineageResponse
      description: Lineage for one document, or a statement that it has none.
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DocumentLineage:
      properties:
        root_object_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Root Object Id
          description: Object in the originating bucket that this document descends from.
          examples:
            - obj_video123
        root_bucket_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Root Bucket Id
          description: >-
            Bucket the root object lives in. This is the field to compare
            against a bucket the caller selected, to confirm a result came from
            the intended source rather than from another bucket in the
            namespace.
          examples:
            - bkt_marketing
        source_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Type
          description: Whether the immediate source was a bucket or an upstream collection.
          examples:
            - collection
        source_object_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Object Id
          description: Immediate source object, when the source was a bucket.
        source_document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Document Id
          description: Immediate source document, when the source was a collection.
        source_collection_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Collection Id
          description: Immediate source collection, when the source was one.
        lineage_chain:
          items:
            $ref: '#/components/schemas/DocumentLineageStep'
          type: array
          title: Lineage Chain
          description: >-
            ALWAYS EMPTY TODAY. The controller hardcodes it to [] pending
            reconstruction from lineage_path. Typed so the field has a shape,
            and described this way so a caller does not read an empty list as
            'this document had no processing steps'. Use the root_* and source_*
            fields above, which are real.
      type: object
      title: DocumentLineage
      description: >-
        Where a document came from.


        `root_bucket_id` and `root_object_id` are the load-bearing fields and
        are

        populated from the document's own flat lineage fields. They are what
        lets a

        caller confirm a result traces to the bucket a user actually chose.
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    DocumentLineageStep:
      properties:
        collection_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Collection Id
          description: Collection that performed this step.
        feature_extractor_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Feature Extractor Id
          description: Extractor that produced the document at this step.
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
          description: Document produced at this step.
        timestamp:
          anyOf:
            - type: string
            - type: 'null'
          title: Timestamp
          description: When this step ran, ISO 8601.
      type: object
      title: DocumentLineageStep
      description: >-
        One processing hop in a document's history.


        Nothing emits these yet. `DocumentLineage.lineage_chain` is hardcoded to
        an

        empty list in the controller, so this model exists to give that list an

        element type rather than to describe data anyone has seen.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Mixpeek API key, sent as `Authorization: Bearer mxp_sk_...`. Create one
        in Studio under Settings → API Keys, or with an admin key via `POST
        /v1/organizations/users/{user_email}/api-keys`. A missing, malformed,
        unknown, revoked, inactive or expired key returns 401; a key without the
        permission, scope or plan an operation needs returns 403.
    NamespaceHeader:
      type: apiKey
      in: header
      name: X-Namespace
      description: >-
        Namespace id (`ns_...`), not the namespace name. This scopes the request
        rather than authenticating it, and it is required on every operation
        marked `x-mixpeek-namespace-scoped`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.