---
title: "Link Repository To Asset"
method: POST
path: "/api/v1/assets/{asset_id}/repositories"
tags: ["git-integration", "Git Integration"]
---

# Link Repository To Asset

`POST /api/v1/assets/{asset_id}/repositories`

## Request

- Base URL: `http://localhost:8000`
- URL: `http://localhost:8000/api/v1/assets/{asset_id}/repositories`
- Auth: none declared

Link a git repository to an asset.

Args:
    asset_id: Asset public ID (UUID or name)
    link_data: Link creation data
    ctx: Application context with session, user, and company info

Returns:
    StandardResponse with created link

## Path parameters

- `asset_id` string, required

## Headers

- `Authorization` string

## Request body

- AssetRepositoryLinkCreate: Schema for creating asset-repository link.
  - `repository_id` string, required: Repository public ID (UUID)
  - `enabled` boolean: Enable analysis for this asset
  - `min_confidence_threshold` union: Minimum confidence threshold (0.0-1.0)
    - number
    - string
  - `lookback_days` integer: Git history lookback period in days

## Response `201`

Successful Response

- StandardResponse: Standard API response wrapper.
  - `success` boolean, required
  - `data` unknown
  - `message` string, nullable
  - `error` string, nullable
  - `meta` object, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api.md) · [All operations](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api/llms.txt) · [OpenAPI document](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api/revisions/51c755fb5d0b?raw)
