POST
/
v0
/
logs
/
join
curl --request POST \
  --url 'https://api.unify.ai/v0/logs/join' \
  --header "Authorization: Bearer $UNIFY_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "pair_of_args": [
        {
            "context": "context_a",
            "filter_expr": "user_id == 1"
        },
        {
            "context": "context_b",
            "filter_expr": "user_id == 2"
        }
    ],
    "join_expr": "A.user_id == B.user_id",
    "mode": "inner",
    "new_context": "Derived/A_B",
    "columns": [
        "A.user_id",
        "B.score"
    ]
}'
{
    "info": "Joined logs created successfully!"
}

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 of the project containing the logs

Returns: JSON response with info about the join operation

Authorizations

Authorization
string
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

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
array | null

Optional list of columns to include in the result

project
string
required

Name of the project

curl --request POST \
  --url 'https://api.unify.ai/v0/logs/join' \
  --header "Authorization: Bearer $UNIFY_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "pair_of_args": [
        {
            "context": "context_a",
            "filter_expr": "user_id == 1"
        },
        {
            "context": "context_b",
            "filter_expr": "user_id == 2"
        }
    ],
    "join_expr": "A.user_id == B.user_id",
    "mode": "inner",
    "new_context": "Derived/A_B",
    "columns": [
        "A.user_id",
        "B.score"
    ]
}'
{
    "info": "Joined logs created successfully!"
}