---
title: "Update Code Repository"
method: PUT
path: "/api/v1/code_repositories/{code_repository_id}"
tags: ["code_repositories"]
---

# Update Code Repository

`PUT /api/v1/code_repositories/{code_repository_id}`

Updates a code repository.

Args:
    code_repository_id: The ID of the code repository to update.
    update: The model containing the attributes to update.

Returns:
    The updated code repository object.

## Path parameters

- `code_repository_id` string, uuid, required

## Request body

- CodeRepositoryUpdate — Update model for code repositories.
  - `name` string, nullable
  - `config` object, nullable — Configuration for the code repository.
  - `source` Source — Source specification. A source specifies a module name as well as an optional attribute of that module. These values can be used to import the module and get the value of the attribute inside the module. Example: The source `Source(module="zenml.config.source", attribute="Source")` references the class that this docstring is describing. This class is defined in the `zenml.config.source` module and the name of the attribute is the class name `Source`. Attributes: module: The module name. attribute: Optional name of the attribute inside the module. type: The type of the source.
    - `module` string, required
    - `attribute` string, nullable
    - `type` 'user' | 'builtin' | 'internal' | 'distribution_package' | 'code_repository' | 'notebook' | 'unknown', required — Enum representing different types of sources.
  - `logo_url` string, nullable — Optional URL of a logo (png, jpg or svg) for the code repository.
  - `description` string, nullable — Code repository description.

## Response `200`

Successful Response

- CodeRepositoryResponse — Response model for code repositories.
  - `body` CodeRepositoryResponseBody — Response body for code repositories.
    - `created` string, date-time, required
    - `updated` string, date-time, required
    - `user` UserResponse — Response model for user and service accounts. This returns the activation_token that is required for the user-invitation-flow of the frontend. The email is returned optionally as well for use by the analytics on the client-side.
      - `body` UserResponseBody — Response body for users.
        - `created` string, date-time, required
        - `updated` string, date-time, required
        - `active` boolean
        - `activation_token` string, nullable
        - `full_name` string
        - `email_opted_in` boolean, nullable — `null` if not answered, `true` if agreed, `false` if skipped.
        - `is_service_account` boolean, required
        - `is_admin` boolean, required
      - `metadata` UserResponseMetadata — Response metadata for users.
        - `email` string, nullable
        - `external_user_id` string, uuid, nullable
        - `user_metadata` object
      - `resources` UserResponseResources — Class for all resource models associated with the user entity.
      - `id` string, uuid, required
      - `permission_denied` boolean
      - `name` string, required
    - `source` Source, required — Source specification. A source specifies a module name as well as an optional attribute of that module. These values can be used to import the module and get the value of the attribute inside the module. Example: The source `Source(module="zenml.config.source", attribute="Source")` references the class that this docstring is describing. This class is defined in the `zenml.config.source` module and the name of the attribute is the class name `Source`. Attributes: module: The module name. attribute: Optional name of the attribute inside the module. type: The type of the source.
      - `module` string, required
      - `attribute` string, nullable
      - `type` 'user' | 'builtin' | 'internal' | 'distribution_package' | 'code_repository' | 'notebook' | 'unknown', required — Enum representing different types of sources.
    - `logo_url` string, nullable — Optional URL of a logo (png, jpg or svg) for the code repository.
  - `metadata` CodeRepositoryResponseMetadata — Response metadata for code repositories.
    - `workspace` WorkspaceResponse, required — Response model for workspaces.
      - `body` WorkspaceResponseBody — Response body for workspaces.
        - `created` string, date-time, required
        - `updated` string, date-time, required
      - `metadata` WorkspaceResponseMetadata — Response metadata for workspaces.
        - `description` string
      - `resources` WorkspaceResponseResources — Class for all resource models associated with the workspace entity.
      - `id` string, uuid, required
      - `permission_denied` boolean
      - `name` string, required
    - `config` object, required — Configuration for the code repository.
    - `description` string, nullable — Code repository description.
  - `resources` CodeRepositoryResponseResources — Class for all resource models associated with the code repository entity.
  - `id` string, uuid, required
  - `permission_denied` boolean
  - `name` string, required

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Unprocessable Entity

---

[API](https://skmtc.net/zenml-io/apis/zenml-2.md) · [All operations](https://skmtc.net/zenml-io/apis/zenml-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/zenml-io/zenml-2/versions/febb01b8bce3/schema)
