> 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-1/create-knowledge/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://devin.ferndocs.com/_mcp/server. # Create knowledge entry POST https://api.devin.ai/v1/knowledge Content-Type: application/json Create a new knowledge entry for the organization. Reference: https://devin.ferndocs.com/api-reference/v-1/create-knowledge ## Authentication - `Authorization` header (bearer token, required) — Personal API Key (apk_user_*) or Service API Key (apk_*) ## Request ### Body (application/json) This endpoint expects a CreateKnowledgeParams. - `body` (string, required) - `name` (string, required) - `trigger_description` (string, required) - `macro` (string, optional, nullable) - `parent_folder_id` (string, optional, nullable) - `pinned_repo` (string, optional, nullable) ## Response ### 200 Successful Response - `body` (string, required) - `created_at` (datetime, required) - `id` (string, required) - `name` (string, required) - `trigger_description` (string, required) - `created_by` (KnowledgeCreatedBy, optional, nullable) — Information about who created a knowledge entry. - `macro` (string, optional, nullable) - `parent_folder_id` (string, optional, nullable) - `pinned_repo` (string, optional, nullable) ## Errors ### 422 Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ## Types ### KnowledgeCreatedBy Information about who created a knowledge entry. - `full_name` (string, required) - `id` (string, optional, nullable) - `image_url` (string, optional, nullable) ### ValidationError - `loc` (list of ValidationErrorLocItems, required) - `msg` (string, required) - `type` (string, required) ### ValidationErrorLocItems ## Examples **Request** ```json { "body": "This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.", "name": "Employee Onboarding Process", "trigger_description": "Triggered when a new employee joins the organization." } ``` **Response** ```json { "body": "This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.", "created_at": "2024-01-15T09:30:00Z", "id": "knowledge_9876543210", "name": "Employee Onboarding Process", "trigger_description": "Triggered when a new employee joins the organization.", "created_by": { "full_name": "Jane Doe", "id": "user_1234567890", "image_url": "https://example.com/images/jane_doe.png" }, "macro": "onboarding_macro_v1", "parent_folder_id": "folder_1122334455", "pinned_repo": "employee-handbook" } ``` **SDK Code** ```python import requests url = "https://api.devin.ai/v1/knowledge" payload = { "body": "This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.", "name": "Employee Onboarding Process", "trigger_description": "Triggered when a new employee joins the organization." } 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/v1/knowledge'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"body":"This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.","name":"Employee Onboarding Process","trigger_description":"Triggered when a new employee joins the organization."}' }; 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/v1/knowledge" payload := strings.NewReader("{\n \"body\": \"This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.\",\n \"name\": \"Employee Onboarding Process\",\n \"trigger_description\": \"Triggered when a new employee joins the organization.\"\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/v1/knowledge") 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 \"body\": \"This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.\",\n \"name\": \"Employee Onboarding Process\",\n \"trigger_description\": \"Triggered when a new employee joins the organization.\"\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/v1/knowledge") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"body\": \"This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.\",\n \"name\": \"Employee Onboarding Process\",\n \"trigger_description\": \"Triggered when a new employee joins the organization.\"\n}") .asString(); ``` ```php request('POST', 'https://api.devin.ai/v1/knowledge', [ 'body' => '{ "body": "This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.", "name": "Employee Onboarding Process", "trigger_description": "Triggered when a new employee joins the organization." }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.devin.ai/v1/knowledge"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"body\": \"This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.\",\n \"name\": \"Employee Onboarding Process\",\n \"trigger_description\": \"Triggered when a new employee joins the organization.\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "body": "This knowledge entry explains the process for onboarding new employees, including required documentation and training schedules.", "name": "Employee Onboarding Process", "trigger_description": "Triggered when a new employee joins the organization." ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.devin.ai/v1/knowledge")! 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() ```