> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agenhq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update repositories

> Updates an existing repositories by ID.

Required API key scopes: any of `repositories:write`, `repositories:all`, `all:write`, `all:all`.



## OpenAPI

````yaml /coding-agent-api/openapi.json patch /api/v1/repositories/{id}
openapi: 3.1.0
info:
  title: Agen Coding Agent API
  version: 1.0.0
servers:
  - url: https://api.agenhq.com
security: []
paths:
  /api/v1/repositories/{id}:
    patch:
      tags:
        - Repositories
      summary: Update repositories
      description: >-
        Updates an existing repositories by ID.


        Required API key scopes: any of `repositories:write`,
        `repositories:all`, `all:write`, `all:all`.
      operationId: updateRepositories
      parameters:
        - schema:
            minLength: 1
            type: string
          in: path
          name: id
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RepositoriesUpdateRequest'
        description: Fields used to update a repository connection.
      responses:
        '200':
          description: A repository connected to a workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepositoriesUpdateResponse'
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                required:
                  - statusCode
                  - code
                  - error
                  - message
                properties:
                  statusCode:
                    type: number
                  code:
                    type: string
                  error:
                    type: string
                  message:
                    type: string
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
      security:
        - apiKey: []
components:
  schemas:
    RepositoriesUpdateRequest:
      type: object
      properties:
        enabled:
          default: true
          description: Whether Agen can use this repository for sessions and automation.
          type: boolean
      description: Fields used to update a repository connection.
    RepositoriesUpdateResponse:
      type: object
      required:
        - id
        - workspace_id
        - code_provider_id
        - name
        - full_name
        - clone_url
        - default_branch
        - platform
        - external_id
        - enabled
        - webhooks_registered
        - webhook_secret
        - analysis_status
        - analysis_error
        - last_analyzed_at
        - created_at
        - updated_at
      properties:
        id:
          readOnly: true
          description: The unique identifier of the repository inside Agen.
          type: string
        workspace_id:
          readOnly: true
          description: The workspace that owns this repository.
          type: string
        code_provider_id:
          description: The connected code provider account used to access this repository.
          type: string
        name:
          description: The repository name without the owner or namespace.
          type: string
        full_name:
          description: >-
            The full repository name including the owner or namespace, for
            example `agenhq/agen`.
          type: string
        clone_url:
          description: The git clone URL used by Agen to access the repository contents.
          type: string
        default_branch:
          description: The default branch of the repository, such as `main` or `master`.
          type: string
        platform:
          description: The code hosting platform where the repository is hosted.
          anyOf:
            - const: gitlab
              type: string
            - const: github
              type: string
        external_id:
          description: >-
            The repository identifier used by the external code hosting
            platform.
          type: string
        enabled:
          default: true
          description: Whether Agen can use this repository for sessions and automation.
          type: boolean
        webhooks_registered:
          readOnly: true
          description: >-
            Whether Agen has successfully registered webhooks for this
            repository.
          type: boolean
        webhook_secret:
          readOnly: true
          description: >-
            The webhook signing secret created by Agen for this repository, if
            available.
          anyOf:
            - type: string
            - type: 'null'
        analysis_status:
          readOnly: true
          description: The current status of the repository analysis job.
          anyOf:
            - const: pending
              type: string
            - const: analyzing
              type: string
            - const: completed
              type: string
            - const: failed
              type: string
        analysis_error:
          readOnly: true
          description: The latest repository analysis error message, if analysis failed.
          anyOf:
            - type: string
            - type: 'null'
        last_analyzed_at:
          readOnly: true
          description: >-
            When the repository was last analyzed by Agen, if analysis has
            completed at least once.
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
        created_at:
          format: date-time
          readOnly: true
          description: When the repository record was created in Agen.
          type: string
        updated_at:
          format: date-time
          readOnly: true
          description: When the repository record was last updated in Agen.
          type: string
      description: A repository connected to a workspace.
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````