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

# Record that a repo moved

> **Beta** — the Repo moves feature is in beta. Requests from organizations without it enabled receive `403 Forbidden`.

Record that the repo with internal `id` `{repo}` moved to the repo `target_id`, for example after moving it to a new VCS host. The target's builds, deployments and live artifacts then include this repo's. Nothing reported is changed.

The moved repo is left out of the repo list, its filter options and a lookup by name alone; a lookup by name and `provider`, or by `id`, still finds it. The repos that moved to this one move to the target too, so a move is never more than one hop; undoing this move later returns only this repo. Moving to a repo that has itself moved is refused. Undo with DELETE on the same path.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json put /repos/{org}/{repo}/moved-to
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /repos/{org}/{repo}/moved-to:
    put:
      tags:
        - Repos
      summary: Record that a repo moved
      description: >-
        **Beta** — the Repo moves feature is in beta. Requests from
        organizations without it enabled receive `403 Forbidden`.


        Record that the repo with internal `id` `{repo}` moved to the repo
        `target_id`, for example after moving it to a new VCS host. The target's
        builds, deployments and live artifacts then include this repo's. Nothing
        reported is changed.


        The moved repo is left out of the repo list, its filter options and a
        lookup by name alone; a lookup by name and `provider`, or by `id`, still
        finds it. The repos that moved to this one move to the target too, so a
        move is never more than one hop; undoing this move later returns only
        this repo. Moving to a repo that has itself moved is refused. Undo with
        DELETE on the same path.
      operationId: record_repo_move
      parameters:
        - name: repo
          in: path
          required: true
          schema:
            type: string
            description: The repo's internal id (`id` in the repo response).
            title: Repo
          description: The repo's internal id (`id` in the repo response).
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RepoMovedToPutInput'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RepoDetailResponse'
        '400':
          description: The repo is the target, or the target has moved
          content:
            application/json:
              example:
                message: A repo cannot move to itself
              schema:
                $ref: '#/components/schemas/BadRequestResponseModel'
        '403':
          description: Only an org admin can record repo moves
          content:
            application/json:
              example:
                message: Only an org admin can record repo moves
              schema:
                $ref: '#/components/schemas/ForbiddenResponseModel'
        '404':
          description: Repo not found
          content:
            application/json:
              example:
                message: Repo not found
              schema:
                $ref: '#/components/schemas/NotFoundResponseModel'
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    RepoMovedToPutInput:
      properties:
        target_id:
          type: string
          title: Target Id
          description: >-
            The `id` of the repo this repo moved to, e.g. the same repo at its
            new VCS host.
      type: object
      required:
        - target_id
      title: RepoMovedToPutInput
    RepoDetailResponse:
      properties:
        id:
          type: string
          title: Id
          description: The repo's internal id in Kosli, unaffected by renames.
        name:
          type: string
          title: Name
          description: The repo's full name at its VCS host, e.g. 'acme/payments'.
        short_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Short Name
          description: The last segment of `name`, e.g. 'payments'.
        url:
          type: string
          title: Url
          description: The repo's URL at its VCS host.
        provider:
          anyOf:
            - type: string
              enum:
                - github
                - gitlab
                - bitbucket
                - bitbucket_cloud
                - bitbucket_dc
                - azure-devops
                - azure_devops_services
                - azure_devops_server
                - circleci
                - git
                - subversion
            - type: 'null'
          title: Provider
          description: The VCS provider hosting the repo.
        repo_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Repo Id
          description: The id the VCS host gives the repo.
        vcs_instance:
          anyOf:
            - type: string
            - type: 'null'
          title: Vcs Instance
          description: The VCS host the repo is on, e.g. 'gitlab.company.com'.
        namespace_path:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Namespace Path
          description: >-
            The namespaces above the repo at its VCS host, outermost first, e.g.
            ['acme'].
        additional_info:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Additional Info
          description: >-
            Provider-specific details reported with the repo, e.g. a Bitbucket
            project key.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: The repo's description, as reported.
        tags:
          additionalProperties:
            type: string
          type: object
          title: Tags
          description: The tags set on the repo in Kosli.
        _links:
          anyOf:
            - additionalProperties:
                anyOf:
                  - $ref: '#/components/schemas/HALLink'
                  - items:
                      $ref: '#/components/schemas/HALLink'
                    type: array
              type: object
              description: >-
                Links to related resources, keyed by relation (`self`, `next`,
                ...), each a link or a list of links
            - type: 'null'
          title: Links
          description: >-
            Links to related resources, keyed by relation (`self`, `next`, ...),
            each a link or a list of links
        moved_to:
          anyOf:
            - type: string
            - type: 'null'
          title: Moved To
          description: >-
            The `id` of the repo this one moved to, whose builds and deployments
            include this repo's. Null when the repo has not moved.
        moved_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Moved At
          description: Unix time the move was recorded. Null when the repo has not moved.
        moved_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Moved By
          description: >-
            Display name of the user who recorded the move: null when the repo
            has not moved, and 'Unknown' when that user has been deleted.
        archived_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Archived At
          description: Unix time the repo was archived. Null when it is not archived.
        archived_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Archived By
          description: >-
            Display name of the user who archived the repo: null when it is not
            archived, and 'Unknown' when that user has been deleted.
        moved_from:
          items:
            type: string
          type: array
          title: Moved From
          description: The `id`s of the repos that moved to this one.
      type: object
      required:
        - id
        - name
        - url
      title: RepoDetailResponse
    BadRequestResponseModel:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: BadRequestResponseModel
    ForbiddenResponseModel:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: ForbiddenResponseModel
    NotFoundResponseModel:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: NotFoundResponseModel
    HALLink:
      properties:
        href:
          type: string
          title: Href
          description: Absolute URL of the linked resource
      type: object
      required:
        - href
      title: HALLink
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.