Skip to content
Create a custom integration

Create a custom integration

Create and enable a new custom integration and its selected World switches.

POST/api/v1/custom-integrations

Request#

TypeScript
const response = await fetch("https://api.smallworld.sh/api/v1/custom-integrations", {
  method: "POST",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({
  "key": "example",
  "name": "Example",
  "description": "Record lookup",
  "endpointUrl": "https://tools.example.com/tools",
  "tools": [
    {
      "name": "lookup",
      "description": "Look up a record",
      "inputSchema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      }
    }
  ],
  "worldIds": [
    "2d1f771b-4f3a-429c-a96c-5316cb55fa30"
  ]
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();

Use your server-side apiKey. Replace the example IDs.

Request body#

keystringrequired

Command key: 2–32 lowercase letters, digits, or hyphens, starting with a letter. Reserved commands and existing custom/MCP keys are rejected.

namestringrequired

Non-empty display name, at most 60 characters.

descriptionstring

Description, at most 500 characters. Defaults to an empty string.

endpointUrlstringrequired

Public HTTPS endpoint. Local development also accepts loopback HTTP; URLs cannot contain credentials or fragments.

timeoutMsinteger

Call timeout from 1000 to 60000 milliseconds; defaults to 30000.

headersobject

Up to 10 static headers. Values are write-only. Omit during updates to retain them; use an empty object to clear them. Routing, signing, and other reserved headers are rejected.

toolsarrayrequired

Up to 100 OpenAI, Anthropic, or MCP tool definitions, each at most 64 KiB.

worldIdsUUID[]

Worlds in this workspace where the new integration is enabled; defaults to none.

draftTokenstring

Reuse a valid setup draft's signing secret instead of generating a new one.

Responses#

Returns the configuration, original tool definitions, generated command names, enablement, and timestamps. Static header values and the saved signing secret are never readable; headerNames lists names only. Creation additionally returns signingSecret once.

201 response
{
  "key": "example",
  "name": "Example",
  "description": "Record lookup",
  "endpointUrl": "https://tools.example.com/tools",
  "timeoutMs": 30000,
  "headerNames": [
    "x-api-key"
  ],
  "enabled": true,
  "tools": [
    {
      "name": "lookup",
      "description": "Look up a record",
      "inputSchema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      }
    }
  ],
  "commands": [
    {
      "name": "lookup",
      "command": "lookup",
      "mode": "unknown"
    }
  ],
  "createdAt": "2026-10-22T10:00:00.000Z",
  "updatedAt": "2026-10-22T10:00:00.000Z",
  "signingSecret": "whsec_save_this_once"
}
More about this endpoint

Authenticate with a workspace API key. Unknown body fields and query parameters are rejected.