{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/latitude-so/json-schema/latitude-so-create-import-body-schema.json",
  "title": "CreateImportBody",
  "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/CreateImportBody",
  "type": "object",
  "properties": {
    "credentials": {
      "$ref": "#/$defs/ImportCredentials"
    },
    "sourceProjectId": {
      "type": "string",
      "minLength": 1,
      "description": "Id of the project on the platform to read from."
    },
    "sourceProjectName": {
      "type": "string",
      "minLength": 1,
      "description": "Name of the platform project, shown in Latitude. Defaults to `sourceProjectId`."
    },
    "rangeFrom": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 start of the range to import. Defaults to 90 days before `rangeTo`, bounded by the plan's retention."
    },
    "rangeTo": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 end of the range to import. Defaults to now."
    },
    "maxTraces": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100000,
      "description": "Most traces to import, newest first. Each imported trace bills one credit. Defaults to the maximum, 100,000."
    },
    "sessionMetadataKey": {
      "type": "string",
      "description": "LangSmith only: run metadata key that groups traces into sessions. Defaults to `thread_id`."
    }
  },
  "required": [
    "credentials",
    "sourceProjectId"
  ],
  "$defs": {
    "BraintrustImportCredentials": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "braintrust"
          ],
          "description": "Marks these as Braintrust credentials."
        },
        "region": {
          "type": "string",
          "enum": [
            "eu",
            "us"
          ],
          "description": "Braintrust data plane the organization lives on."
        },
        "apiKey": {
          "type": "string",
          "minLength": 1,
          "description": "Braintrust API key with read access to the project."
        }
      },
      "required": [
        "kind",
        "region",
        "apiKey"
      ]
    },
    "ImportCredentials": {
      "oneOf": [
        {
          "$ref": "#/$defs/LangfuseImportCredentials"
        },
        {
          "$ref": "#/$defs/LangsmithImportCredentials"
        },
        {
          "$ref": "#/$defs/BraintrustImportCredentials"
        }
      ],
      "description": "Credentials for the platform to import from; `kind` names the platform. Not stored after the import ends."
    },
    "LangfuseImportCredentials": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "langfuse"
          ],
          "description": "Marks these as Langfuse credentials."
        },
        "region": {
          "type": "string",
          "enum": [
            "eu",
            "us",
            "jp",
            "hipaa-us"
          ],
          "description": "Langfuse Cloud region the account lives in."
        },
        "publicKey": {
          "type": "string",
          "minLength": 1,
          "description": "Langfuse project public key (`pk-lf-…`)."
        },
        "secretKey": {
          "type": "string",
          "minLength": 1,
          "description": "Langfuse project secret key (`sk-lf-…`)."
        }
      },
      "required": [
        "kind",
        "region",
        "publicKey",
        "secretKey"
      ]
    },
    "LangsmithImportCredentials": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "langsmith"
          ],
          "description": "Marks these as LangSmith credentials."
        },
        "region": {
          "type": "string",
          "enum": [
            "gcp-eu",
            "gcp-us",
            "gcp-apac",
            "aws-us"
          ],
          "description": "LangSmith region the account lives in."
        },
        "apiKey": {
          "type": "string",
          "minLength": 1,
          "description": "LangSmith API key (`lsv2_pt_…`)."
        },
        "workspaceId": {
          "type": "string",
          "description": "Workspace to import from, for accounts with more than one. Omit to use the key's default workspace."
        }
      },
      "required": [
        "kind",
        "region",
        "apiKey"
      ]
    }
  }
}