> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://developers.alephant.io/api-reference/saa-s-api/agents/batch-create-agents/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.alephant.io/_mcp/server. # Batch create agents POST https://alephant.io/api/v1/agents/batch Content-Type: application/json Create multiple agents; each gets a VK. Returns list with fullToken per item. Owner or admin. Reference: https://developers.alephant.io/api-reference/saa-s-api/agents/batch-create-agents ## Servers - `https://alephant.io` (Production, default) - `https://dev.alephant.io` (Development) ## Request ### Headers - `Authorization` (string, required) — Bearer \{access\_token} - `X-Workspace-Id` (string, required) — Workspace UUID ### Body (application/json) This endpoint expects an internal_api_handlers_agents.BatchCreateAgentsRequest. - `agents` (list of internal_api_handlers_agents.CreateAgentRequest, required) ## Response ### 201 data: list of created agents + virtualKey - `map from string to any` ## Errors ### 400 Bad Request Error BAD_REQUEST - `map from string to any` ### 401 Unauthorized Error AUTH_TOKEN_EXPIRED - `map from string to any` ### 403 Forbidden Error FORBIDDEN - `map from string to any` ### 404 Not Found Error masterKeyId or departmentId NOT_FOUND - `map from string to any` ### 409 Conflict Error TIER_LIMIT_VK - `map from string to any` ### 422 Unprocessable Entity Error VALIDATION_ERROR - `map from string to any` ## Types ### internal_api_handlers_agents.CreateAgentRequest - `masterKeyId` (string, required) - `name` (string, required) - `provider` (string, required) - `about` (string, optional) - `allowedModels` (list of string, optional) - `budget` (double, optional) - `budgetAction` (string, optional) - `budgetWindow` (string, optional) - `departmentId` (string, optional) - `description` (string, optional) - `environment` (string, optional) - `expiresAt` (string, optional) - `framework` (string, optional) - `linkedEndpointSlug` (string, optional) - `model` (string, optional) - `modelsInfo` (map from string to github_com_alephant_backend-saas-service_internal_service.ModelPriceEntry, optional) — ModelsInfo 是 custom provider 时的模型价格,格式:\{"modelId": \{"prompt": 1.5, "completion": 2.0}} 单位:美元 / 1M tokens - `rateLimitRpm` (integer, optional) - `runtime` (internal_api_handlers_agents.AgentRuntimeRequest, optional) — Required when source is n8n_workflow or custom_webhook. The runtimeType must match that source. - `source` (enum, optional, default: manual) — Agent source. n8n_workflow and custom_webhook require runtime. - Allowed values: `manual`, `n8n_workflow`, `custom_webhook` ### github_com_alephant_backend-saas-service_internal_service.ModelPriceEntry - `completion` (double, optional) - `prompt` (double, optional) ### internal_api_handlers_agents.AgentRuntimeRequest Runtime configuration. endpointUrl is required unless runtimeType is llm_gateway. authSecret is required for bearer/basic auth; authHeaderName and authSecret are required for header auth. - `runtimeType` (enum, optional, default: llm_gateway) - Allowed values: `llm_gateway`, `n8n_workflow`, `webhook` - `endpointUrl` (string, optional) — Required for n8n_workflow and webhook runtimes. - `httpMethod` (enum, optional, default: POST) - Allowed values: `GET`, `POST`, `PUT`, `PATCH` - `authMode` (enum, optional, default: none) - Allowed values: `none`, `bearer`, `header`, `basic` - `authHeaderName` (string, optional) — Required when authMode is header. - `authSecret` (string, optional) — Required when authMode is bearer, basic, or header. - `inputFormat` (enum, optional, default: json) - Allowed values: `json`, `form`, `raw` - `timeoutMs` (integer, optional, default: 30000) — A value of 0 is normalized to the default. - `retryCount` (integer, optional, default: 0) - `enabled` (boolean, optional, default: true) ## Examples **Request** ```json { "agents": [ { "masterKeyId": "string", "name": "string", "provider": "string" } ] } ``` **Response** ```json {} ``` **SDK Code** ```python import requests url = "https://alephant.io/api/v1/agents/batch" payload = { "agents": [ { "masterKeyId": "string", "name": "string", "provider": "string" } ] } headers = { "Authorization": "Authorization", "X-Workspace-Id": "X-Workspace-Id", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://alephant.io/api/v1/agents/batch'; const options = { method: 'POST', headers: { Authorization: 'Authorization', 'X-Workspace-Id': 'X-Workspace-Id', 'Content-Type': 'application/json' }, body: '{"agents":[{"masterKeyId":"string","name":"string","provider":"string"}]}' }; 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://alephant.io/api/v1/agents/batch" payload := strings.NewReader("{\n \"agents\": [\n {\n \"masterKeyId\": \"string\",\n \"name\": \"string\",\n \"provider\": \"string\"\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Authorization") req.Header.Add("X-Workspace-Id", "X-Workspace-Id") 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://alephant.io/api/v1/agents/batch") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Authorization' request["X-Workspace-Id"] = 'X-Workspace-Id' request["Content-Type"] = 'application/json' request.body = "{\n \"agents\": [\n {\n \"masterKeyId\": \"string\",\n \"name\": \"string\",\n \"provider\": \"string\"\n }\n ]\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://alephant.io/api/v1/agents/batch") .header("Authorization", "Authorization") .header("X-Workspace-Id", "X-Workspace-Id") .header("Content-Type", "application/json") .body("{\n \"agents\": [\n {\n \"masterKeyId\": \"string\",\n \"name\": \"string\",\n \"provider\": \"string\"\n }\n ]\n}") .asString(); ``` ```php request('POST', 'https://alephant.io/api/v1/agents/batch', [ 'body' => '{ "agents": [ { "masterKeyId": "string", "name": "string", "provider": "string" } ] }', 'headers' => [ 'Authorization' => 'Authorization', 'Content-Type' => 'application/json', 'X-Workspace-Id' => 'X-Workspace-Id', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://alephant.io/api/v1/agents/batch"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Authorization"); request.AddHeader("X-Workspace-Id", "X-Workspace-Id"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"agents\": [\n {\n \"masterKeyId\": \"string\",\n \"name\": \"string\",\n \"provider\": \"string\"\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Authorization", "X-Workspace-Id": "X-Workspace-Id", "Content-Type": "application/json" ] let parameters = ["agents": [ [ "masterKeyId": "string", "name": "string", "provider": "string" ] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://alephant.io/api/v1/agents/batch")! 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() ```