Register Agent
POST /register | Auth: None
Register a new agent with the Suwappu platform. Returns an API key that must be used to authenticate all subsequent requests.
Request
Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique agent name. 3-50 characters. Must match ^[a-zA-Z0-9_-]+$ (alphanumeric, hyphens, underscores only). |
description | string | No | Human-readable description of the agent. Max 500 characters. |
callback_url | string (URI) | No | Webhook URL for receiving async notifications. Must be a valid URI. |
metadata | object | No | Arbitrary key-value pairs for custom agent data. |
Example
{
"hl-key">"name": "my-trading-bot",
"hl-key">"description": "Automated portfolio rebalancer for DeFi positions",
"hl-key">"callback_url": "https://example.com/webhooks/suwappu",
"hl-key">"metadata": {
"hl-key">"version": "1.0.0",
"hl-key">"environment": "production"
}
}
Response
Status: 201 CreatedFields
| Field | Type | Description |
|---|---|---|
success | boolean | Always true. |
agent.id | string (UUID) | Unique agent identifier. |
agent.name | string | The registered agent name. |
agent.api_key | string | API key for authentication. Prefixed with suwappu_sk_. Store this securely -- it is only returned once. |
agent.created_at | string (ISO 8601) | Timestamp of registration. |
Example
{
"hl-key">"success": true,
"hl-key">"agent": {
"hl-key">"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"hl-key">"name": "my-trading-bot",
"hl-key">"api_key": "suwappu_sk_live_7f3a9b2c1d4e5f6a8b0c9d2e3f4a5b6c",
"hl-key">"created_at": "2026-03-07T12:00:00Z"
}
}
Important: The
api_keyis only returned in this response. Store it securely. If lost, you must register a new agent.
Errors
| Status | Error | Description |
|---|---|---|
| 400 | "Agent name 'my-bot' is already taken" | Another agent already uses this name. Choose a different one. |
| 400 | "Validation failed" | One or more fields failed validation. Check the fields object for details. |
Validation Error Example
{
"hl-key">"success": false,
"hl-key">"error": "Validation failed",
"hl-key">"fields": {
"hl-key">"name": "Must be 3-50 characters and contain only letters, numbers, hyphens, and underscores",
"hl-key">"callback_url": "Must be a valid URI"
}
}
Name Conflict Example
{
"hl-key">"success": false,
"hl-key">"error": "Agent name 'my-trading-bot' is already taken"
}
Code Examples
curl
-kw">curl -X POST https://api.suwappu.bot/v1/agent/register \
-H -str">"Content-Type: application/json" \
-d -str">'{
-str">"name": -str">"my-trading-bot",
-str">"description": -str">"Automated portfolio rebalancer",
-str">"callback_url": -str">"https://example.com/webhooks/suwappu"
}'
Python
import requests
response = requests.post(
class="hl-str">"https:class="hl-commentclass="hl-str">">//api.suwappu.bot/v1/agent/register",
json={
class="hl-str">"name": class="hl-str">"my-trading-bot",
class="hl-str">"description": class="hl-str">"Automated portfolio rebalancer",
class="hl-str">"callback_url": class="hl-str">"https:class="hl-commentclass="hl-str">">//example.com/webhooks/suwappu",
},
)
data = response.json()
api_key = data[class="hl-str">"agent"][class="hl-str">"api_key"]
print(fclass="hl-str">"API Key: {api_key}") class=class="hl-str">"hl-comment"># Store this securely
TypeScript
const response = await fetch(class="hl-str">"https:class="hl-commentclass="hl-str">">//api.suwappu.bot/v1/agent/register", {
method: class="hl-str">"POST",
headers: { class="hl-str">"Content-Type": class="hl-str">"application/json" },
body: JSON.stringify({
name: class="hl-str">"my-trading-bot",
description: class="hl-str">"Automated portfolio rebalancer",
callback_url: class="hl-str">"https:class="hl-commentclass="hl-str">">//example.com/webhooks/suwappu",
}),
});
const data = await response.json();
const apiKey = data.agent.api_key; class=class="hl-str">"hl-comment">// Store this securely