---
title: "Add Logs To Context"
method: POST
path: "/v0/project/{project_name}/contexts/add_logs"
tags: ["Contexts"]
---

# Add Logs To Context

`POST /v0/project/{project_name}/contexts/add_logs`

Adds existing logs to a context within a project. The logs must already exist
in the project and can be specified by their IDs or by log_args criteria.
The same logs can be associated with multiple contexts.

The context_name can be provided as a string or as an object with a name field.
If the context doesn't exist, it will be created automatically.

If copy=True, new copies of the logs will be created and added to the context.
If copy=False (default), the existing logs will be associated with the context.

## Path parameters

- `project_name` string, required — Name of the project to create context in.

## Request body

- AddLogsToContextRequest — Request model for adding existing logs to a context.
  - `context_name` string, required — Name of the context to add logs to.
  - `log_ids` integer[], nullable — List of log IDs to add to the context. At least one log ID must be provided.
  - `log_args` object, nullable — Dictionary of arguments (e.g. filter_expr) to select logs by criteria.
  - `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.

## Response `200`

Successful Response

- unknown

## Other responses

- `404` — Project, Context or Logs 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)
