---
title: "Create From Logs"
method: POST
path: "/v0/logs/derived"
tags: ["Logs"]
---

# Create From Logs

`POST /v0/logs/derived`

Creates one or more entries based on `body.equation` and `body.referenced_logs`.

When body.derived=True (default):
  Eagerly computes each derived value and stores it in LogEvent.data.

When body.derived=False:
  Computes values and stores them directly in the base logs as regular entries.

The context parameter can be:
- A string: Uses the string as the context name with default values (description=None, is_versioned=False)
- An object: Uses the object's name, description, and is_versioned properties

## Request body

- CreateDerivedEntriesConfig
  - `project_name` string, required — Name of the project the stored entries will be associated to.
  - `context` union — Optional context path to update for the logs. Can use '/' for nested contexts (e.g. 'training/batch1'). Can be a string (which will be interpreted with description=None and is_versioned=False) or a ContextCreateRequest object.
    - ContextCreateRequest — Request model for creating a new context within a project.
      - `name` string, required — Context name, can be nested using '/' (e.g., 'parent/child'). Must contain only alphanumeric characters, underscores, and hyphens.
      - `description` string, nullable — Optional description of the context
      - `is_versioned` boolean — Whether the context should be versioned. If True, the context will be versioned and mutable.
      - `allow_duplicates` boolean — Whether duplicate log entries are allowed in this context. If False, attempts to add duplicate logs will be ignored.
      - `unique_keys` object, nullable — Unique key definition. Keys are column names, values are types ('str', 'int', 'float', 'bool', 'datetime', 'time', 'date', 'timedelta', 'dict', 'list').
      - `auto_counting` object, nullable — Auto-counting configuration. Keys are column names to auto-increment, values are parent counter names (None for independent counters).
      - `foreign_keys` ForeignKeyConfig[], nullable — Foreign key definitions for referential integrity
        - `name` string, required — Column name or path to nested field that references another context. Supports: - Simple column: 'department_id' - Array elements: 'images[*].image_id' - Nested object: 'metadata.user.user_id' - Mixed nesting: 'teams[*].members[*].user_id'
        - `references` string, required — Referenced context and column in format 'ContextName.column_name'
        - `on_delete` 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION' — Action to perform when referenced row is deleted
        - `on_update` 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION' — Action to perform when referenced row is updated
        - `default` unknown
        - `is_nested` boolean, nullable — Auto-set: True if this FK uses a nested path (contains . or [])
        - `path_segments` object[], nullable — Auto-set: Parsed path structure for nested FKs
    - string
  - `key` string, required — The name of the entry.
  - `equation` string, required — The equation for computing the value of each derived entry.
  - `referenced_logs` object, required — The logs to use for each newly created derived entry, either as a list of log ids or as a set of arguments for the get_logs endpoint.
  - `derived` boolean — Whether to create derived logs (True) or static entries in base logs (False).

## Response `200`

Derived log entries created successfully.

- unknown

## Other responses

- `400` — Bad Request
- `404` — Project Not Found
- `422` — Validation Error

---

[API](https://skmtc.net/unify/apis/unifyai-http-api-reference.md) · [All operations](https://skmtc.net/unify/apis/unifyai-http-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/unify/unifyai-http-api-reference/revisions/900377f918b6/schema)
