---
title: "Populate the dataset with records mapped from telemetry spans"
method: POST
path: "/v1/observability/datasets/{dataset_id}/imports/from-spans"
tags: ["beta.observability.datasets"]
---

# Populate the dataset with records mapped from telemetry spans

`POST /v1/observability/datasets/{dataset_id}/imports/from-spans`

## Request

- Base URL: `https://api.mistral.ai`
- URL: `https://api.mistral.ai/v1/observability/datasets/{dataset_id}/imports/from-spans`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/mistral/apis/mistral-ai-api/docs/v1/observability/datasets/:dataset_id/imports/from-spans/post.ts> (a function with typed inputs; its response is checked against the schema)

Starts an asynchronous import of the requested telemetry spans. References not returned by the tenant-scoped telemetry query are skipped without distinguishing absence from access restrictions.

## Path parameters

- `dataset_id` string, required: Dataset UUID or workspace-scoped slug. UUID-shaped values are always interpreted as dataset IDs.

## Request body

- ImportDatasetFromSpansRequest
  - `span_references` TelemetrySpanReference[], required: Spans to attempt to import; unavailable references are skipped, and trace and span IDs are attached as record properties automatically.
    - `trace_id` string, required
    - `span_id` string, required
  - `mapping_contract` SpanDatasetMappingContract, required: Mapping rules applied independently to every requested telemetry span. Version 1 mappings are optional per span: a missing, null, blank-string, or empty-array source omits the target key. JSON object and array strings become structured values; scalar-looking and malformed JSON strings remain strings.
    - `version` 1, required
    - `mappings` SpanDatasetMapping[], required
      - `target_field` string, required: Literal top-level key to create in the dataset record payload.
      - `source_field` SpanDatasetSourceReference, required
        - `namespace` 'span_attributes' | 'resource_attributes', required: Attribute maps that may supply dataset payload values.
        - `key` string, required: Literal attribute dictionary key; dots do not denote a nested path.

## Response `202`

Successful Response

- DatasetImportTask
  - `id` string, uuid, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `deleted_at` string, date-time, nullable, required
  - `creator_id` string, uuid, required
  - `dataset_id` string, uuid, required
  - `workspace_id` string, uuid, required
  - `status` 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELED' | 'TERMINATED' | 'CONTINUED_AS_NEW' | 'TIMED_OUT' | 'UNKNOWN', required
  - `progress` integer, nullable
  - `message` string, nullable
  - `result` DatasetImportResult: Source-agnostic counts for a completed dataset import.
    - `requested_record_count` integer, required
    - `imported_record_count` integer, required
    - `skipped_record_count` integer, required

## Other responses

- `400`: Bad Request - Invalid request parameters or data
- `404`: Not Found - Resource does not exist
- `408`: Request Timeout - Operation timed out
- `409`: Conflict - Resource conflict
- `422`: Unprocessable Entity - Validation error

## Changes

- **2026-10-12** `6c349f3bdef6`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/mistral/apis/mistral-ai-api/changes/v1/observability/datasets/:dataset_id/imports/from-spans/post.md)

---

[API](https://skmtc.dev/mistral/apis/mistral-ai-api.md) - [All operations](https://skmtc.dev/mistral/apis/mistral-ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mistral/apis/mistral-ai-api/revisions/08a585fb75bc?raw)
