curl --request POST \
--url https://api.swarms.world/v1/swarm/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"agents": [
{
"agent_name": "<string>",
"description": "<string>",
"system_prompt": "<string>",
"marketplace_prompt_id": "<string>",
"model_name": "claude-sonnet-5",
"fallback_models": [
"<string>"
],
"fallback_model_name": "<string>",
"auto_generate_prompt": false,
"max_tokens": 16000,
"temperature": 1,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [
{}
],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": false,
"llm_args": {},
"top_p": 123,
"dynamic_temperature_enabled": false,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"name": "<string>",
"tool_configurations": {},
"authorization_token": "<string>",
"api_key": "<string>",
"api_key_header": "Authorization",
"api_key_prefix": "Bearer",
"oauth": {
"grant_type": "authorization_code",
"client_id": "<string>",
"client_secret": "<string>",
"scopes": [
"<string>"
],
"redirect_uri": "http://127.0.0.1:8765/callback",
"client_name": "Swarms Agent",
"client_uri": "<string>",
"authorization_url": "<string>",
"token_url": "<string>",
"access_token": "<string>",
"refresh_token": "<string>",
"token_storage_path": "<string>",
"use_token_cache": true,
"open_browser": true,
"callback_timeout": 300
},
"transport": "streamable_http",
"headers": {},
"timeout": 30,
"sse_read_timeout": 300,
"tool_timeout": 120,
"command": "<string>",
"args": [
"<string>"
],
"env": {}
},
"mcp_configs": {
"connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"name": "<string>",
"tool_configurations": {},
"authorization_token": "<string>",
"api_key": "<string>",
"api_key_header": "Authorization",
"api_key_prefix": "Bearer",
"oauth": {
"grant_type": "authorization_code",
"client_id": "<string>",
"client_secret": "<string>",
"scopes": [
"<string>"
],
"redirect_uri": "http://127.0.0.1:8765/callback",
"client_name": "Swarms Agent",
"client_uri": "<string>",
"authorization_url": "<string>",
"token_url": "<string>",
"access_token": "<string>",
"refresh_token": "<string>",
"token_storage_path": "<string>",
"use_token_cache": true,
"open_browser": true,
"callback_timeout": 300
},
"transport": "streamable_http",
"headers": {},
"timeout": 30,
"sse_read_timeout": 300,
"tool_timeout": 120,
"command": "<string>",
"args": [
"<string>"
],
"env": {}
}
]
},
"tool_call_summary": true,
"thinking_tokens": 123,
"reasoning_enabled": false,
"publish_to_marketplace": false,
"use_cases": [
{}
],
"tags": [
"<string>"
],
"capabilities": [
"<string>"
],
"category": "<string>",
"is_free": true,
"price_usd": 123,
"handoffs": [
"<unknown>"
]
}
],
"max_loops": 1,
"rearrange_flow": "<string>",
"task": "<string>",
"img": "<string>",
"tasks": [
"<string>"
],
"messages": [
{}
],
"stream": false,
"heavy_swarm_question_agent_model_name": "gpt-4.1",
"heavy_swarm_worker_model_name": "claude-sonnet-4-20250514",
"heavy_swarm_variant": "default",
"council_judge_model_name": "gpt-5.4",
"chairman_model": "gpt-5.1",
"multi_agent_collab_prompt": true,
"heavy_swarm_max_loops": 1,
"list_all_agents": false,
"director_model_name": "gpt-5.4",
"director_settings": {}
}
'import requests
url = "https://api.swarms.world/v1/swarm/completions"
payload = {
"name": "<string>",
"description": "<string>",
"agents": [
{
"agent_name": "<string>",
"description": "<string>",
"system_prompt": "<string>",
"marketplace_prompt_id": "<string>",
"model_name": "claude-sonnet-5",
"fallback_models": ["<string>"],
"fallback_model_name": "<string>",
"auto_generate_prompt": False,
"max_tokens": 16000,
"temperature": 1,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [{}],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": False,
"llm_args": {},
"top_p": 123,
"dynamic_temperature_enabled": False,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"name": "<string>",
"tool_configurations": {},
"authorization_token": "<string>",
"api_key": "<string>",
"api_key_header": "Authorization",
"api_key_prefix": "Bearer",
"oauth": {
"grant_type": "authorization_code",
"client_id": "<string>",
"client_secret": "<string>",
"scopes": ["<string>"],
"redirect_uri": "http://127.0.0.1:8765/callback",
"client_name": "Swarms Agent",
"client_uri": "<string>",
"authorization_url": "<string>",
"token_url": "<string>",
"access_token": "<string>",
"refresh_token": "<string>",
"token_storage_path": "<string>",
"use_token_cache": True,
"open_browser": True,
"callback_timeout": 300
},
"transport": "streamable_http",
"headers": {},
"timeout": 30,
"sse_read_timeout": 300,
"tool_timeout": 120,
"command": "<string>",
"args": ["<string>"],
"env": {}
},
"mcp_configs": { "connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"name": "<string>",
"tool_configurations": {},
"authorization_token": "<string>",
"api_key": "<string>",
"api_key_header": "Authorization",
"api_key_prefix": "Bearer",
"oauth": {
"grant_type": "authorization_code",
"client_id": "<string>",
"client_secret": "<string>",
"scopes": ["<string>"],
"redirect_uri": "http://127.0.0.1:8765/callback",
"client_name": "Swarms Agent",
"client_uri": "<string>",
"authorization_url": "<string>",
"token_url": "<string>",
"access_token": "<string>",
"refresh_token": "<string>",
"token_storage_path": "<string>",
"use_token_cache": True,
"open_browser": True,
"callback_timeout": 300
},
"transport": "streamable_http",
"headers": {},
"timeout": 30,
"sse_read_timeout": 300,
"tool_timeout": 120,
"command": "<string>",
"args": ["<string>"],
"env": {}
}
] },
"tool_call_summary": True,
"thinking_tokens": 123,
"reasoning_enabled": False,
"publish_to_marketplace": False,
"use_cases": [{}],
"tags": ["<string>"],
"capabilities": ["<string>"],
"category": "<string>",
"is_free": True,
"price_usd": 123,
"handoffs": ["<unknown>"]
}
],
"max_loops": 1,
"rearrange_flow": "<string>",
"task": "<string>",
"img": "<string>",
"tasks": ["<string>"],
"messages": [{}],
"stream": False,
"heavy_swarm_question_agent_model_name": "gpt-4.1",
"heavy_swarm_worker_model_name": "claude-sonnet-4-20250514",
"heavy_swarm_variant": "default",
"council_judge_model_name": "gpt-5.4",
"chairman_model": "gpt-5.1",
"multi_agent_collab_prompt": True,
"heavy_swarm_max_loops": 1,
"list_all_agents": False,
"director_model_name": "gpt-5.4",
"director_settings": {}
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
agents: [
{
agent_name: '<string>',
description: '<string>',
system_prompt: '<string>',
marketplace_prompt_id: '<string>',
model_name: 'claude-sonnet-5',
fallback_models: ['<string>'],
fallback_model_name: '<string>',
auto_generate_prompt: false,
max_tokens: 16000,
temperature: 1,
role: 'worker',
max_loops: 1,
tools_list_dictionary: [{}],
selected_tools: '<string>',
mcp_url: '<string>',
streaming_on: false,
llm_args: {},
top_p: 123,
dynamic_temperature_enabled: false,
mcp_config: {
type: 'mcp',
url: 'http://localhost:8000/mcp',
name: '<string>',
tool_configurations: {},
authorization_token: '<string>',
api_key: '<string>',
api_key_header: 'Authorization',
api_key_prefix: 'Bearer',
oauth: {
grant_type: 'authorization_code',
client_id: '<string>',
client_secret: '<string>',
scopes: ['<string>'],
redirect_uri: 'http://127.0.0.1:8765/callback',
client_name: 'Swarms Agent',
client_uri: '<string>',
authorization_url: '<string>',
token_url: '<string>',
access_token: '<string>',
refresh_token: '<string>',
token_storage_path: '<string>',
use_token_cache: true,
open_browser: true,
callback_timeout: 300
},
transport: 'streamable_http',
headers: {},
timeout: 30,
sse_read_timeout: 300,
tool_timeout: 120,
command: '<string>',
args: ['<string>'],
env: {}
},
mcp_configs: {
connections: [
{
type: 'mcp',
url: 'http://localhost:8000/mcp',
name: '<string>',
tool_configurations: {},
authorization_token: '<string>',
api_key: '<string>',
api_key_header: 'Authorization',
api_key_prefix: 'Bearer',
oauth: {
grant_type: 'authorization_code',
client_id: '<string>',
client_secret: '<string>',
scopes: ['<string>'],
redirect_uri: 'http://127.0.0.1:8765/callback',
client_name: 'Swarms Agent',
client_uri: '<string>',
authorization_url: '<string>',
token_url: '<string>',
access_token: '<string>',
refresh_token: '<string>',
token_storage_path: '<string>',
use_token_cache: true,
open_browser: true,
callback_timeout: 300
},
transport: 'streamable_http',
headers: {},
timeout: 30,
sse_read_timeout: 300,
tool_timeout: 120,
command: '<string>',
args: ['<string>'],
env: {}
}
]
},
tool_call_summary: true,
thinking_tokens: 123,
reasoning_enabled: false,
publish_to_marketplace: false,
use_cases: [{}],
tags: ['<string>'],
capabilities: ['<string>'],
category: '<string>',
is_free: true,
price_usd: 123,
handoffs: ['<unknown>']
}
],
max_loops: 1,
rearrange_flow: '<string>',
task: '<string>',
img: '<string>',
tasks: ['<string>'],
messages: [{}],
stream: false,
heavy_swarm_question_agent_model_name: 'gpt-4.1',
heavy_swarm_worker_model_name: 'claude-sonnet-4-20250514',
heavy_swarm_variant: 'default',
council_judge_model_name: 'gpt-5.4',
chairman_model: 'gpt-5.1',
multi_agent_collab_prompt: true,
heavy_swarm_max_loops: 1,
list_all_agents: false,
director_model_name: 'gpt-5.4',
director_settings: {}
})
};
fetch('https://api.swarms.world/v1/swarm/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.swarms.world/v1/swarm/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'agents' => [
[
'agent_name' => '<string>',
'description' => '<string>',
'system_prompt' => '<string>',
'marketplace_prompt_id' => '<string>',
'model_name' => 'claude-sonnet-5',
'fallback_models' => [
'<string>'
],
'fallback_model_name' => '<string>',
'auto_generate_prompt' => false,
'max_tokens' => 16000,
'temperature' => 1,
'role' => 'worker',
'max_loops' => 1,
'tools_list_dictionary' => [
[
]
],
'selected_tools' => '<string>',
'mcp_url' => '<string>',
'streaming_on' => false,
'llm_args' => [
],
'top_p' => 123,
'dynamic_temperature_enabled' => false,
'mcp_config' => [
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'name' => '<string>',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'api_key' => '<string>',
'api_key_header' => 'Authorization',
'api_key_prefix' => 'Bearer',
'oauth' => [
'grant_type' => 'authorization_code',
'client_id' => '<string>',
'client_secret' => '<string>',
'scopes' => [
'<string>'
],
'redirect_uri' => 'http://127.0.0.1:8765/callback',
'client_name' => 'Swarms Agent',
'client_uri' => '<string>',
'authorization_url' => '<string>',
'token_url' => '<string>',
'access_token' => '<string>',
'refresh_token' => '<string>',
'token_storage_path' => '<string>',
'use_token_cache' => true,
'open_browser' => true,
'callback_timeout' => 300
],
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 30,
'sse_read_timeout' => 300,
'tool_timeout' => 120,
'command' => '<string>',
'args' => [
'<string>'
],
'env' => [
]
],
'mcp_configs' => [
'connections' => [
[
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'name' => '<string>',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'api_key' => '<string>',
'api_key_header' => 'Authorization',
'api_key_prefix' => 'Bearer',
'oauth' => [
'grant_type' => 'authorization_code',
'client_id' => '<string>',
'client_secret' => '<string>',
'scopes' => [
'<string>'
],
'redirect_uri' => 'http://127.0.0.1:8765/callback',
'client_name' => 'Swarms Agent',
'client_uri' => '<string>',
'authorization_url' => '<string>',
'token_url' => '<string>',
'access_token' => '<string>',
'refresh_token' => '<string>',
'token_storage_path' => '<string>',
'use_token_cache' => true,
'open_browser' => true,
'callback_timeout' => 300
],
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 30,
'sse_read_timeout' => 300,
'tool_timeout' => 120,
'command' => '<string>',
'args' => [
'<string>'
],
'env' => [
]
]
]
],
'tool_call_summary' => true,
'thinking_tokens' => 123,
'reasoning_enabled' => false,
'publish_to_marketplace' => false,
'use_cases' => [
[
]
],
'tags' => [
'<string>'
],
'capabilities' => [
'<string>'
],
'category' => '<string>',
'is_free' => true,
'price_usd' => 123,
'handoffs' => [
'<unknown>'
]
]
],
'max_loops' => 1,
'rearrange_flow' => '<string>',
'task' => '<string>',
'img' => '<string>',
'tasks' => [
'<string>'
],
'messages' => [
[
]
],
'stream' => false,
'heavy_swarm_question_agent_model_name' => 'gpt-4.1',
'heavy_swarm_worker_model_name' => 'claude-sonnet-4-20250514',
'heavy_swarm_variant' => 'default',
'council_judge_model_name' => 'gpt-5.4',
'chairman_model' => 'gpt-5.1',
'multi_agent_collab_prompt' => true,
'heavy_swarm_max_loops' => 1,
'list_all_agents' => false,
'director_model_name' => 'gpt-5.4',
'director_settings' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.swarms.world/v1/swarm/completions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"agents\": [\n {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"claude-sonnet-5\",\n \"fallback_models\": [\n \"<string>\"\n ],\n \"fallback_model_name\": \"<string>\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 16000,\n \"temperature\": 1,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"top_p\": 123,\n \"dynamic_temperature_enabled\": false,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n }\n ]\n },\n \"tool_call_summary\": true,\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n }\n ],\n \"max_loops\": 1,\n \"rearrange_flow\": \"<string>\",\n \"task\": \"<string>\",\n \"img\": \"<string>\",\n \"tasks\": [\n \"<string>\"\n ],\n \"messages\": [\n {}\n ],\n \"stream\": false,\n \"heavy_swarm_question_agent_model_name\": \"gpt-4.1\",\n \"heavy_swarm_worker_model_name\": \"claude-sonnet-4-20250514\",\n \"heavy_swarm_variant\": \"default\",\n \"council_judge_model_name\": \"gpt-5.4\",\n \"chairman_model\": \"gpt-5.1\",\n \"multi_agent_collab_prompt\": true,\n \"heavy_swarm_max_loops\": 1,\n \"list_all_agents\": false,\n \"director_model_name\": \"gpt-5.4\",\n \"director_settings\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.swarms.world/v1/swarm/completions")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"agents\": [\n {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"claude-sonnet-5\",\n \"fallback_models\": [\n \"<string>\"\n ],\n \"fallback_model_name\": \"<string>\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 16000,\n \"temperature\": 1,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"top_p\": 123,\n \"dynamic_temperature_enabled\": false,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n }\n ]\n },\n \"tool_call_summary\": true,\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n }\n ],\n \"max_loops\": 1,\n \"rearrange_flow\": \"<string>\",\n \"task\": \"<string>\",\n \"img\": \"<string>\",\n \"tasks\": [\n \"<string>\"\n ],\n \"messages\": [\n {}\n ],\n \"stream\": false,\n \"heavy_swarm_question_agent_model_name\": \"gpt-4.1\",\n \"heavy_swarm_worker_model_name\": \"claude-sonnet-4-20250514\",\n \"heavy_swarm_variant\": \"default\",\n \"council_judge_model_name\": \"gpt-5.4\",\n \"chairman_model\": \"gpt-5.1\",\n \"multi_agent_collab_prompt\": true,\n \"heavy_swarm_max_loops\": 1,\n \"list_all_agents\": false,\n \"director_model_name\": \"gpt-5.4\",\n \"director_settings\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/swarm/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"agents\": [\n {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"claude-sonnet-5\",\n \"fallback_models\": [\n \"<string>\"\n ],\n \"fallback_model_name\": \"<string>\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 16000,\n \"temperature\": 1,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"top_p\": 123,\n \"dynamic_temperature_enabled\": false,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n }\n ]\n },\n \"tool_call_summary\": true,\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n }\n ],\n \"max_loops\": 1,\n \"rearrange_flow\": \"<string>\",\n \"task\": \"<string>\",\n \"img\": \"<string>\",\n \"tasks\": [\n \"<string>\"\n ],\n \"messages\": [\n {}\n ],\n \"stream\": false,\n \"heavy_swarm_question_agent_model_name\": \"gpt-4.1\",\n \"heavy_swarm_worker_model_name\": \"claude-sonnet-4-20250514\",\n \"heavy_swarm_variant\": \"default\",\n \"council_judge_model_name\": \"gpt-5.4\",\n \"chairman_model\": \"gpt-5.1\",\n \"multi_agent_collab_prompt\": true,\n \"heavy_swarm_max_loops\": 1,\n \"list_all_agents\": false,\n \"director_model_name\": \"gpt-5.4\",\n \"director_settings\": {}\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "<string>",
"swarm_name": "<string>",
"description": "<string>",
"swarm_type": "<string>",
"output": "<unknown>",
"number_of_agents": 123,
"execution_time": 123,
"usage": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Execute Swarm Completion
Execute a swarm completion with the specified task. Supports both standard and streaming responses.
curl --request POST \
--url https://api.swarms.world/v1/swarm/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"agents": [
{
"agent_name": "<string>",
"description": "<string>",
"system_prompt": "<string>",
"marketplace_prompt_id": "<string>",
"model_name": "claude-sonnet-5",
"fallback_models": [
"<string>"
],
"fallback_model_name": "<string>",
"auto_generate_prompt": false,
"max_tokens": 16000,
"temperature": 1,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [
{}
],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": false,
"llm_args": {},
"top_p": 123,
"dynamic_temperature_enabled": false,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"name": "<string>",
"tool_configurations": {},
"authorization_token": "<string>",
"api_key": "<string>",
"api_key_header": "Authorization",
"api_key_prefix": "Bearer",
"oauth": {
"grant_type": "authorization_code",
"client_id": "<string>",
"client_secret": "<string>",
"scopes": [
"<string>"
],
"redirect_uri": "http://127.0.0.1:8765/callback",
"client_name": "Swarms Agent",
"client_uri": "<string>",
"authorization_url": "<string>",
"token_url": "<string>",
"access_token": "<string>",
"refresh_token": "<string>",
"token_storage_path": "<string>",
"use_token_cache": true,
"open_browser": true,
"callback_timeout": 300
},
"transport": "streamable_http",
"headers": {},
"timeout": 30,
"sse_read_timeout": 300,
"tool_timeout": 120,
"command": "<string>",
"args": [
"<string>"
],
"env": {}
},
"mcp_configs": {
"connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"name": "<string>",
"tool_configurations": {},
"authorization_token": "<string>",
"api_key": "<string>",
"api_key_header": "Authorization",
"api_key_prefix": "Bearer",
"oauth": {
"grant_type": "authorization_code",
"client_id": "<string>",
"client_secret": "<string>",
"scopes": [
"<string>"
],
"redirect_uri": "http://127.0.0.1:8765/callback",
"client_name": "Swarms Agent",
"client_uri": "<string>",
"authorization_url": "<string>",
"token_url": "<string>",
"access_token": "<string>",
"refresh_token": "<string>",
"token_storage_path": "<string>",
"use_token_cache": true,
"open_browser": true,
"callback_timeout": 300
},
"transport": "streamable_http",
"headers": {},
"timeout": 30,
"sse_read_timeout": 300,
"tool_timeout": 120,
"command": "<string>",
"args": [
"<string>"
],
"env": {}
}
]
},
"tool_call_summary": true,
"thinking_tokens": 123,
"reasoning_enabled": false,
"publish_to_marketplace": false,
"use_cases": [
{}
],
"tags": [
"<string>"
],
"capabilities": [
"<string>"
],
"category": "<string>",
"is_free": true,
"price_usd": 123,
"handoffs": [
"<unknown>"
]
}
],
"max_loops": 1,
"rearrange_flow": "<string>",
"task": "<string>",
"img": "<string>",
"tasks": [
"<string>"
],
"messages": [
{}
],
"stream": false,
"heavy_swarm_question_agent_model_name": "gpt-4.1",
"heavy_swarm_worker_model_name": "claude-sonnet-4-20250514",
"heavy_swarm_variant": "default",
"council_judge_model_name": "gpt-5.4",
"chairman_model": "gpt-5.1",
"multi_agent_collab_prompt": true,
"heavy_swarm_max_loops": 1,
"list_all_agents": false,
"director_model_name": "gpt-5.4",
"director_settings": {}
}
'import requests
url = "https://api.swarms.world/v1/swarm/completions"
payload = {
"name": "<string>",
"description": "<string>",
"agents": [
{
"agent_name": "<string>",
"description": "<string>",
"system_prompt": "<string>",
"marketplace_prompt_id": "<string>",
"model_name": "claude-sonnet-5",
"fallback_models": ["<string>"],
"fallback_model_name": "<string>",
"auto_generate_prompt": False,
"max_tokens": 16000,
"temperature": 1,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [{}],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": False,
"llm_args": {},
"top_p": 123,
"dynamic_temperature_enabled": False,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"name": "<string>",
"tool_configurations": {},
"authorization_token": "<string>",
"api_key": "<string>",
"api_key_header": "Authorization",
"api_key_prefix": "Bearer",
"oauth": {
"grant_type": "authorization_code",
"client_id": "<string>",
"client_secret": "<string>",
"scopes": ["<string>"],
"redirect_uri": "http://127.0.0.1:8765/callback",
"client_name": "Swarms Agent",
"client_uri": "<string>",
"authorization_url": "<string>",
"token_url": "<string>",
"access_token": "<string>",
"refresh_token": "<string>",
"token_storage_path": "<string>",
"use_token_cache": True,
"open_browser": True,
"callback_timeout": 300
},
"transport": "streamable_http",
"headers": {},
"timeout": 30,
"sse_read_timeout": 300,
"tool_timeout": 120,
"command": "<string>",
"args": ["<string>"],
"env": {}
},
"mcp_configs": { "connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"name": "<string>",
"tool_configurations": {},
"authorization_token": "<string>",
"api_key": "<string>",
"api_key_header": "Authorization",
"api_key_prefix": "Bearer",
"oauth": {
"grant_type": "authorization_code",
"client_id": "<string>",
"client_secret": "<string>",
"scopes": ["<string>"],
"redirect_uri": "http://127.0.0.1:8765/callback",
"client_name": "Swarms Agent",
"client_uri": "<string>",
"authorization_url": "<string>",
"token_url": "<string>",
"access_token": "<string>",
"refresh_token": "<string>",
"token_storage_path": "<string>",
"use_token_cache": True,
"open_browser": True,
"callback_timeout": 300
},
"transport": "streamable_http",
"headers": {},
"timeout": 30,
"sse_read_timeout": 300,
"tool_timeout": 120,
"command": "<string>",
"args": ["<string>"],
"env": {}
}
] },
"tool_call_summary": True,
"thinking_tokens": 123,
"reasoning_enabled": False,
"publish_to_marketplace": False,
"use_cases": [{}],
"tags": ["<string>"],
"capabilities": ["<string>"],
"category": "<string>",
"is_free": True,
"price_usd": 123,
"handoffs": ["<unknown>"]
}
],
"max_loops": 1,
"rearrange_flow": "<string>",
"task": "<string>",
"img": "<string>",
"tasks": ["<string>"],
"messages": [{}],
"stream": False,
"heavy_swarm_question_agent_model_name": "gpt-4.1",
"heavy_swarm_worker_model_name": "claude-sonnet-4-20250514",
"heavy_swarm_variant": "default",
"council_judge_model_name": "gpt-5.4",
"chairman_model": "gpt-5.1",
"multi_agent_collab_prompt": True,
"heavy_swarm_max_loops": 1,
"list_all_agents": False,
"director_model_name": "gpt-5.4",
"director_settings": {}
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
agents: [
{
agent_name: '<string>',
description: '<string>',
system_prompt: '<string>',
marketplace_prompt_id: '<string>',
model_name: 'claude-sonnet-5',
fallback_models: ['<string>'],
fallback_model_name: '<string>',
auto_generate_prompt: false,
max_tokens: 16000,
temperature: 1,
role: 'worker',
max_loops: 1,
tools_list_dictionary: [{}],
selected_tools: '<string>',
mcp_url: '<string>',
streaming_on: false,
llm_args: {},
top_p: 123,
dynamic_temperature_enabled: false,
mcp_config: {
type: 'mcp',
url: 'http://localhost:8000/mcp',
name: '<string>',
tool_configurations: {},
authorization_token: '<string>',
api_key: '<string>',
api_key_header: 'Authorization',
api_key_prefix: 'Bearer',
oauth: {
grant_type: 'authorization_code',
client_id: '<string>',
client_secret: '<string>',
scopes: ['<string>'],
redirect_uri: 'http://127.0.0.1:8765/callback',
client_name: 'Swarms Agent',
client_uri: '<string>',
authorization_url: '<string>',
token_url: '<string>',
access_token: '<string>',
refresh_token: '<string>',
token_storage_path: '<string>',
use_token_cache: true,
open_browser: true,
callback_timeout: 300
},
transport: 'streamable_http',
headers: {},
timeout: 30,
sse_read_timeout: 300,
tool_timeout: 120,
command: '<string>',
args: ['<string>'],
env: {}
},
mcp_configs: {
connections: [
{
type: 'mcp',
url: 'http://localhost:8000/mcp',
name: '<string>',
tool_configurations: {},
authorization_token: '<string>',
api_key: '<string>',
api_key_header: 'Authorization',
api_key_prefix: 'Bearer',
oauth: {
grant_type: 'authorization_code',
client_id: '<string>',
client_secret: '<string>',
scopes: ['<string>'],
redirect_uri: 'http://127.0.0.1:8765/callback',
client_name: 'Swarms Agent',
client_uri: '<string>',
authorization_url: '<string>',
token_url: '<string>',
access_token: '<string>',
refresh_token: '<string>',
token_storage_path: '<string>',
use_token_cache: true,
open_browser: true,
callback_timeout: 300
},
transport: 'streamable_http',
headers: {},
timeout: 30,
sse_read_timeout: 300,
tool_timeout: 120,
command: '<string>',
args: ['<string>'],
env: {}
}
]
},
tool_call_summary: true,
thinking_tokens: 123,
reasoning_enabled: false,
publish_to_marketplace: false,
use_cases: [{}],
tags: ['<string>'],
capabilities: ['<string>'],
category: '<string>',
is_free: true,
price_usd: 123,
handoffs: ['<unknown>']
}
],
max_loops: 1,
rearrange_flow: '<string>',
task: '<string>',
img: '<string>',
tasks: ['<string>'],
messages: [{}],
stream: false,
heavy_swarm_question_agent_model_name: 'gpt-4.1',
heavy_swarm_worker_model_name: 'claude-sonnet-4-20250514',
heavy_swarm_variant: 'default',
council_judge_model_name: 'gpt-5.4',
chairman_model: 'gpt-5.1',
multi_agent_collab_prompt: true,
heavy_swarm_max_loops: 1,
list_all_agents: false,
director_model_name: 'gpt-5.4',
director_settings: {}
})
};
fetch('https://api.swarms.world/v1/swarm/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.swarms.world/v1/swarm/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'agents' => [
[
'agent_name' => '<string>',
'description' => '<string>',
'system_prompt' => '<string>',
'marketplace_prompt_id' => '<string>',
'model_name' => 'claude-sonnet-5',
'fallback_models' => [
'<string>'
],
'fallback_model_name' => '<string>',
'auto_generate_prompt' => false,
'max_tokens' => 16000,
'temperature' => 1,
'role' => 'worker',
'max_loops' => 1,
'tools_list_dictionary' => [
[
]
],
'selected_tools' => '<string>',
'mcp_url' => '<string>',
'streaming_on' => false,
'llm_args' => [
],
'top_p' => 123,
'dynamic_temperature_enabled' => false,
'mcp_config' => [
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'name' => '<string>',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'api_key' => '<string>',
'api_key_header' => 'Authorization',
'api_key_prefix' => 'Bearer',
'oauth' => [
'grant_type' => 'authorization_code',
'client_id' => '<string>',
'client_secret' => '<string>',
'scopes' => [
'<string>'
],
'redirect_uri' => 'http://127.0.0.1:8765/callback',
'client_name' => 'Swarms Agent',
'client_uri' => '<string>',
'authorization_url' => '<string>',
'token_url' => '<string>',
'access_token' => '<string>',
'refresh_token' => '<string>',
'token_storage_path' => '<string>',
'use_token_cache' => true,
'open_browser' => true,
'callback_timeout' => 300
],
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 30,
'sse_read_timeout' => 300,
'tool_timeout' => 120,
'command' => '<string>',
'args' => [
'<string>'
],
'env' => [
]
],
'mcp_configs' => [
'connections' => [
[
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'name' => '<string>',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'api_key' => '<string>',
'api_key_header' => 'Authorization',
'api_key_prefix' => 'Bearer',
'oauth' => [
'grant_type' => 'authorization_code',
'client_id' => '<string>',
'client_secret' => '<string>',
'scopes' => [
'<string>'
],
'redirect_uri' => 'http://127.0.0.1:8765/callback',
'client_name' => 'Swarms Agent',
'client_uri' => '<string>',
'authorization_url' => '<string>',
'token_url' => '<string>',
'access_token' => '<string>',
'refresh_token' => '<string>',
'token_storage_path' => '<string>',
'use_token_cache' => true,
'open_browser' => true,
'callback_timeout' => 300
],
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 30,
'sse_read_timeout' => 300,
'tool_timeout' => 120,
'command' => '<string>',
'args' => [
'<string>'
],
'env' => [
]
]
]
],
'tool_call_summary' => true,
'thinking_tokens' => 123,
'reasoning_enabled' => false,
'publish_to_marketplace' => false,
'use_cases' => [
[
]
],
'tags' => [
'<string>'
],
'capabilities' => [
'<string>'
],
'category' => '<string>',
'is_free' => true,
'price_usd' => 123,
'handoffs' => [
'<unknown>'
]
]
],
'max_loops' => 1,
'rearrange_flow' => '<string>',
'task' => '<string>',
'img' => '<string>',
'tasks' => [
'<string>'
],
'messages' => [
[
]
],
'stream' => false,
'heavy_swarm_question_agent_model_name' => 'gpt-4.1',
'heavy_swarm_worker_model_name' => 'claude-sonnet-4-20250514',
'heavy_swarm_variant' => 'default',
'council_judge_model_name' => 'gpt-5.4',
'chairman_model' => 'gpt-5.1',
'multi_agent_collab_prompt' => true,
'heavy_swarm_max_loops' => 1,
'list_all_agents' => false,
'director_model_name' => 'gpt-5.4',
'director_settings' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.swarms.world/v1/swarm/completions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"agents\": [\n {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"claude-sonnet-5\",\n \"fallback_models\": [\n \"<string>\"\n ],\n \"fallback_model_name\": \"<string>\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 16000,\n \"temperature\": 1,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"top_p\": 123,\n \"dynamic_temperature_enabled\": false,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n }\n ]\n },\n \"tool_call_summary\": true,\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n }\n ],\n \"max_loops\": 1,\n \"rearrange_flow\": \"<string>\",\n \"task\": \"<string>\",\n \"img\": \"<string>\",\n \"tasks\": [\n \"<string>\"\n ],\n \"messages\": [\n {}\n ],\n \"stream\": false,\n \"heavy_swarm_question_agent_model_name\": \"gpt-4.1\",\n \"heavy_swarm_worker_model_name\": \"claude-sonnet-4-20250514\",\n \"heavy_swarm_variant\": \"default\",\n \"council_judge_model_name\": \"gpt-5.4\",\n \"chairman_model\": \"gpt-5.1\",\n \"multi_agent_collab_prompt\": true,\n \"heavy_swarm_max_loops\": 1,\n \"list_all_agents\": false,\n \"director_model_name\": \"gpt-5.4\",\n \"director_settings\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.swarms.world/v1/swarm/completions")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"agents\": [\n {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"claude-sonnet-5\",\n \"fallback_models\": [\n \"<string>\"\n ],\n \"fallback_model_name\": \"<string>\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 16000,\n \"temperature\": 1,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"top_p\": 123,\n \"dynamic_temperature_enabled\": false,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n }\n ]\n },\n \"tool_call_summary\": true,\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n }\n ],\n \"max_loops\": 1,\n \"rearrange_flow\": \"<string>\",\n \"task\": \"<string>\",\n \"img\": \"<string>\",\n \"tasks\": [\n \"<string>\"\n ],\n \"messages\": [\n {}\n ],\n \"stream\": false,\n \"heavy_swarm_question_agent_model_name\": \"gpt-4.1\",\n \"heavy_swarm_worker_model_name\": \"claude-sonnet-4-20250514\",\n \"heavy_swarm_variant\": \"default\",\n \"council_judge_model_name\": \"gpt-5.4\",\n \"chairman_model\": \"gpt-5.1\",\n \"multi_agent_collab_prompt\": true,\n \"heavy_swarm_max_loops\": 1,\n \"list_all_agents\": false,\n \"director_model_name\": \"gpt-5.4\",\n \"director_settings\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/swarm/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"agents\": [\n {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"claude-sonnet-5\",\n \"fallback_models\": [\n \"<string>\"\n ],\n \"fallback_model_name\": \"<string>\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 16000,\n \"temperature\": 1,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"top_p\": 123,\n \"dynamic_temperature_enabled\": false,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"name\": \"<string>\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"api_key\": \"<string>\",\n \"api_key_header\": \"Authorization\",\n \"api_key_prefix\": \"Bearer\",\n \"oauth\": {\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"redirect_uri\": \"http://127.0.0.1:8765/callback\",\n \"client_name\": \"Swarms Agent\",\n \"client_uri\": \"<string>\",\n \"authorization_url\": \"<string>\",\n \"token_url\": \"<string>\",\n \"access_token\": \"<string>\",\n \"refresh_token\": \"<string>\",\n \"token_storage_path\": \"<string>\",\n \"use_token_cache\": true,\n \"open_browser\": true,\n \"callback_timeout\": 300\n },\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 30,\n \"sse_read_timeout\": 300,\n \"tool_timeout\": 120,\n \"command\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"env\": {}\n }\n ]\n },\n \"tool_call_summary\": true,\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n }\n ],\n \"max_loops\": 1,\n \"rearrange_flow\": \"<string>\",\n \"task\": \"<string>\",\n \"img\": \"<string>\",\n \"tasks\": [\n \"<string>\"\n ],\n \"messages\": [\n {}\n ],\n \"stream\": false,\n \"heavy_swarm_question_agent_model_name\": \"gpt-4.1\",\n \"heavy_swarm_worker_model_name\": \"claude-sonnet-4-20250514\",\n \"heavy_swarm_variant\": \"default\",\n \"council_judge_model_name\": \"gpt-5.4\",\n \"chairman_model\": \"gpt-5.1\",\n \"multi_agent_collab_prompt\": true,\n \"heavy_swarm_max_loops\": 1,\n \"list_all_agents\": false,\n \"director_model_name\": \"gpt-5.4\",\n \"director_settings\": {}\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "<string>",
"swarm_name": "<string>",
"description": "<string>",
"swarm_type": "<string>",
"output": "<unknown>",
"number_of_agents": 123,
"execution_time": 123,
"usage": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Body
The name of the swarm, which serves as an identifier for the group of agents and their collective task.
100A comprehensive description of the swarm's objectives, capabilities, and intended outcomes.
A list of agents or specifications that define the agents participating in the swarm.
Show child attributes
Show child attributes
The maximum number of execution loops allowed for the swarm, enabling repeated processing if needed.
The classification of the swarm, indicating its operational style and methodology.
AgentRearrange, MixtureOfAgents, SequentialWorkflow, ConcurrentWorkflow, GroupChat, MultiAgentRouter, HierarchicalSwarm, auto, MajorityVoting, CouncilAsAJudge, HeavySwarm, BatchedGridWorkflow, LLMCouncil, DebateWithJudge, RoundRobin, PlannerWorkerSwarm Instructions on how to rearrange the flow of tasks among agents, if applicable.
The specific task or objective that the swarm is designed to accomplish.
An optional image URL that may be associated with the swarm's task or representation.
A list of tasks that the swarm should complete.
- Messages · object[]
- Messages · object
A flag indicating whether the swarm should stream its output.
The model name to use for the question agent in the heavy swarm.
The model name to use for the worker agent in the heavy swarm.
For HeavySwarm: which agent variant to run. One of 'default', 'medium', or 'heavy'.
default, medium, heavy For CouncilAsAJudge: the model name used by the judge that delivers the final ruling.
For LLMCouncil: the model name used by the chairman that synthesizes the council's responses.
Inject the multi-agent collaboration prompt so agents coordinate with one another. Set False to disable.
For HeavySwarm: the maximum number of loops each agent in the heavy swarm may run.
Whether to list all agents and their descriptions to one another so each agent is aware of the others.
The model name to use for the director/overseer agent (if any). For HierarchicalSwarm, this is the model name of the director.
Optional settings or hyperparameters for the director agent. For HierarchicalSwarm, this is the settings of the director. You can set temperature, top_p, max_tokens, etc.
Response
Successful Response
The unique identifier for the swarm completion.
The status of the swarm completion.
The name of the swarm.
The description of the swarm.
The type of the swarm.
The output of the swarm.
The number of agents in the swarm.
The execution time of the swarm.
The usage of the swarm.
Was this page helpful?