---
title: "POST /registry-git/{asset}/{namespace}/{slug}/link-external"
method: POST
path: "/registry-git/{asset}/{namespace}/{slug}/link-external"
tags: ["registry-git"]
---

# POST /registry-git/{asset}/{namespace}/{slug}/link-external

`POST /registry-git/{asset}/{namespace}/{slug}/link-external`

Link a GitHub repo as the source of truth for a registry resource: opens a PR adding the canonical file, then pushes and merges on the tracked branch drive publishes

## Path parameters

- `asset` 'apis' | 'schemas' | 'rules' | 'sdks', required
- `namespace` string, required
- `slug` string, required

## Request body

- object
  - `provider` 'github' | 'bitbucket', required
  - `installationId` integer
  - `repoId` integer

## Response `200`

Default Response

- object
  - `repository` LinkedRepository, required
    - `uid` string, required
    - `createdAt` integer, required
    - `updatedAt` integer, required
    - `remote` union, required
      - object
        - `provider` 'github', required
        - `installationId` integer, required
        - `id` integer, required
        - `name` string, required
        - `defaultBranch` string, required
      - object
        - `provider` 'bitbucket', required
        - `workspaceUuid` string, required
        - `workspaceSlug` string, required
        - `repoUuid` string, required
        - `repoSlug` string, required
        - `name` string, required
        - `defaultBranch` string, required
    - `forgejo` object, nullable, required
      - `owner` string, required
      - `repo` string, required
      - `branch` string, required
    - `linkedBy` string, required
  - `source` union, required
    - object
      - `type` 'platform', required
    - object
      - `type` 'git', required
      - `repositoryUid` string, required
      - `path` string, required
      - `branch` string, nullable, required
      - `publishOnPush` boolean, required
      - `publishOnMerge` boolean, required
      - `currentPublishedSha` string, nullable, required
      - `lastPublishedAt` integer, required
    - object
      - `type` 'url', required
      - `url` string, uri, required
      - `linkedBy` string, required
      - `etag` string, nullable, required
      - `lastFetchedAt` integer, required
  - `pullRequest` object, required
    - `url` string, required
    - `number` integer, required
    - `branch` string, required

## Other responses

- `400` — Bad request
- `401` — No auth
- `403` — Forbidden
- `404` — Not found
- `422` — Invalid payload
- `500` — Uncaught error

## Changes

- **2026-08-21** `4efa9fcf5c1e` — 1 breaking, 2 info
  - removed the required property `git` from the response with the `200` status
  - added the required property `repository` to the response with the `200` status
  - added the required property `source` to the response with the `200` status
- **2026-08-07** `8dff1e93bc68` — 1 info
  - api operation id `postregistryGitAssetNamespaceSlugLinkExternal` removed and replaced with `postRegistryGitAssetNamespaceSlugLinkExternal`
- **2026-07-31** `6bf4d2849a20` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/scalar/apis/core/changes/registry-git/:asset/:namespace/:slug/link-external/post.md)

---

[API](https://skmtc.dev/scalar/apis/core.md) · [All operations](https://skmtc.dev/scalar/apis/core/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/scalar/core/revisions/2c53f2191a3e/schema)
