# ClickHouse

> For AI agents: the complete documentation index is at https://buddy.works/llms.txt

`PATCH /workspaces/:workspace/targets/:target_id`

Update ClickHouse target configuration

**Required Scopes:** `TARGET_WRITE`

## URL Parameters

```typescript
interface URLParameters {
  /** The human-readable ID of the workspace */
  workspace: string; // Example: "my-company"
  /** Target unique identifier (hash ID) */
  target_id: string; // Example: "tgt-1234567890abcdef"
}
```

## Body Parameters

```typescript
interface BodyParameters {
  /** The type of the target */
  type?: "CLICKHOUSE";
  /** The ID of the target */
  id?: string;
  /** A human-readable ID.  Alphanumeric characters, underscores, and hyphens (hyphens cannot appear at the start or end). */
  identifier: string;
  /** The name of the target */
  name?: string;
  /** Short representation of a project */
  project?: ShortProjectView;
  /** Short representation of a pipeline */
  pipeline?: ShortPipelineView;
  environment?: ShortEnvironmentView;
  /** Access permissions configuration */
  permissions?: PermissionsView;
  /** Pipelines access level for this target */
  pipelines_access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
  /** List of specific pipelines allowed to use this target */
  allowed_pipelines?: AllowedPipelineView[];
  /** Sandboxes access level for this target */
  sandboxes_access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
  /** List of specific sandboxes allowed to use this target */
  allowed_sandboxes?: AllowedSandboxView[];
  /** List of environments whose sandboxes are allowed to use this target. A rule for a specific sandbox takes precedence over an environment rule. */
  allowed_environments?: AllowedEnvironmentView[];
  /** Indicates if this target is disabled (default: `false`) */
  disabled?: boolean;
  /** The list of tags associated with the target */
  tags?: string[];
  /** Defines how the target can be used (as deployment target, proxy, or both) */
  use_as?: UseAsView;
  /** Note for this resource */
  note?: string;
  /** YAML note for AI agents operating on this resource */
  agent_note?: string;
  /** The hostname or IP address of the ClickHouse server */
  host: string;
  /** The native protocol port of the ClickHouse server. Default: `9000` */
  port?: string;
  /** The default database name */
  database?: string;
  /** Whether to use a TLS-secured native protocol connection. Default: `false` */
  secure?: boolean;
  /** ClickHouse authentication credentials */
  auth: ClickhouseAuthView;
  /** SSH proxy target for tunneling to private ClickHouse servers */
  proxy?: TargetK8sProxyView;
}
```

## Response Body

```typescript
interface ResponseBody {
  /** The type of the target */
  type?: "CLICKHOUSE";
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  /** The ID of the target */
  id?: string;
  /** A human-readable ID.  Alphanumeric characters, underscores, and hyphens (hyphens cannot appear at the start or end). */
  identifier: string;
  /** The name of the target */
  name?: string;
  /** Short representation of a project */
  project?: ShortProjectView;
  /** Short representation of a pipeline */
  pipeline?: ShortPipelineView;
  environment?: ShortEnvironmentView;
  /** Access permissions configuration */
  permissions?: PermissionsView;
  /** Pipelines access level for this target */
  pipelines_access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
  /** List of specific pipelines allowed to use this target */
  allowed_pipelines?: AllowedPipelineView[];
  /** Sandboxes access level for this target */
  sandboxes_access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
  /** List of specific sandboxes allowed to use this target */
  allowed_sandboxes?: AllowedSandboxView[];
  /** List of environments whose sandboxes are allowed to use this target. A rule for a specific sandbox takes precedence over an environment rule. */
  allowed_environments?: AllowedEnvironmentView[];
  /** Indicates if this target is disabled (default: `false`) */
  disabled?: boolean;
  /** The list of tags associated with the target */
  tags?: string[];
  /** Defines how the target can be used (as deployment target, proxy, or both) */
  use_as?: UseAsView;
  /** Note for this resource */
  note?: string;
  /** YAML note for AI agents operating on this resource */
  agent_note?: string;
  /** The hostname or IP address of the ClickHouse server */
  host: string;
  /** The native protocol port of the ClickHouse server. Default: `9000` */
  port?: string;
  /** The default database name */
  database?: string;
  /** Whether to use a TLS-secured native protocol connection. Default: `false` */
  secure?: boolean;
  /** ClickHouse authentication credentials */
  auth: ClickhouseAuthView;
  /** SSH proxy target for tunneling to private ClickHouse servers */
  proxy?: TargetK8sProxyView;
}
```

## Type Definitions

```typescript
interface ShortProjectView {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  /** The human-readable ID of the project */
  name?: string;
  /** The Name of the project */
  display_name: string;
  /** The status of the project */
  status?: string;
  /** Indicates if this is a public project */
  access?: "PRIVATE" | "PUBLIC";
  /** The creation date of the project */
  create_date?: string;
}

interface ShortPipelineView {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  /** The unique ID of the pipeline */
  id?: number;
  /** A human-readable ID of pipeline */
  identifier?: string;
  /** The name of the pipeline */
  name?: string;
  /** The source of the pipeline definition */
  definition_source?: "LOCAL" | "REMOTE";
  /** The git configuration reference type */
  git_config_ref?: "NONE" | "DYNAMIC" | "FIXED";
  /** Pipeline git context refs. If unset and events is empty, the pipeline counts as codeless */
  refs?: string[];
  /** The list of events that trigger the pipeline run */
  events?: PipelineEventView[];
  /** Names of the variables to loop over (`REGION`, not `$REGION` and not a value). The pipeline runs once for each item of the value, and once for each combination of items when several variables are listed. The variable value is split into items by new lines, or by commas when it has no new lines (a single-line JSON object or `key=value` pairs stays one item). An item that is a JSON object or `key=value` pairs also sets one variable per key, named `<VARIABLE>_<key>`; an item that starts with `EXTRACT:` sets them as plain `<key>`. */
  loop?: string[];
  /** The priority of the pipeline */
  priority?: "LOW" | "NORMAL" | "HIGH";
  /** Indicates if the pipeline is disabled */
  disabled?: boolean;
  /** The reason why the pipeline is disabled */
  disabled_reason?: string;
  /** The status of the last run */
  last_execution_status?: "INPROGRESS" | "ENQUEUED" | "TERMINATED" | "SUCCESSFUL" | "FAILED" | "INITIAL" | "NOT_EXECUTED" | "SKIPPED" | "TERMINATING" | "WAITING_FOR_APPLY" | "WAITING_FOR_VARIABLES" | "WAITING_FOR_SETTABLE_VARIABLES" | "WAITING_FOR_VT_SESSION";
  /** The git revision of the last run */
  last_execution_revision?: string;
  /** The URL to the target site after deployment */
  target_site_url?: string;
  /** The template for commit status messages */
  execution_message_template?: string;
  /** The creation date of the pipeline */
  create_date?: string;
  /** Defines whether to upload everything from scratch on every run */
  always_from_scratch?: boolean;
  /** If set to true, the status of a given pipeline will not impact the project status on the dashboard */
  ignore_fail_on_project_status?: boolean;
  /** Which queued runs to skip when a new run starts: NEVER, ALWAYS, SAME_REF, SAME_ENVIRONMENT or SAME_ARTIFACT */
  skip_queued_runs?: "NEVER" | "ALWAYS" | "SAME_REF" | "SAME_ENVIRONMENT" | "SAME_ARTIFACT";
  /** Which in-progress runs to cancel when a new run starts: NEVER, ALWAYS, SAME_REF, SAME_ENVIRONMENT or SAME_ARTIFACT */
  cancel_inprogress_runs?: "NEVER" | "ALWAYS" | "SAME_REF" | "SAME_ENVIRONMENT" | "SAME_ARTIFACT";
  /** Defines whether to automatically clear cache before running the pipeline */
  auto_clear_cache?: boolean;
  /** Indicates if the pipeline is paused */
  paused?: boolean;
  /** Defines how many repeated failures are required to pause the pipeline */
  pause_on_repeated_failures?: number;
  /** If set to true, all refs will be fetched from the repository */
  fetch_all_refs?: boolean;
  /** If set to true, LFS files will be fetched from the external repository during pipeline runs */
  fetch_lfs?: boolean;
  /** If set to true, the pipeline will fail on environment preparation warnings */
  fail_on_prepare_env_warning?: boolean;
  /** Defines whether the pipeline can be run concurrently */
  concurrent_pipeline_runs?: boolean;
  /** Defines the depth of the git clone operation for shallow clones */
  clone_depth?: number;
  /** If set to true, commit statuses will not be created in the repository */
  do_not_create_commit_status?: boolean;
  /** Indicates that pipeline definition was probably removed on particular Git ref and pipeline won't be run on events */
  stale?: boolean;
  /** Indicates if the pipeline is waiting for the first push to the repository */
  waiting_for_push?: boolean;
  /** The resource configuration for the pipeline run */
  resources?: "DEFAULT" | "NANO" | "SMALL" | "MEDIUM" | "LARGE" | "XLARGE" | "CUSTOM" | "X2LARGE";
  /** The path to the remote pipeline definition file */
  remote_path?: string;
  /** The ref of the remote pipeline definition */
  remote_ref?: string;
  /** The project name of the remote pipeline definition */
  remote_project_name?: string;
  /** The parameters passed to the remote pipeline definition */
  remote_parameters?: PipelinePropertyView[];
  /** YAML pipeline definition configuration */
  git_config?: YamlDefinitionView;
  /** The list of tags associated with the pipeline for organization */
  tags?: string[];
  /** The base for git changeset calculation. Determines which changes trigger the pipeline */
  git_changeset_base?: "LATEST_RUN" | "LATEST_RUN_MATCHING_REF" | "PULL_REQUEST";
  /** The base for filesystem changeset calculation. Determines which file changes trigger the pipeline */
  filesystem_changeset_base?: "DATE_MODIFIED" | "CONTENTS";
  /** The CPU architecture for the pipeline run */
  cpu?: "X64" | "ARM" | "X86";
  /** If set to true, a description is required when executing the pipeline manually */
  description_required?: boolean;
  /** The folder name where the pipeline is organized */
  folder?: string;
  /** Note for this resource */
  note?: string;
  /** YAML note for AI agents operating on this resource */
  agent_note?: string;
}

interface PipelineEventView {
  /** The type of event that triggers the pipeline */
  type?: "PUSH" | "CREATE_REF" | "DELETE_REF" | "PULL_REQUEST" | "SCHEDULE" | "PUBLISH_ARTIFACT_VERSION" | "DELETE_ARTIFACT_VERSION" | "WEBHOOK" | "EMAIL" | "CREATE_ARTIFACT_VERSION" | "ENVIRONMENT_CREATE" | "ENVIRONMENT_DELETE" | "SANDBOX_CREATED" | "SANDBOX_DELETED" | "SANDBOX_TIMED_OUT" | "SENTRY" | "CLICKUP" | "UT_SESSION_ENDED";
  /** The list of refs (branches/tags) that trigger the pipeline for push/ref events */
  refs?: string[];
  /** The list of pull request events that trigger the pipeline. The accepted values depend on the repository provider, each provider uses its own native event types. For Buddy-hosted repositories the supported (and validated) types are: `OPENED`, `REOPENED`, `SYNCHRONIZED`, `CLOSED`, `MERGED`, `READY_FOR_REVIEW`. For repositories integrated with an external provider (e.g. GitHub) the provider's native events are taken as-is and are not validated, e.g. `opened`, `reopened`, `synchronize` */
  events?: string[];
  /** The list of branches for pull request events; for type `UT_SESSION_ENDED` it filters by the session branch (wildcards supported), empty means all branches */
  branches?: string[];
  /** The list of artifacts that trigger the pipeline */
  artifacts?: PipelineArtifactContextView[];
  /** The list of environments that trigger the pipeline */
  environments?: PipelineEnvironmentContextView[];
  /** The start date for scheduled events (type `SCHEDULE`) */
  start_date?: string;
  /** The delay in minutes between scheduled runs (type `SCHEDULE`) */
  delay?: number;
  /** The cron expression for scheduled (type `SCHEDULE`) events e.g., '0 9 * * 1-5' for weekdays at 9 AM */
  cron?: string;
  /** The timezone for scheduled events (type `SCHEDULE`) e.g., 'UTC', 'Europe/Warsaw' */
  timezone?: string;
  /** Whether TOTP (Time-based One-Time Password) is enabled for webhook events (type `WEBHOOK`) */
  totp?: boolean;
  /** The email subject prefix for email trigger events (type `EMAIL`) */
  prefix?: string;
  /** The list of allowed email addresses that can trigger the pipeline via email (type `EMAIL`) */
  whitelist?: string[];
  /** The list of sandbox targets that trigger the pipeline for sandbox events (type `SANDBOX_CREATED`, `SANDBOX_DELETED`, `SANDBOX_TIMED_OUT`) */
  targets?: TargetView[];
  /** The identifier of the Sentry integration whose webhooks trigger the pipeline (type `SENTRY`) */
  integration?: string;
  /** The list of Sentry project slugs that trigger the pipeline; empty means all projects (type `SENTRY`) */
  projects?: string[];
  /** The list of Sentry issue levels that trigger the pipeline e.g., `error`, `fatal`; empty means all levels (type `SENTRY`) */
  levels?: string[];
  /** The list of Sentry issue substatuses that trigger the pipeline e.g., `new`, `regressed`; empty means all substatuses (type `SENTRY`) */
  substatuses?: string[];
  /** The minimum number of events in the Sentry issue required to trigger the pipeline (type `SENTRY`) */
  count?: number;
  /** The minimum number of users affected by the Sentry issue required to trigger the pipeline (type `SENTRY`) */
  user_count?: number;
  /** The number of minutes to skip subsequent runs for the same Sentry issue after a triggered run (type `SENTRY`) */
  snooze_minutes?: number;
  /** The list of ClickUp folder names that trigger the pipeline; empty means all folders (type `CLICKUP`) */
  folders?: string[];
  /** The list of ClickUp list names that trigger the pipeline; empty means all lists (type `CLICKUP`) */
  lists?: string[];
  /** The list of ClickUp task priorities that trigger the pipeline e.g., `urgent`, `high`; empty means all priorities (type `CLICKUP`) */
  priorities?: string[];
  /** The list of ClickUp task tags that trigger the pipeline; matches when at least one tag is present; empty means all tags (type `CLICKUP`) */
  tags?: string[];
  /** The list of assignee email addresses that trigger the pipeline; matches when at least one assignee has a listed email; empty means all assignees (type `CLICKUP`) */
  assignees?: string[];
  /** The list of creator email addresses that trigger the pipeline; matches when the task creator has a listed email; empty means all creators (type `CLICKUP`) */
  creators?: string[];
  /** The list of custom field filters; each entry has a `name` and a list of `values` (matches when a value matches); entries are combined with AND (type `CLICKUP`) */
  custom_fields?: ClickUpCustomFieldFilter[];
  /** Whether to include subtasks; `true` (default) matches parent tasks and subtasks, `false` matches only top-level tasks (type `CLICKUP`) */
  include_subtasks?: boolean;
  /** The list of unit test suite identifiers (wildcards supported, e.g. `integration-*`) that trigger the pipeline; empty means all suites (type `UT_SESSION_ENDED`) */
  suites?: string[];
  /** The list of statuses that trigger the pipeline (type `SENTRY`, `UT_SESSION_ENDED`) */
  statuses?: string[];
}

interface PipelineArtifactContextView {
  /** A human-readable ID of artifact */
  identifier?: string;
  /** The scope of the artifact */
  scope?: "WORKSPACE" | "PROJECT" | "ENVIRONMENT" | "ANY";
}

interface PipelineEnvironmentContextView {
  /** A human-readable ID of the environment. Alphanumeric characters, underscores, and hyphens (hyphens cannot appear at the start or end). */
  identifier?: string;
  /** The list of tags associated with the environment */
  tags?: string[];
  /** The scope of the environment */
  scope?: "PROJECT" | "WORKSPACE" | "ANY";
}

interface TargetView {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  /** The ID of the target */
  id?: string;
  /** A human-readable ID.  Alphanumeric characters, underscores, and hyphens (hyphens cannot appear at the start or end). */
  identifier: string;
  /** The name of the target */
  name?: string;
  /** Short representation of a project */
  project?: ShortProjectView;
  /** Short representation of a pipeline */
  pipeline?: ShortPipelineView;
  environment?: ShortEnvironmentView;
  /** Access permissions configuration */
  permissions?: PermissionsView;
  /** Pipelines access level for this target */
  pipelines_access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
  /** List of specific pipelines allowed to use this target */
  allowed_pipelines?: AllowedPipelineView[];
  /** Sandboxes access level for this target */
  sandboxes_access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
  /** List of specific sandboxes allowed to use this target */
  allowed_sandboxes?: AllowedSandboxView[];
  /** List of environments whose sandboxes are allowed to use this target. A rule for a specific sandbox takes precedence over an environment rule. */
  allowed_environments?: AllowedEnvironmentView[];
  /** Indicates if this target is disabled (default: `false`) */
  disabled?: boolean;
  /** The list of tags associated with the target */
  tags?: string[];
  /** Defines how the target can be used (as deployment target, proxy, or both) */
  use_as?: UseAsView;
  /** Note for this resource */
  note?: string;
  /** YAML note for AI agents operating on this resource */
  agent_note?: string;
  /** The type of the target */
  type?: "SSH" | "FTP" | "GIT" | "MATCH" | "EC2" | "DIGITAL_OCEAN" | "VULTR" | "UPCLOUD" | "GKE" | "EKS" | "AKS" | "DOKS" | "K8S_CLUSTER" | "MYSQL" | "POSTGRESQL" | "PROJECT_REPO" | "MONGO" | "MSSQL" | "RDS_MSSQL" | "CLICKHOUSE" | "RDS_MYSQL" | "RDS_POSTGRESQL" | "SANDBOX";
}

interface ShortEnvironmentView {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  /** The ID of the environment */
  id?: string;
  /** The name of the environment */
  name?: string;
  /** A human-readable ID of the environment. Alphanumeric characters, underscores, and hyphens (hyphens cannot appear at the start or end). */
  identifier?: string;
  /** The list of tags associated with the environment */
  tags?: string[];
  /** The scope of the environment */
  scope?: "PROJECT" | "WORKSPACE";
}

interface PermissionsView {
  /** Access level for other workspace members */
  others?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
  /** List of specific users with their access levels */
  users?: UserPermissionView[];
  /** List of user groups with their access levels */
  groups?: GroupPermissionView[];
}

interface UserPermissionView {
  /** The ID of the user */
  id?: number;
  /** The access level for the user */
  access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
}

interface GroupPermissionView {
  /** The ID of the group */
  id?: number;
  /** The access level for the group */
  access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
}

interface AllowedPipelineView {
  /** Project name */
  project: string;
  /** Pipeline identifier */
  pipeline: string;
  /** Access level for the allowed pipeline. Project repository targets: `DENIED`, `READ_ONLY`, `READ_WRITE`. Other targets: `DENIED`, `USE_ONLY` */
  access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
}

interface AllowedSandboxView {
  /** Project name */
  project: string;
  /** Sandbox identifier */
  sandbox: string;
  /** Access level for the allowed sandbox: `DENIED`, `READ_ONLY`, `READ_WRITE` */
  access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
}

interface AllowedEnvironmentView {
  /** The project name that contains the environment. Only environments of the repository's project reach it; an entry without a project never matches. */
  project?: string;
  /** Environment identifier */
  environment: string;
  /** Access level for sandboxes in the allowed environment: `DENIED`, `READ_ONLY`, `READ_WRITE` */
  access_level?: "DENIED" | "READ_ONLY" | "USE_ONLY" | "BLIND" | "RUN_ONLY" | "READ_WRITE" | "MANAGE" | "DEFAULT" | "ALLOWED" | "STAGE" | "COMMIT";
}

interface UseAsView {
  /** Whether the target can be used as a deployment target (default: `true`) */
  target?: boolean;
  /** Whether the target can be used as a proxy (default: `true`) */
  proxy?: boolean;
}

interface ClickUpCustomFieldFilter {
  /** The name of the ClickUp custom field to match */
  name?: string;
  /** The list of accepted values of the custom field; matches when at least one value matches; empty means any value */
  values?: string[];
}

interface PipelinePropertyView {
  /** The key of the pipeline property */
  key?: string;
  /** The value of the pipeline property */
  value?: string;
}

interface YamlDefinitionView {
  /** The file path to the YAML definition */
  path?: string;
  /** The git ref (branch/tag) where the YAML definition is located */
  branch?: string;
  /** The project name where the YAML definition is located */
  project?: string;
}

interface ClickhouseAuthView {
  /** Authentication method. Default: `PASSWORD` */
  method?: "PASSWORD";
  /** The ClickHouse username */
  username: string;
  /** The ClickHouse password */
  password: string;
}

interface TargetK8sProxyView {
  /** Identifier of a target with a tunnel to route K8s API traffic through */
  name?: string;
}

```

## Request Example

```bash
curl -X PATCH "https://api.buddy.works/workspaces/:workspace/targets/:target_id" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "CLICKHOUSE",
  "identifier": "production-clickhouse",
  "name": "Production ClickHouse",
  "host": "clickhouse.example.com",
  "port": "9000",
  "database": "myapp",
  "secure": false,
  "auth": {
    "method": "PASSWORD",
    "username": "deploy_user",
    "password": "secured"
  },
  "tags": [
    "clickhouse",
    "production"
  ]
}'
```

## Response Example

**Status:** `200 OK`


---
Original source: https://buddy.works/docs/api/targets/edit/clickhouse