---
title: "Join Logs"
method: POST
path: "/v0/logs/join"
tags: ["Logs"]
---

# Join Logs

`POST /v0/logs/join`

Joins two sets of logs based on specified criteria and creates new logs with the joined data.

The join operation is similar to SQL joins, allowing inner, left, right, and outer joins
between two sets of logs filtered by the criteria in pair_of_args.

Args:
    pair_of_args: List of two dictionaries containing filtering criteria for logs to join.
                 Each dictionary can include context, filter_expr, from_ids, etc.
    join_expr: SQL expression for the join condition using aliases A and B
              (e.g., 'A.user_id = B.user_id')
    mode: Type of join to perform ('inner', 'left', 'right', or 'outer')
    new_context: Name for the new context where joined logs will be stored
    columns: Optional list of column names to include in the joined result
    project_name: Name of the project containing the logs

Returns:
    JSON response with info about the join operation

## Request body

- JoinLogsRequest
  - `pair_of_args` object[], required — Two sets of filtering criteria for logs to join
  - `join_expr` string, required — SQL expression for join condition using aliases A and B
  - `mode` string, required — Join type: 'inner', 'left', 'right', or 'outer'
  - `new_context` string, required — Name for the new context where joined logs will be stored
  - `columns` union — Optional column specification for the joined result. Can be either: 1. A dictionary mapping source columns to aliases (only supported when copy=True): {'A.user_id': 'user_identifier', 'B.score': 'user_score'} 2. A list of source columns to include (required format when copy=False): ['A.user_id', 'A.score', 'B.category'] Note: When copy=False (pass-by-reference), aliases are not supported and the original column names will be preserved. Use the list format in this case. If omitted, all columns will be selected and prefixed with 'A_' or 'B_'.
    - object
    - string[]
  - `project_name` string, required — Name of the project
  - `copy` boolean — If True, a copy of each log is created and then added to the context. If False, the existing log associations are simply used. If omitted, defaults to True.

## Response `200`

Logs joined 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)
