---
title: "Add repository by URL"
method: POST
path: "/api/v2/repositories/addByUrl"
tags: ["Repositories"]
---

# Add repository by URL

`POST /api/v2/repositories/addByUrl`

## Request

- Base URL: `https://zeropath.com`
- URL: `https://zeropath.com/api/v2/repositories/addByUrl`
- Auth: API key in header `X-ZeroPath-API-Token-Id` and API key in header `X-ZeroPath-API-Token-Secret`

Add a publicly-accessible repository by its git URL (e.g. a public GitHub repo). No VCS credentials or app installation are required — ZeroPath clones the repository over HTTPS. After adding, use `scans.start` with the returned repository ID to trigger a security scan. Supports GitHub, GitLab, Bitbucket, and any publicly accessible git repository.

## Request body

- RepositoriesAddByUrlRequest: Add a publicly-accessible repository by its git URL. No credentials are needed — ZeroPath will clone it over HTTPS.
  - `organizationId` string: Organization to add the repository to.
  - `repositoryUrl` string, required: Git URL of the repository (e.g. "https://github.com/owner/repo", "github.com/owner/repo", "git@github.com:owner/repo.git"). HTTP(S), SSH, and shorthand formats are all accepted.
  - `defaultScanTargetBranch` string: Default branch to scan (e.g. "main", "master"). If omitted, ZeroPath will auto-detect.

## Response `200`

Successfully added repository

- RepositoriesAddByUrlResponse
  - `id` string, required: ID of the newly created repository. Use this with scans.start to trigger a scan.

---

[API](https://skmtc.dev/zeropath/apis/zeropath-api.md) - [All operations](https://skmtc.dev/zeropath/apis/zeropath-api/llms.txt) - [OpenAPI document](https://skmtc.dev/zeropath/apis/zeropath-api/revisions/126e9c80ba0d?raw)
