---
title: "Create a mirror"
method: POST
path: "/channels/{channel_name}/mirrors"
tags: ["channels"]
---

# Create a mirror

`POST /channels/{channel_name}/mirrors`

## Request

- Base URL: `https://api.anaconda.cloud/api`
- URL: `https://api.anaconda.cloud/api/channels/{channel_name}/mirrors`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-Auth`
- TypeScript: <https://skmtc.dev/anaconda/apis/anaconda-server-api/docs/channels/:channel_name/mirrors/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `channel_name` string, required

## Query parameters

- `task_manager_schedule` boolean

## Request body

- MirrorConfiguration: Information about mirroring configuration
  - `mirror_name` string, required: Mirror name
  - `source_root` string, uri, required: The upstream location of the channel to mirror.
  - `mirror_type` 'conda' | 'python_simple' | 'cran' | 'cve' | 'sbom', required: Type of upstream source to mirror
  - `mirror_mode` 'active' | 'passive' | 'redirect', required
  - `cron` string, required: A five-field cron expression indicating the schedule for active synchronization.
  - `proxy` string, uri, nullable: Proxy server URL configuration to use to attain access to upstream source.
  - `filters` object: Filter directives that are specific to each individual mirror type.
    - `subdirs` string[]: Conda specific subdirs. Empty array means include all subdirs
    - `cve_score_threshold` number: Any packages with CVE score higher than that will be filtered out
    - `cve_score_exceptions` string[]: CVE ids that are excluded from cve score threshold
    - `exclude_non_curated_cve` boolean: Omit mirroring files associated to non curated CVEs
    - `exclude_cve_statuses` CVEStatus[]: Omit mirroring files associated to non curated CVEs
    - `dedupe_conda_legacy` boolean: Ignore legacy .tar.bz2 conda packages when .conda is available
    - `projects` string[]: python_simple specific list of projects. empty array means all projects
    - `packages` string[]: CRAN specific list of packages
    - `include_licenses` string[]: List of license familities to look for. Empty array means all licenses
    - `exclude_licenses` string[]: List of license familities to look for. Empty array means all licenses
    - `include_specs` string[]: A list of MatchSpec strings, for including from excluded list General format is (channel(/subdir):(namespace):)name(version(build))[key1=value1,key2=value2]
    - `exclude_specs` string[]: A list of MatchSpec strings, for excluding specific packages. General format is (channel(/subdir):(namespace):)name(version(build))[key1=value1,key2=value2]
    - `only_specs` string[]: A list of MatchSpec strings, for explicit list of artifacts Doesn't work together with licenses and exclude_specs General format is (channel(/subdir):(namespace):)name(version(build))[key1=value1,key2=value2]
    - `include_dependencies` boolean: * If this is true, then dependencies will be mirrored * The value should be True / enabled only if only_specs list is not empty.
    - `date_from` string, date: bottom date YYYY-mm-dd when package published. Conda-only
    - `date_to` string, date: upper date YYYY-mm-dd when package was published. Conda-only
    - `only_signed` boolean: Unsigned packages will be filtered out. Conda-only
  - `run_now` boolean: Does a one-time, immediate, and off-schedule run of the mirroring operation.

## Response `201`

ok

- Mirror: Configured mirror object
  - `mirror_id` string
  - `mirror_name` string: Mirror name
  - `source_root` string, uri: The upstream location of the channel to mirror.
  - `mirror_type` 'conda' | 'python_simple' | 'cran' | 'cve' | 'sbom': Type of upstream source to mirror
  - `mirror_mode` 'active' | 'passive' | 'redirect'
  - `cron` string
  - `proxy` string, uri, nullable: Proxy server URL configuration to use to attain access to upstream source.
  - `filters` object: Filter directives that are specific to each individual artifact type.
  - `state` 'pending' | 'running' | 'completed' | 'failed' | 'deleted' | 'stopping' | 'stopped'
  - `cause` string: Mirror failure cause
  - `sync_state` MirrorSyncState: State of current mirror synchronization
    - `count` object
      - `removed` integer: Number of packages, removed from the channel
      - `passive` integer: Number of passively mirrored packages
      - `active` integer: Number of pulled packages
      - `active_planned` integer: Number of total planned packages for pulling
      - `failed` integer: Number of failed packages to pull
      - `package_stat` object
        - `primary` integer: Number of primary packages listed in only specs mirrored
        - `dependencies` integer: Number of dependencies packages mirrored
      - `mirror_filtered` object
        - `cve` integer: Number of packages removed because of CVE filter
        - `date` integer: Number of packages removed because of date filter
        - `signed` integer: Number of packages removed because of missing signatures
        - `license` integer: Number of packages removed because of license filter
        - `only_specs` integer: Number of packages removed because of "only packages" filter
        - `exclude_specs` integer: Number of packages removed because of exclude/include filter
        - `duplicated_legacy_conda` integer: \ Number of packages removed because of legacy package format and having corresponding .conda package
      - `channel_filtered` object
        - `license` integer
        - `exclude_specs` integer
    - `last_ckey` string
    - `last_exception` string
    - `total_steps_count` integer
    - `current_step_number` integer
    - `current_step_description` string
    - `current_step_percentage` integer
    - `bytes_transfered` integer: Total number of bytes transfered during active mirroring
  - `last_run_at` string
  - `next_run_at` string
  - `created_at` string
  - `updated_at` string

## Other responses

- `400`: Server cannot execute request due to something that is perceived to be a client error
- `401`: Unauthenticated, no token is provided or token is invalid
- `403`: Access is forbidden
- `404`: The specified resource was not found
- `409`: Creating/updating resource raises a conflict
- `500`: Internal server error

---

[API](https://skmtc.dev/anaconda/apis/anaconda-server-api.md) - [All operations](https://skmtc.dev/anaconda/apis/anaconda-server-api/llms.txt) - [OpenAPI document](https://skmtc.dev/anaconda/apis/anaconda-server-api/revisions/6aef0cb7a151?raw)
