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": "gpt-4.1",
"auto_generate_prompt": false,
"max_tokens": 8192,
"temperature": 123,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [
{}
],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": false,
"llm_args": {},
"dynamic_temperature_enabled": true,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
},
"mcp_configs": {
"connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
}
]
},
"tool_call_summary": true,
"reasoning_effort": "low",
"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
}
'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": "gpt-4.1",
"auto_generate_prompt": False,
"max_tokens": 8192,
"temperature": 123,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [{}],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": False,
"llm_args": {},
"dynamic_temperature_enabled": True,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
},
"mcp_configs": { "connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
}
] },
"tool_call_summary": True,
"reasoning_effort": "low",
"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
}
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: 'gpt-4.1',
auto_generate_prompt: false,
max_tokens: 8192,
temperature: 123,
role: 'worker',
max_loops: 1,
tools_list_dictionary: [{}],
selected_tools: '<string>',
mcp_url: '<string>',
streaming_on: false,
llm_args: {},
dynamic_temperature_enabled: true,
mcp_config: {
type: 'mcp',
url: 'http://localhost:8000/mcp',
tool_configurations: {},
authorization_token: '<string>',
transport: 'streamable_http',
headers: {},
timeout: 10
},
mcp_configs: {
connections: [
{
type: 'mcp',
url: 'http://localhost:8000/mcp',
tool_configurations: {},
authorization_token: '<string>',
transport: 'streamable_http',
headers: {},
timeout: 10
}
]
},
tool_call_summary: true,
reasoning_effort: 'low',
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
})
};
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' => 'gpt-4.1',
'auto_generate_prompt' => false,
'max_tokens' => 8192,
'temperature' => 123,
'role' => 'worker',
'max_loops' => 1,
'tools_list_dictionary' => [
[
]
],
'selected_tools' => '<string>',
'mcp_url' => '<string>',
'streaming_on' => false,
'llm_args' => [
],
'dynamic_temperature_enabled' => true,
'mcp_config' => [
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 10
],
'mcp_configs' => [
'connections' => [
[
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 10
]
]
],
'tool_call_summary' => true,
'reasoning_effort' => 'low',
'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
]),
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\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\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 \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\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}")
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\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\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 \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\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}")
.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\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\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 \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\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}"
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": "gpt-4.1",
"auto_generate_prompt": false,
"max_tokens": 8192,
"temperature": 123,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [
{}
],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": false,
"llm_args": {},
"dynamic_temperature_enabled": true,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
},
"mcp_configs": {
"connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
}
]
},
"tool_call_summary": true,
"reasoning_effort": "low",
"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
}
'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": "gpt-4.1",
"auto_generate_prompt": False,
"max_tokens": 8192,
"temperature": 123,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [{}],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": False,
"llm_args": {},
"dynamic_temperature_enabled": True,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
},
"mcp_configs": { "connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
}
] },
"tool_call_summary": True,
"reasoning_effort": "low",
"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
}
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: 'gpt-4.1',
auto_generate_prompt: false,
max_tokens: 8192,
temperature: 123,
role: 'worker',
max_loops: 1,
tools_list_dictionary: [{}],
selected_tools: '<string>',
mcp_url: '<string>',
streaming_on: false,
llm_args: {},
dynamic_temperature_enabled: true,
mcp_config: {
type: 'mcp',
url: 'http://localhost:8000/mcp',
tool_configurations: {},
authorization_token: '<string>',
transport: 'streamable_http',
headers: {},
timeout: 10
},
mcp_configs: {
connections: [
{
type: 'mcp',
url: 'http://localhost:8000/mcp',
tool_configurations: {},
authorization_token: '<string>',
transport: 'streamable_http',
headers: {},
timeout: 10
}
]
},
tool_call_summary: true,
reasoning_effort: 'low',
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
})
};
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' => 'gpt-4.1',
'auto_generate_prompt' => false,
'max_tokens' => 8192,
'temperature' => 123,
'role' => 'worker',
'max_loops' => 1,
'tools_list_dictionary' => [
[
]
],
'selected_tools' => '<string>',
'mcp_url' => '<string>',
'streaming_on' => false,
'llm_args' => [
],
'dynamic_temperature_enabled' => true,
'mcp_config' => [
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 10
],
'mcp_configs' => [
'connections' => [
[
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 10
]
]
],
'tool_call_summary' => true,
'reasoning_effort' => 'low',
'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
]),
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\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\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 \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\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}")
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\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\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 \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\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}")
.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\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\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 \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\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}"
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, AutoSwarmBuilder, 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'.
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.
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?