---
title: "Export an agent as an AgentTemplate"
method: GET
path: "/api/v1/agents/{agent}/export"
---

# Export an agent as an AgentTemplate

`GET /api/v1/agents/{agent}/export`

Reconstructs an AgentTemplate config from a deployed agent and all of its
sub-resources (tools, routines, skills, installations). Returns the template
definition together with every dependent config file (scripts, workflows, skills,
schemas) and their raw content, producing a fully self-contained export bundle.

Use this endpoint to snapshot an agent's current configuration for backup,
migration, or to seed a new Solution template. Pass `remove_identity: true` to
strip instance-specific fields (email, phone number) before export.

The authenticated caller must own the agent or hold sufficient permissions within
its owning org or team. When called under a developer app scope, the caller must
hold the app scope for the target app.

## Path parameters

- `agent` string, required

## Query parameters

- `remove_identity` boolean

## Response `200`

Successful response

- AgentExport — A portable export bundle for an agent, containing everything needed to re-deploy it in another workspace or environment.
  - `configs` Config[], required — Ordered list of config file objects that the agent depends on. Included in full so the import can recreate all dependencies without additional requests.
    - `agent` string — Agent ID (`agt_...`) associated with this config. `null` if not linked to an agent.
    - `created_at` string, date-time — When this config was first created (ISO 8601).
    - `current_version` ConfigVersion — A single immutable snapshot of a config's content, created each time the config is saved.
      - `change_description` string — Human-readable summary of what changed in this version, as provided by the author. `null` if no description was supplied.
      - `content_hash` string — SHA-256 digest of the raw config content encoded as `sha256:<hex>`. Uses the same algorithm as the CLI `computeContentHash` helper. `null` for versions created before this field was introduced.
      - `created_at` string, date-time — When this config version was created (ISO 8601).
      - `data` object — Arbitrary structured metadata stored alongside this version. `null` when no extra data was provided.
      - `id` string, required — Config version ID (`cfv_...`).
      - `org` string — Organization ID (`org_...`) that owns this config version. `null` for personal configs.
      - `sandbox` string — Sandbox ID (`sbx_...`) this version was saved under. `null` for production configs.
      - `version_number` integer, required — Monotonically increasing integer identifying this version within the config. Starts at 1.
    - `id` string, required — Config ID (`cfg_...`).
    - `is_archived` boolean — Whether this config has been archived. Archived configs are hidden from default listings but remain accessible by ID.
    - `kind` string, required — Type of config, e.g. `"Agent"` or `"APITool"`. Determines which fields and validation rules apply.
    - `lookup_key` string — Stable, user-defined key used to look up this config without knowing its ID. `null` if not set.
    - `mime_type` string — MIME type of the config's content, e.g. `"text/yaml"`. `null` if not determined.
    - `org` string — Organization ID (`org_...`) this config belongs to. `null` for configs not scoped to an org.
    - `parent` string — Parent bundle config ID (`cfg_...`). Present only for configs that are children of a bundle; `null` otherwise.
    - `parent_solution` string — ID (`cfg_...`) of the solution config this config was imported with. `null` if the config was not imported via a solution.
    - `raw_content` string — Raw file content as a string. Populated only for system configs; `null` for user-owned configs.
    - `relative_path` string — Path of this config relative to its parent bundle root. Present only for bundle children; `null` otherwise.
    - `sandbox` string — Sandbox identifier this config belongs to. `null` for production configs.
    - `team` string — Team ID (`tea_...`) that owns this config. `null` for personal (user-scoped) configs.
    - `updated_at` string, date-time — When this config was last modified (ISO 8601).
    - `user` string — User ID (`usr_...`) who owns this config. `null` for team-scoped configs.
    - `virtual_path` string — Logical path uniquely identifying this config within its team, e.g. `"agents/my-agent.yaml"`. `null` for configs without an explicit path.
  - `template` object, required — The agent template definition as a structured map. Pass this directly to the import endpoint to recreate the agent.

## Other responses

- `401` — Unauthorized
- `403` — Forbidden - app scope required
- `404` — Agent not found

---

[API](https://skmtc.net/archastro/apis/archastro-platform-api.md) · [All operations](https://skmtc.net/archastro/apis/archastro-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/archastro/archastro-platform-api/versions/a8772b442f86/schema)
