{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/latitude-so/json-schema/latitude-so-list-imports-response-schema.json",
  "title": "ListImportsResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/latitude-so-imports-api-openapi.yml#/components/schemas/ListImportsResponse",
  "type": "object",
  "properties": {
    "imports": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Import"
      },
      "description": "The project's imports, newest first."
    }
  },
  "required": [
    "imports"
  ],
  "$defs": {
    "Import": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 24,
          "maxLength": 24,
          "description": "Stable import identifier."
        },
        "organizationId": {
          "type": "string",
          "minLength": 24,
          "maxLength": 24,
          "description": "Organization that owns this import."
        },
        "projectId": {
          "type": "string",
          "minLength": 24,
          "maxLength": 24,
          "description": "Latitude project the traces are imported into."
        },
        "source": {
          "type": "string",
          "enum": [
            "langfuse",
            "langsmith",
            "braintrust"
          ],
          "description": "Observability platform the import reads from."
        },
        "status": {
          "type": "string",
          "enum": [
            "created",
            "queued",
            "running",
            "succeeded",
            "capped",
            "cancelled",
            "failed"
          ],
          "description": "Lifecycle state. `created`/`queued`/`running` are in flight; `succeeded` finished cleanly; `capped` stopped at a ceiling with everything before it kept; `cancelled` and `failed` can be retried."
        },
        "config": {
          "$ref": "#/$defs/ImportConfig"
        },
        "stats": {
          "$ref": "#/$defs/ImportStats"
        },
        "error": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why the import did not finish cleanly, or which ceiling stopped a `capped` one. `status` alone says whether it failed."
        },
        "cancelledAt": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO-8601 timestamp at which cancellation was requested, or `null`."
        },
        "startedAt": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO-8601 timestamp at which a worker picked the import up, or `null`."
        },
        "finishedAt": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO-8601 timestamp at which the import ended, or `null` while in flight."
        },
        "createdAt": {
          "type": "string",
          "description": "ISO-8601 timestamp of creation."
        },
        "updatedAt": {
          "type": "string",
          "description": "ISO-8601 timestamp of the last update."
        }
      },
      "required": [
        "id",
        "organizationId",
        "projectId",
        "source",
        "status",
        "config",
        "stats",
        "error",
        "cancelledAt",
        "startedAt",
        "finishedAt",
        "createdAt",
        "updatedAt"
      ]
    },
    "ImportConfig": {
      "type": "object",
      "properties": {
        "sourceProjectId": {
          "type": "string",
          "description": "Id of the project on the platform the import reads from."
        },
        "sourceProjectName": {
          "type": "string",
          "description": "Name of the platform project, as shown in Latitude."
        },
        "sourceRegion": {
          "type": "string",
          "description": "Platform region the import runs against."
        },
        "rangeFrom": {
          "type": "string",
          "description": "ISO-8601 start of the imported time range (inclusive)."
        },
        "rangeTo": {
          "type": "string",
          "description": "ISO-8601 end of the imported time range (exclusive)."
        },
        "maxTraces": {
          "type": "integer",
          "description": "Most traces this import will bring in, newest first."
        },
        "sessionMetadataKey": {
          "type": [
            "string",
            "null"
          ],
          "description": "LangSmith only: run metadata key that groups traces into sessions. `null` elsewhere."
        }
      },
      "required": [
        "sourceProjectId",
        "sourceProjectName",
        "sourceRegion",
        "rangeFrom",
        "rangeTo",
        "maxTraces",
        "sessionMetadataKey"
      ],
      "description": "What the import was asked to bring in, snapshotted when it was created."
    },
    "ImportStats": {
      "type": "object",
      "properties": {
        "recordsFetched": {
          "type": "integer",
          "description": "Rows read from the platform, including spans later skipped."
        },
        "sessionsImported": {
          "type": "integer",
          "description": "Distinct sessions among the imported traces."
        },
        "tracesImported": {
          "type": "integer",
          "description": "Traces imported. One imported trace bills one credit."
        },
        "spansImported": {
          "type": "integer",
          "description": "Spans written across all imported traces."
        },
        "spansSkipped": {
          "type": "integer",
          "description": "Spans skipped because they carried no usable trace or span id."
        }
      },
      "required": [
        "recordsFetched",
        "sessionsImported",
        "tracesImported",
        "spansImported",
        "spansSkipped"
      ],
      "description": "What the import has brought in so far."
    }
  }
}