> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://humanloop.com/docs/v5/api/directories/update/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://humanloop.com/_mcp/server. # Update PATCH https://api.humanloop.com/v5/directories/{id} Content-Type: application/json Update the Directory with the given ID. Reference: https://humanloop.com/docs/api/directories/update ## Authentication - `X-API-KEY` header (required) — API Key authentication via header ## Request ### Path parameters - `id` (string, required) — Unique identifier for Directory. Starts with `dir_`. ### Body (application/json) This endpoint expects an object. - `name` (string, optional) — Name to set for the directory. - `parent_id` (string, optional) — ID of the parent directory. Specify this to move directories. Starts with `dir_`. - `path` (string, optional) — Path to move the directory to, relative to the root directory. Specify this to move directories. Includes name, e.g. `path/to/directory`. ## Response ### 200 Successful Response - `id` (string, required) — String ID of directory. Starts with `dir_`. - `name` (string, required) — Name of the directory. - `path` (string, required) — Path to the directory, relative to the root directory. Includes name, e.g. `path/to/directory`. - `tags` (list of string, required) — List of tags associated with the directory. - `created_at` (datetime, required) - `updated_at` (datetime, required) - `parent_id` (string, optional) — ID of the parent directory. Will be `None` if the directory is the root directory. Starts with `dir_`. - `description` (string, optional) — Description of the directory. - `readme` (string, optional) — Long description of the directory. ## Errors ### 422 Update Directories ID Patch Request Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ## Types ### ValidationError - `loc` (list of ValidationErrorLocItem, required) - `msg` (string, required) - `type` (string, required) ### ValidationErrorLocItem ## Examples **Request** ```json {} ``` **Response** ```json { "id": "id", "name": "name", "path": "path", "tags": [ "tags" ], "created_at": "2024-01-15T09:30:00Z", "updated_at": "2024-01-15T09:30:00Z", "parent_id": "parent_id", "description": "description", "readme": "readme" } ``` **SDK Code** ```python import requests url = "https://api.humanloop.com/v5/directories/id" payload = {} headers = { "X-API-KEY": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```typescript import { HumanloopClient } from "humanloop"; const client = new HumanloopClient({ apiKey: "YOUR_API_KEY" }); await client.directories.update("id"); ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.humanloop.com/v5/directories/id" payload := strings.NewReader("{}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("X-API-KEY", "") 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.humanloop.com/v5/directories/id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["X-API-KEY"] = '' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://api.humanloop.com/v5/directories/id") .header("X-API-KEY", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('PATCH', 'https://api.humanloop.com/v5/directories/id', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', 'X-API-KEY' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.humanloop.com/v5/directories/id"); var request = new RestRequest(Method.PATCH); request.AddHeader("X-API-KEY", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "X-API-KEY": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.humanloop.com/v5/directories/id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" 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() ```