---
title: "Get authenticated repository clone URL"
method: POST
path: "/api/v2/agent/getRepoCloneUrl"
tags: ["Agent"]
---

# Get authenticated repository clone URL

`POST /api/v2/agent/getRepoCloneUrl`

## Request

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

Get the clone URL and any required Git configuration for a repository. Most providers embed a short-lived credential in the URL. Bitbucket Data Center connections use a URL-scoped Bearer header returned in gitConfig. Supports GitHub (app installation tokens or PATs), GitLab, and Bitbucket repositories.

## Request body

- AgentGetRepoCloneUrlRequest
  - `organizationId` string: Organization ID (injected by MCP server)
  - `repositoryId` string, uuid, required: ID of the repository to get a clone URL for

## Response `200`

Authenticated clone URL

- AgentGetRepoCloneUrlResponse
  - `cloneUrl` string, required: Clone URL. Credentials are embedded for providers that use Basic auth; a Bitbucket Data Center connection returns a credential-free HTTP(S) URL with gitConfig.
  - `gitConfig` object: Optional URL-scoped Git configuration required for the clone. Pass it as `git -c "<key>=<value>" clone <cloneUrl>`. Present for Bitbucket Data Center Bearer authentication.
    - `key` string, required: URL-scoped Git configuration key.
    - `value` string, required: Sensitive Git configuration value; use immediately and do not log it.

## Other responses

- `400`: Error Response
- `401`: Error Response
- `404`: Error Response

---

[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)
