> ## 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 code providers

> Updates an existing code providers by ID.

Required API key scopes: any of `code-providers:write`, `code-providers:all`, `all:write`, `all:all`.



## OpenAPI

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


        Required API key scopes: any of `code-providers:write`,
        `code-providers:all`, `all:write`, `all:all`.
      operationId: updateCode-providers
      parameters:
        - schema:
            minLength: 1
            type: string
          in: path
          name: providerId
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  description: >-
                    A new human-readable name for the connected code provider
                    account.
                  type: string
                base_url:
                  minLength: 1
                  description: A new base URL Agen should use for this code provider API.
                  type: string
                metadata:
                  anyOf:
                    - type: object
                      required:
                        - type
                      properties:
                        type:
                          type: string
                          enum:
                            - gitlab_personal_access_token
                        token:
                          minLength: 1
                          description: >-
                            A replacement GitLab personal access token to store
                            securely for this connection. Returned values are
                            masked in API responses.
                          type: string
                    - type: object
                      required:
                        - type
                      properties:
                        type:
                          type: string
                          enum:
                            - github_personal_access_token
                        token:
                          minLength: 1
                          description: >-
                            A replacement GitHub personal access token to store
                            securely for this connection. Returned values are
                            masked in API responses.
                          type: string
      responses:
        '200':
          description: A code provider connection configured for a workspace.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - workspace_id
                  - user_id
                  - platform
                  - name
                  - base_url
                  - metadata
                  - created_at
                  - updated_at
                properties:
                  id:
                    readOnly: true
                    description: >-
                      The unique identifier of the code provider connection
                      inside Agen.
                    type: string
                  workspace_id:
                    readOnly: true
                    description: The workspace that owns this code provider connection.
                    type: string
                  user_id:
                    readOnly: true
                    description: The user who connected this code provider account.
                    type: string
                  platform:
                    anyOf:
                      - type: string
                        enum:
                          - gitlab
                      - type: string
                        enum:
                          - github
                  name:
                    description: >-
                      A human-readable name for the connected code provider
                      account.
                    type: string
                  base_url:
                    description: >-
                      The base URL Agen should use to talk to the code hosting
                      platform API.
                    type: string
                  metadata:
                    anyOf:
                      - type: object
                        required:
                          - type
                          - token
                        properties:
                          type:
                            type: string
                            enum:
                              - gitlab_personal_access_token
                          token:
                            description: >-
                              The GitLab personal access token Agen should store
                              securely for this connection. Returned values are
                              masked in API responses.
                            type: string
                      - type: object
                        required:
                          - type
                          - token
                        properties:
                          type:
                            type: string
                            enum:
                              - github_personal_access_token
                          token:
                            description: >-
                              The GitHub personal access token Agen should store
                              securely for this connection. Returned values are
                              masked in API responses.
                            type: string
                      - type: object
                        required:
                          - type
                          - access_token
                        properties:
                          type:
                            type: string
                            enum:
                              - github_oauth
                          access_token:
                            description: >-
                              The GitHub OAuth access token Agen stores securely
                              for this connection. Returned values are masked in
                              API responses.
                            type: string
                          login:
                            type: string
                          github_user_id:
                            type: number
                  created_at:
                    format: date-time
                    readOnly: true
                    description: When the code provider connection was created in Agen.
                    type: string
                  updated_at:
                    format: date-time
                    readOnly: true
                    description: >-
                      When the code provider connection was last updated in
                      Agen.
                    type: string
                description: A code provider connection configured for a workspace.
        '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:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````