All Products
Search
Document Center

Qoder CN Series:Create a template

Last Updated:Jul 15, 2026

Create a Forward template baseline for future sessions.

Request headers

Header

Required

Description

Authorization

Yes

Bearer <PAT>

Content-Type

Yes

application/json

Idempotency-Key

No

Optional idempotency key for state-changing requests.

Request body

Parameter

Type

Required

Description

name

string

Yes

Template name. Must be 1-256 characters and unique within the account.

model

string

Yes

Model identifier, such as ultimate.

environment_id

string

Yes

Default environment applied to sessions created from this template.

description

string

No

Template description. Up to 2,048 characters.

system

string

No

System prompt. Up to 100,000 characters.

tools

array

No

Tool configurations. Up to 128 items.

mcp_servers

array

No

MCP server configurations. Up to 20 items.

skills

array

No

Skill bindings. Up to 20 items.

multiagent

object

No

Managed Agents configuration.

vault_ids

array

No

Default vault IDs applied to sessions.

files

object

No

Default file resources, keyed by file ID.

environment_variables

object|string

No

Default environment variables for sessions.

metadata

object

No

Custom metadata.

Nested configuration objects

Files

files is a map keyed by file ID. Do not include file_id, id, or resource_id inside each entry. Forward injects mount_path automatically when a session starts.

Field

Type

Required

Description

enabled

boolean

No

Omitting the field is equivalent to true. In an Identity Config, set false to disable an inherited file.

tools[] items

Each entry in tools selects a shape based on type.

Field

Type

Applies to

Description

type

string

All

Required. One of agent_toolset_20260401, mcp_toolset, or custom.

enabled_tools

array

agent_toolset_20260401

Convenience allowlist. A non-empty array enables only the listed built-in tools.

disallowed_tools

array

agent_toolset_20260401

Convenience denylist. Compiled into disabled tool configs.

configs

array

agent_toolset_20260401, mcp_toolset

Per-tool enable state and permission policy.

mcp_server_name

string

mcp_toolset

Required. Must match one of the mcp_servers[].name values.

name

string

custom

Required. Custom tool name; must not collide with a built-in tool name.

description

string

custom

Required. Human-readable description of the custom tool.

input_schema

object

custom

Required JSON Schema. input_schema.type must be object.

Built-in tool names include Bash, Read, Write, Edit, Glob, Grep, WebFetch, WebSearch, and DeliverArtifacts.

Tool config

Each entry in tools[].configs uses the following shape.

Field

Type

Required

Description

name

string

Yes

Tool name. Use the built-in tool name for a built-in toolset, or the MCP tool name for an MCP toolset.

enabled

boolean

No

false hides and denies the tool; true enables it explicitly.

permission_policy

object

No

Runtime permission behavior.

Permission policy

Field

Type

Required

Description

type

string

Yes

One of always_allow, always_ask, or always_deny.

MCP servers

Field

Type

Required

Description

type

string

No

Only http is currently supported. When omitted, the effective config treats the entry as an HTTP MCP server.

name

string

Yes

MCP server name, unique within the template. Referenced by tools[].mcp_server_name.

url

string

Yes

Streamable HTTP MCP endpoint URL.

skills[] items

Field

Type

Required

Description

type

string

Yes

Either custom or qoder.

skill_id

string

Yes

Skill ID.

version

string

No

Skill version. Falls back to the latest version when omitted.

enabled

boolean

No

Omitting the field is equivalent to true. Set false to exclude the skill from the compiled agent config.

Example request

curl -s -X POST 'https://api.qoder.com.cn/api/v1/forward/templates' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support assistant",
    "description": "Handles pre-sales and after-sales support",
    "model": "ultimate",
    "system": "You are a helpful support assistant.",
    "tools": [
      {
        "type": "agent_toolset_20260401",
        "configs": [
          { "name": "Read", "enabled": true },
          { "name": "Grep", "enabled": true },
          { "name": "WebSearch", "enabled": true }
        ]
      }
    ],
    "mcp_servers": [],
    "skills": [
      {
        "type": "custom",
        "skill_id": "skill_customer_reply",
        "version": "1",
        "enabled": true
      }
    ],
    "environment_id": "env_support",
    "vault_ids": ["vault_crm"],
    "files": {
      "file_019eXXXX": { "enabled": true }
    },
    "environment_variables": {
      "BASE_MODE": "support"
    },
    "metadata": {}
  }'

Example response

HTTP 201 Created

{
  "type": "template",
  "id": "tmpl_support",
  "name": "Support assistant",
  "description": "Handles pre-sales and after-sales support",
  "status": "active",
  "model": "ultimate",
  "system": "You are a helpful support assistant.",
  "tools": [
    {
      "type": "agent_toolset_20260401",
      "configs": [
        { "name": "Read", "enabled": true },
        { "name": "Grep", "enabled": true },
        { "name": "WebSearch", "enabled": true }
      ]
    }
  ],
  "mcp_servers": [],
  "skills": [
    {
      "type": "custom",
      "skill_id": "skill_customer_reply",
      "version": "1",
      "enabled": true
    }
  ],
  "multiagent": null,
  "environment_id": "env_support",
  "vault_ids": ["vault_crm"],
  "files": {
    "file_019eXXXX": { "enabled": true }
  },
  "environment_variables": {
    "BASE_MODE": "support"
  },
  "metadata": {},
  "created_at": "2026-06-18T10:00:00Z",
  "updated_at": "2026-06-18T10:00:00Z"
}

Response fields

Field

Type

Description

type

string

Always template.

id

string

Template ID.

status

string

active or archived.

environment_id

string

Default environment ID applied to sessions.

vault_ids

array

Default vault IDs.

files

object

Default file resource configuration keyed by file ID.

created_at

string

Creation timestamp.

updated_at

string

Last update timestamp.

Errors

HTTP

Type

Trigger

400

invalid_request_error

Request body or field value is invalid.

401

authentication_error

PAT is invalid or has expired.

404

not_found_error

A referenced environment, skill, vault, or file does not exist.

409

conflict_error

A template with the same name already exists.

Notes

  • Do not send a template ID in the create request. Forward generates the id for you.

  • files is keyed by file ID. Do not include file_id, id, or resource_id inside each entry.

  • Forward injects file mount paths automatically when a session starts.