> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://devin.ferndocs.com/api-reference/v-2/clone-repo/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://devin.ferndocs.com/_mcp/server. # Clone Repo POST https://api.devin.ai/v2/enterprise/organizations/{org_id}/clone Content-Type: application/json Reference: https://devin.ferndocs.com/api-reference/v-2/clone-repo ## Authentication - `Authorization` header (bearer token, required) — Personal API Key (apk_user_*) or Service API Key (apk_*) ## Request ### Path parameters - `org_id` (string, required) ### Body (application/json) This endpoint expects a CloneRepoRequest. - `repo_path` (string, required) — Repository path in the format 'owner/repo_name' (e.g., 'acme/my-project') - `pull_repo_commands` (list of string, optional, nullable) — Commands to pull the repository. Recommended to leave blank as it is auto-generated. - `repo_note` (string, optional, nullable) - `run_lint_commands` (list of string, optional, nullable) - `run_project_commands` (list of string, optional, nullable) - `run_tests_commands` (list of string, optional, nullable) - `update_dependencies_commands` (list of string, optional, nullable) ## Response ### 200 Successful Response - `created_at` (datetime, required) — Timestamp when the snapshot was created - `org_id` (string, required) — Organization ID the snapshot belongs to - `snapshot_id` (string, required) — ID of the created snapshot - `status` (string, required) — Status of the snapshot (e.g., 'pending', 'available') - `ami_id` (string, optional, nullable) — AMI ID of the snapshot (may be null if still being created) ## Errors ### 422 Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ## Types ### ValidationError - `loc` (list of ValidationErrorLocItems, required) - `msg` (string, required) - `type` (string, required) ### ValidationErrorLocItems ## Examples **Request** ```json { "repo_path": "acme/my-project" } ``` **Response** ```json { "created_at": "2024-01-15T09:30:00Z", "org_id": "org_1234567890abcdef", "snapshot_id": "snap-0987fedcba6543210", "status": "pending", "ami_id": "ami-0a12bc34d56ef7890" } ``` **SDK Code** ```python import requests url = "https://api.devin.ai/v2/enterprise/organizations/org_id/clone" payload = { "repo_path": "acme/my-project" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.devin.ai/v2/enterprise/organizations/org_id/clone'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"repo_path":"acme/my-project"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.devin.ai/v2/enterprise/organizations/org_id/clone" payload := strings.NewReader("{\n \"repo_path\": \"acme/my-project\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.devin.ai/v2/enterprise/organizations/org_id/clone") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"repo_path\": \"acme/my-project\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.devin.ai/v2/enterprise/organizations/org_id/clone") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"repo_path\": \"acme/my-project\"\n}") .asString(); ``` ```php request('POST', 'https://api.devin.ai/v2/enterprise/organizations/org_id/clone', [ 'body' => '{ "repo_path": "acme/my-project" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.devin.ai/v2/enterprise/organizations/org_id/clone"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"repo_path\": \"acme/my-project\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["repo_path": "acme/my-project"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.devin.ai/v2/enterprise/organizations/org_id/clone")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```