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 '{}'
{
  "id": "template-uuid-12345",
  "name": "Product Specialist",
  "description": "Answers product questions using web search and documentation",
  "instructions": {
    "role": [
      "AI support agent"
    ],
    "goal": [
      "Be helpful and accurate"
    ],
    "general": "You are the official support agent."
  },
  "knowledge_bases": [],
  "tools": []
}
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

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/<agent-id>/export

Example Response

{
  "id": "<template-id>",
  "name": "Customer Support Agent Template",
  "description": "Pre-configured agent for customer support workflows",
  "icon": "🎧",
  "organization_id": "<org-id>",
  "agent_definition": {
    "id": "<agent-id>",
    "name": "Customer Support Agent",
    "description": "Handles customer inquiries and provides support",
    "instructions": {
      "role": ["Customer support specialist"],
      "goal": ["Resolve customer issues efficiently"],
      "general": "Be helpful and professional"
    },
    "custom_functions": [],
    "connectors": [
      {
        "name": "Ticket System",
        "type": "api"
      }
    ],
    "sub_agents": [],
    "knowledge_bases": [
      {
        "name": "Product Documentation",
        "description": "Product guides and FAQs"
      }
    ]
  }
}

Use Cases

  • Cross-Organization Sharing: Share agent templates with other organizations
  • Backup & Version Control: Create snapshots of agent configurations
  • Standardization: Distribute pre-built agents across teams
  • Reusability: Create templates for frequently used agent patterns

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
  • Template Immutability: Exported templates are snapshots and won’t update if the original agent changes

See Also

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

Response

Successful Response

id
string
name
string
description
string | null
icon
string
organization_id
string | null
agent_definition
AgentDefinition Β· object