---
title: "Restore agent version"
method: POST
path: "/v1/agents/{agent_id}/restore"
tags: ["Agents"]
---

# Restore agent version

`POST /v1/agents/{agent_id}/restore`

## Request

- Base URL: `https://api.sandbase.ai`
- URL: `https://api.sandbase.ai/v1/agents/{agent_id}/restore`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Create a new current version from the configuration of an earlier version.

## Headers

- `Idempotency-Key` string

## Request body

- AgentRestoreRequest
  - `source_version` integer, required: Version whose configuration becomes the new current version.
  - `row_version` integer, required

## Response `200`

Agent with the restored configuration as a new version

- Agent
  - `id` string, required: Agent ID (`agt_` prefix).
  - `object` 'agent', required
  - `model` string, required
  - `name` string, nullable, required
  - `instructions` string, nullable, required
  - `tools` object[], required
  - `text` AgentText, required
    - `format` object
      - `type` 'text' | 'json_schema', required
      - `schema` object: Required for json_schema; its type must be object.
    - `verbosity` 'low' | 'medium' | 'high'
  - `reasoning` object, required
  - `service_tier` string, required
  - `multi_agent` object, required: Always reports enabled false.
  - `visibility` 'private' | 'public', required
  - `status` 'active' | 'archived', required
  - `version` integer, required: Current version number.
  - `row_version` integer, required: Compare-and-set token for PATCH, archive, unarchive, and restore.
  - `projection_status` string, required: Whether the current version is ready for execution. Sessions require ready.
  - `runtime_profile` 'codex' | 'claude' | 'mcode', required
  - `description` string, required
  - `metadata` object, required
  - `mcp_connections` AgentMCPConnectionRef[], required
    - `connection_id` string, required: MCP connection ID (`mcp_` prefix), or builtin:sandbase for the built-in SandBase server.
    - `server_label` string, required: Label unique within the Agent.
    - `allowed_tools` string[], nullable: null allows every tool; an empty array allows none.
    - `required` boolean: Whether the Session must load this server.
  - `skills` AgentSkillRef[], required
    - `skill_id` string, required: Skill ID (`skl_` prefix) owned by your organization or available from the public Skills catalog.
    - `version` string, nullable: Pinned Skill version. For a new binding, null resolves the current default when the Agent is saved. For an existing binding, null retains its pinned version; pass an explicit version to upgrade.
  - `created_at` integer, required: Unix seconds.
  - `updated_at` integer, required: Unix seconds.
  - `archived_at` integer, nullable, required: Unix seconds.
  - `failure_code` string

## Other responses

- `400`: invalid_request (malformed JSON, unknown fields, failed validation, or an unsupported option)
- `401`: unauthorized: missing, malformed, or conflicting API key headers
- `402`: spending_limit_exceeded: API key spending limit or organization balance exhausted
- `403`: insufficient_scope (scoped key) or org_disabled
- `404`: not_found: the resource does not exist in this organization
- `409`: conflict: stale row_version, lifecycle state, or Idempotency-Key reused with a different body
- `502`: executor_rejected or executor_contract_error from the execution layer
- `503`: authorization_unavailable, admission_unavailable, executor_unavailable, storage_unavailable, or internal_error

---

[API](https://skmtc.dev/sandbase/apis/sandbase-api.md) · [All operations](https://skmtc.dev/sandbase/apis/sandbase-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sandbase/apis/sandbase-api/revisions/d40df2467ba2?raw)
