> ## Documentation Index
> Fetch the complete documentation index at: https://docs.weflayr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Import past data

> Import past calls, one object per call.

Import calls you made before logging them, so a benchmark can replay them. Leave out what is not a model call, such as tracing spans with no model or no token usage. The calls are checked like the rows of the dashboard's [CSV import](https://docs.weflayr.com/product/import-past-calls.md): when one call is refused, nothing is imported. Each call is stored like a logged call. Send a larger export in requests of at most 1,000 calls and 2.5 MB each: a single call above 2.5 MB cannot be imported. The calls appear in [Get calls](https://docs.weflayr.com/api/management/get-calls.md) within a minute: then create a benchmark of their call names with [Set benchmark](https://docs.weflayr.com/api/management/set-benchmark.md).

## Parameters

Passed in the request body.

**calls** `object[]` *required*

The past calls, one object per call. Up to 1,000 per request, in a request body of at most 2.5 MB.

**call**

**call\_name** `string` *required*

The call it belongs to, such as `draft-reply`.

**input** `object` *required*

The request the call sent to the model, as JSON, in the OpenAI Chat Completions format: its messages, the tools the model could call, the parameters it set (temperature, max\_tokens, top\_p, stop, seed, reasoning\_effort...) and, for a structured output, its response\_format. A call that makes tool calls is refused without its tools. A call setting nothing but its messages can hold just the list of messages. For example: `{"messages": [{"role": "system", "content": "..."}, {"role": "user", "content": "..."}], "tools": [{"type": "function", "function": {"name": "xxx", "description": "...", "parameters": {"type": "object", "properties": {}}}}], "temperature": 0.2, "max_tokens": 1000}`.

**output** `object`

The answer the model gave, as JSON: an assistant message in the OpenAI Chat Completions format, or a string. Candidates are judged against it. For example: `{"role": "assistant", "content": "...", "tool_calls": [{"id": "xx", "type": "function", "function": {"name": "xxx", "arguments": "{}"}}]}`.

**timestamp** `string` *required*

When the call was made, in ISO 8601, such as `2026-09-24T14:05:00Z`. A time without a timezone is read as UTC.

**model\_name** `string` *required*

The model that answered, such as `gpt-6-luna`, or its provider and model, such as `google/gemini-3.8-flash`, in which case `provider` is not read.

**provider** `string`

The provider the call was sent to, such as `openai`, `anthropic`, `bedrock`, `vertex` or `azure`: the call is priced at that provider's price. Left empty, the provider is read from the model name, at the price of the company that makes the model.

**input\_tokens** `integer` *required*

The number of input tokens, cached ones included. The call's cost is computed from it.

**output\_tokens** `integer` *required*

The number of output tokens, reasoning included. The call's cost is computed from it.

**customer\_name** `string`

The customer the call was made for.

**run\_tags** `object`

Tags to filter the calls by, as an object of names and values.

`blockers` in the response lists, in plain words, what prevents the usual next step. It is empty when nothing does.

```python Python theme={null}
import weflayr
from weflayr.openapi.models import ImportPastDataInput

client = weflayr.client()  # reads WEFLAYR_API_KEY

client.import_past_data(body=ImportPastDataInput.from_dict({
    "calls": [
        {
            "call_name": "summarize_profile",
            "input": {
                "messages": [
                    {
                        "role": "user",
                        "content": "Summarize this profile.",
                    },
                ],
            },
            "output": {
                "role": "assistant",
                "content": "A senior engineer.",
            },
            "timestamp": "2026-09-24T14:05:00Z",
            "model_name": "claude-sonnet-5-5",
            "input_tokens": 120,
            "output_tokens": 18,
        },
    ],
}))
```

```js Node.js theme={null}
const weflayr = require('weflayr');

const client = weflayr.client(); // reads WEFLAYR_API_KEY

await weflayr.api.importPastData({
  client,
  throwOnError: true,
  body: {
    calls: [
      {
        callName: 'summarize_profile',
        input: {
          messages: [
            {
              role: 'user',
              content: 'Summarize this profile.',
            },
          ],
        },
        output: {
          role: 'assistant',
          content: 'A senior engineer.',
        },
        timestamp: '2026-09-24T14:05:00Z',
        modelName: 'claude-sonnet-5-5',
        inputTokens: 120,
        outputTokens: 18,
      },
    ],
  },
});
```

```bash cURL theme={null}
curl -X POST https://app.weflayr.com/api/past-data-imports/ \
  -H "Authorization: Bearer $WEFLAYR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "calls": [
      {
        "call_name": "summarize_profile",
        "input": {
          "messages": [
            {
              "role": "user",
              "content": "Summarize this profile."
            }
          ]
        },
        "output": {
          "role": "assistant",
          "content": "A senior engineer."
        },
        "timestamp": "2026-09-24T14:05:00Z",
        "model_name": "claude-sonnet-5-5",
        "input_tokens": 120,
        "output_tokens": 18
      }
    ]
  }'
```

```json 200 theme={null}
{
  "imported_call_count": 1,
  "skipped_row_count": 0,
  "blockers": []
}
```

```json 401 theme={null}
{"error": "Invalid or missing API key. Send it as \"Authorization: Bearer <your key>\"."}
```

```json 400 theme={null}
{"error": "Row 1: Timestamp 'yesterday' is not an ISO 8601 date and time. Row 1 is the first call. Fix the calls and send them again: nothing was imported.", "code": "invalid_past_data_rows"}
```

```json 422 theme={null}
{"error": "Invalid request payload.", "detail": [{"field": "calls", "error": "Field required"}]}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.