> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://developers.awork.com/apiv1/custom-agents/post-agents/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.awork.com/_mcp/server. # Creates a new custom agent. POST https://api.awork.com/api/v1/agents Content-Type: application/json Creates a custom agent in the current workspace and returns its configuration and id. Provide a name and either PresetKey or both ModelProvider and ModelName. Do not combine these model selection options.Any authenticated user. Reference: https://developers.awork.com/apiv1/custom-agents/post-agents ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Body (application/json) This endpoint expects a CreateAgentRequestModel. - `name` (string, required) — The name shown to users. - `description` (string, optional, nullable) — A short explanation of what the agent does. - `modelProvider` (string, optional, nullable) — The provider that hosts the model. - `modelName` (string, optional, nullable) — The model to run. - `presetKey` (string, optional, nullable) — The workspace model preset to use. - `reasoningLevel` (string, optional, nullable) — The amount of reasoning the model uses. - `systemPrompt` (string, optional, nullable) — The instructions that control the agent's behavior. - `webSearchEnabled` (boolean, optional, nullable) — Whether web search is enabled. - `aworkAccessEnabled` (boolean, optional, nullable) — Whether the agent can use awork tools. - `googleGenAiAccessEnabled` (boolean, optional, nullable) — Whether the agent can generate images with Google models. - `openAiImageGenerationAccessEnabled` (boolean, optional, nullable) — Whether the agent can generate images with OpenAI models. ## Response ### 200 OK - `id` (string, optional) — The id of the entity. - `createdOn` (string, optional) — The date this entity was created. - `createdBy` (string, optional) — The id of the user who created this entity. - `updatedOn` (string, optional) — The date this entity was last modified. - `updatedBy` (string, optional) — The id of the user who last modified this entity. - `type` (string, optional, nullable) — The public agent type. - `connectors` (list of AgentConnectorLinkResponseModel, optional, nullable) — The linked connectors. - `name` (string, optional, nullable) — The name shown to users. - `description` (string, optional, nullable) — A short explanation of what the agent does. - `currentSystemPromptVersionId` (string, optional, nullable) — The current system prompt version. - `modelProvider` (string, optional, nullable) — The configured model provider when no preset is selected. - `modelName` (string, optional, nullable) — The configured model name when no preset is selected. - `presetKey` (string, optional, nullable) — The configured workspace model preset key. - `reasoningLevel` (string, optional, nullable) — The configured reasoning level. - `systemPrompt` (string, optional, nullable) — The current system prompt. - `webSearchEnabled` (boolean, optional) — Whether web search is enabled. - `aworkAccessEnabled` (boolean, optional) — Whether awork access is enabled. - `googleGenAiAccessEnabled` (boolean, optional) — Whether Google image generation is enabled. - `openAiImageGenerationAccessEnabled` (boolean, optional) — Whether OpenAI image generation is enabled. - `skillIds` (list of string, optional, nullable) — The skills linked to the agent. - `hasImage` (boolean, optional) — Whether the agent has a profile image. - `isArchived` (boolean, optional) — Whether the agent is archived. - `workspaceAccessLevel` (enum, optional, nullable) — The workspace-wide access level. - Allowed values: `read`, `manage` - `accessLevel` (enum, optional) — The requesting user's access level. - Allowed values: `read`, `manage` ## Errors ### 400 Bad Request Error Bad Request - `code` (string, required) — The error code. - `description` (string, required) — The description of the error. - `link` (string, required) — The link to the API documentation page. - `details` (list of string, optional, nullable) — A list of details describing the error. - `validationErrors` (list of ValidationErrorResponse, optional, nullable) — If a validation error occurred, this contains the validation errors for each property. - `traceId` (string, optional, nullable) — The request trace id for tracking the request. ## Types ### AgentConnectorLinkResponseModel A connector linked to a custom agent, with settings shared by everyone who uses the agent. - `id` (string, optional) — The linked connector identifier. - `name` (string, optional, nullable) — The connector name. - `status` (string, optional, nullable) — Always pending in this shared response. It does not indicate whether an account is connected. Read the agent's configuration endpoint for the current user's connection status. - `connectionMode` (string, optional, nullable) — How the agent chooses an account: actingUser lets each user supply their own; specificConnection uses the editor-provided account for everyone. - `connectionId` (string, optional, nullable) — The editor-provided account id in specificConnection mode; otherwise null. ### ValidationErrorResponse The validation error response. - `property` (string, optional, nullable) — The name of the property that failed validation. - `message` (string, optional, nullable) — The reason why this property failed validation. ## Examples **Request** ```json { "name": "Client Status Reporter" } ``` **Response** ```json { "id": "23e68187-91d6-4f7e-8d31-e3f2c60d7427", "createdOn": "2022-03-11T15:33:47.100Z", "createdBy": "9ad63972-4396-4b0b-9e7d-40b852cdebf8", "updatedOn": "2022-03-11T21:15:00.100Z", "updatedBy": "3d844c62-7410-4df9-a5b2-78805c0ee260", "type": "custom-agent", "connectors": [ { "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "name": "Google Drive", "status": "pending", "connectionMode": "specificConnection", "connectionId": "6ba7b811-9dad-11d1-80b4-00c04fd430c8" } ], "name": "Client Status Reporter", "description": "Prepares client-ready project status reports.", "currentSystemPromptVersionId": "fd077515-d4a8-4f79-9fbf-19271bd0123d", "modelProvider": "openai", "modelName": "gpt-5.6-terra", "presetKey": "balanced", "reasoningLevel": "medium", "systemPrompt": "Prepare concise client-ready project updates from awork data.", "webSearchEnabled": true, "aworkAccessEnabled": true, "googleGenAiAccessEnabled": false, "openAiImageGenerationAccessEnabled": false, "skillIds": [ "string" ], "hasImage": true, "isArchived": false, "workspaceAccessLevel": null, "accessLevel": "manage" } ``` **SDK Code** ```python import requests url = "https://api.awork.com/api/v1/agents" payload = { "name": "Client Status Reporter" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.awork.com/api/v1/agents'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"name":"Client Status Reporter"}' }; 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.awork.com/api/v1/agents" payload := strings.NewReader("{\n \"name\": \"Client Status Reporter\"\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.awork.com/api/v1/agents") 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 \"name\": \"Client Status Reporter\"\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.awork.com/api/v1/agents") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"name\": \"Client Status Reporter\"\n}") .asString(); ``` ```php request('POST', 'https://api.awork.com/api/v1/agents', [ 'body' => '{ "name": "Client Status Reporter" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.awork.com/api/v1/agents"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"Client Status Reporter\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["name": "Client Status Reporter"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.awork.com/api/v1/agents")! 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() ```