---
title: "Resolve a file to the job that created it"
method: POST
path: "/lineage"
tags: ["Lineage"]
---

# Resolve a file to the job that created it

`POST /lineage`

## Request

- Base URL: `https://api.varg.ai/v2`
- URL: `https://api.varg.ai/v2/lineage`
- Auth: HTTP bearer

Given a `file_id` or a varg URL, returns the job that produced the file
together with its recipe (prompt, model, tool, cost) — so an agent can
"create something similar". Send `file_id` or `url`; `file_id` wins when
both are present.

## Request body

- union
  - object
    - `file_id` string, required
    - `url` string, uri
  - object
    - `file_id` string
    - `url` string, uri, required

## Response `200`

Lineage

- object
  - `file_id` string, required
  - `job_id` string, required
  - `tool` string, required: Readable tool key (`image`, `video`, ...)
  - `model` string, nullable, required
  - `prompt` string, nullable, required: The main human-readable prompt (prompt, text or render code)
  - `provider` string, nullable, required
  - `cost_cents` integer, nullable, required
  - `parent_job_id` string, nullable, required
  - `root_job_id` string, nullable, required
  - `children_count` integer, required
  - `total_cost_cents` integer, nullable, required: This job plus every descendant
  - `breakdown` object[]: Present only when the job has children
    - `job_id` string
    - `tool` string
    - `model` string, nullable
    - `status` string, nullable
    - `cost_cents` integer
    - `is_root` boolean
  - `output_count` integer, required
  - `output_index` integer, nullable, required: 1-based position among the job's outputs
  - `primary_file_id` string, nullable, required
  - `created_at` string, date-time, required
  - `file` object, required
    - `url` string
    - `media_type` string
    - `size_bytes` integer
    - `width` integer
    - `height` integer
    - `duration_ms` number
  - `input` object, required: The job's input with internal keys (`options`, `webhook_url`, `_*`) removed

## Other responses

- `400`: Invalid JSON (`invalid_json`), or neither `file_id` nor `url` given (`missing_input`)
- `401`: Missing or invalid API key / JWT
- `404`: File not found (`file_not_found`), or no job linked to it (`no_lineage`)

## Changes

- **2026-10-20** `43bcf5ea398d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/varg/apis/varg-api/changes/lineage/post.md)

---

[API](https://skmtc.dev/varg/apis/varg-api.md) · [All operations](https://skmtc.dev/varg/apis/varg-api/llms.txt) · [OpenAPI document](https://skmtc.dev/varg/apis/varg-api/revisions/09d49a6d852f?raw)
