> ## 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: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service Unavailable
          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: >-
            Processing steps between the root object and this document: 1 for a
            document made directly from a bucket object, 2 for one made from
            such a document, and so on. Equals total_steps unless an upstream
            document no longer exists, when it also counts the steps the chain
            cannot list. 0 only when the document has no lineage.
          default: 0
        total_steps:
          type: integer
          title: Total Steps
          description: >-
            Number of entries in lineage.lineage_chain. 0 only when the document
            has no lineage.
          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
    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.
        source_row:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Source Row
          description: >-
            For a document imported from a database table: the source row it
            mirrors, as provider, schema, table and primary key (pk), with the
            origin of each vector it carries (model, dimensions, mode). Null for
            a document made from any other object.
          examples:
            - pk:
                id: 42
              provider: postgresql
              schema: public
              table: scenes
              vector_origin:
                embedding:
                  dimensions: 3072
                  mode: carry
                  model: text-embedding-3-large
        lineage_chain:
          items:
            $ref: '#/components/schemas/DocumentLineageStep'
          type: array
          title: Lineage Chain
          description: >-
            Every processing step from the root object to this document, in
            order: the first entry is the document made directly from the root
            object, the last is this document. Each step names its collection,
            extractor, document and time. When an upstream document no longer
            exists the chain starts at the step that names it, and nothing above
            that step is listed.
      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.
    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 step in a document's history: the document one
        collection produced on the way from the root object to the traced one.
  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.