Skip to main content
POST
/
v1
/
agents
/
{agent_id}
/
export
Export Agent
curl --request POST \
  --url https://api.xpander.ai/v1/agents/{agent_id}/export \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "icon": "<string>",
  "with_knowledge_bases": true
}
'
{
  "id": "<string>",
  "name": "<string>",
  "icon": "<string>",
  "description": "<string>",
  "organization_id": "<string>",
  "agent_definition": {
    "id": "<string>",
    "name": "<string>",
    "custom_functions": [
      {
        "id": "<string>",
        "name": "<string>",
        "input_schema": {},
        "status": "draft",
        "limits": {},
        "source_code": "<string>",
        "description": "<string>",
        "technical_description": "<string>"
      }
    ],
    "connectors": [
      {
        "id": "<string>",
        "open_api_spec_id": "<string>",
        "name": "",
        "description": "",
        "general_params": [],
        "operation_ids": [],
        "operations_with_details": [],
        "cc_id": "<string>",
        "root_id": "<string>",
        "code": "<string>",
        "openapi_spec": "<string>",
        "is_custom": false,
        "owner": "<string>",
        "version": 123,
        "total_operations": 123,
        "operations_map": {}
      }
    ],
    "description": "",
    "unique_name": "",
    "icon": "๐Ÿš€",
    "avatar": "male-avatar",
    "type": "manager",
    "delegation_type": "router",
    "delegation_memory_strategy": "summarization",
    "created_by_prompt": "<string>",
    "is_ai_employee": false,
    "prompts": [],
    "llm_settings": [],
    "source_nodes": [],
    "attached_tools": [],
    "access_scope": "organizational",
    "instructions": {
      "role": [],
      "goal": [],
      "general": ""
    },
    "oas": {},
    "graph": [],
    "status": "ACTIVE",
    "version": 1,
    "model_provider": "openai",
    "model_name": "gpt-4.1",
    "sub_agents": [],
    "knowledge_bases": []
  }
}
Export an agent into a portable template that can be shared across organizations. The template packages all agent components including configuration, tools, sub-agents, and optionally knowledge bases with their documents.

Path Parameters

agent_id
string
required
The unique identifier (UUID) of the agent to export

Request Body

name
string
required
Display name for the template
description
string
Description of what the template does
icon
string
Emoji icon for the template (e.g., โ€๐ŸŽงโ€, โ€๐Ÿš€โ€)
with_knowledge_bases
boolean
default:true
Controls whether knowledge bases and their document files are included in the export
  • true: Includes all knowledge bases with their documents and files
  • false: Exports only agent configuration without knowledge bases

Response

Returns an AgentTemplate object:
id
string
Unique identifier for the template (UUID)
name
string
Template display name
description
string
Template description
icon
string
Emoji icon representing the template
organization_id
string
UUID of the organization that created the template
agent_definition
object
Complete agent configuration

Example Request

Export with Knowledge Bases

curl -X POST -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Customer Support Agent Template",
    "description": "Pre-configured agent for customer support workflows",
    "icon": "๐ŸŽง",
    "with_knowledge_bases": true
  }' \
  https://api.xpander.ai/v1/agents/550e8400-e29b-41d4-a716-446655440000/export

Export without Knowledge Bases

curl -X POST -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support Agent Config",
    "description": "Agent configuration only",
    "icon": "๐ŸŽง",
    "with_knowledge_bases": false
  }' \
  https://api.xpander.ai/v1/agents/550e8400-e29b-41d4-a716-446655440000/export

Example Response

{
  "id": "template-123",
  "name": "Customer Support Agent Template",
  "description": "Pre-configured agent for customer support workflows",
  "icon": "๐ŸŽง",
  "organization_id": "org-456",
  "agent_definition": {
    "id": "agent-789",
    "name": "Support Agent",
    "description": "Handles customer inquiries",
    "instructions": {
      "role": ["Customer support specialist"],
      "goal": ["Resolve customer issues efficiently"],
      "general": "Be helpful and professional"
    },
    "custom_functions": [],
    "connectors": [],
    "sub_agents": [],
    "knowledge_bases": [
      {
        "name": "Product Documentation",
        "description": "Product guides and FAQs",
        "documents": [
          {
            "name": "User Guide",
            "url": "https://...",
            "content": "..."
          }
        ]
      }
    ]
  }
}

Use Cases

  • Cross-Account Sharing: Share agent templates with other organizations
  • Backup & Version Control: Create snapshots of agent configurations
  • Agent Marketplace: Distribute pre-built agents
  • Team Collaboration: Share standardized agents across teams

Notes

  • Cross-Organization Sharing: Templates can be shared across different organizations - the template ID works universally
  • Knowledge Base Size: When with_knowledge_bases: true, the export includes all document content which may result in larger payloads
  • Tool Credentials: Tool configurations are exported without credentials - recipients will need to provide their own API keys

See Also

  • [Import Agent](/API reference/v1/agents/import-agent) - Create a new agent from a template
  • Agent Import & Export Guide - Comprehensive guide to templates and cross-account sharing
  • [Create Agent](/API reference/v1/agents/create-agent) - Create a new agent from scratch
  • [Get Agent](/API reference/v1/agents/get-agent) - Retrieve agent details

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

agent_id
string
required

Body

application/json
name
string
required
description
string | null
icon
string | null
with_knowledge_bases
boolean | null
default:true

Response

Successful Response

id
string
required
name
string
required
icon
string
required
description
string | null
organization_id
string | null
agent_definition
AgentDefinition ยท object