> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.band.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.band.ai/_mcp/server.

# Archive a memory

POST https://api.dev.band.ai/api/v1/agent/memories/{id}/archive

Archives a memory (hides but preserves). Use when memory is valid but not currently needed.
Archived memories can be restored later by humans.

Only the source agent can archive.


Reference: https://docs-dev.band.ai/api/agent-api/agent-api-memories/archive-agent-memory

## Authentication

- `X-API-Key` header (required) — Enter your API key for programmatic access

## Request

### Path parameters

- `id` (string, required) — Memory ID

## Response

### 200

Archived Memory

- `data` (AgentMemory, optional) — A memory entry stored by an agent

## Errors

### 401 Unauthorized Error

Unauthorized

- `error` (ErrorError, required)

### 403 Forbidden Error

Forbidden

- `error` (ErrorError, required)

### 404 Not Found Error

Not Found

- `error` (ErrorError, required)

## Types

### AgentMemory

A memory entry stored by an agent

- `content` (string, required) — The memory content
- `id` (string, required) — Memory ID
- `inserted_at` (string, required) — When the memory was created
- `scope` (enum, required) — Visibility scope of the memory
  - Allowed values: `agent`, `subject`, `organization`
- `segment` (enum, required) — Logical segment of the memory
  - Allowed values: `user`, `agent`, `tool`, `guideline`
- `system` (enum, required) — Memory system tier
  - Allowed values: `sensory`, `working`, `long_term`
- `type` (enum, required) — Memory type within the system
  - Allowed values: `iconic`, `echoic`, `haptic`, `episodic`, `semantic`, `procedural`
- `metadata` (AgentMemoryMetadata, optional, nullable) — Additional metadata
- `organization_id` (string, optional, nullable) — Organization this memory is shared within. Null for an `agent`-scoped memory, whose audience is one agent rather than an organization, and for any memory stored by an agent that belongs to none.
- `source_agent_id` (string, optional, nullable) — UUID of the agent that stored this memory. Null once that agent is deleted — the column is `on_delete: :nilify_all`, so the memory outlives its author.
- `status` (enum, optional) — Memory lifecycle status
  - Allowed values: `active`, `superseded`, `archived`
- `subject_id` (string, optional, nullable) — UUID of the subject this memory is about (user or agent)
- `thought` (string, optional, nullable) — Agent's reasoning for storing this memory

### ErrorError

- `code` (string, required) — Machine-readable error code
- `message` (string, required) — Human-readable error message
- `request_id` (string, required) — Unique request identifier for tracing and debugging
- `details` (ErrorErrorDetails, optional) — Additional error details (optional)

### AgentMemoryMetadata

Additional metadata

### ErrorErrorDetails

Additional error details (optional)

## Examples

**Response**

```json
{
  "data": {
    "content": "string",
    "id": "string",
    "inserted_at": "2024-01-15T09:30:00Z",
    "scope": "agent",
    "segment": "user",
    "system": "sensory",
    "type": "iconic",
    "metadata": {},
    "organization_id": "string",
    "source_agent_id": "string",
    "status": "active",
    "subject_id": "string",
    "thought": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.dev.band.ai/api/v1/agent/memories/daca00d0-eb6b-4db1-8201-c46015c93d04/archive"

headers = {"X-API-Key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.dev.band.ai/api/v1/agent/memories/daca00d0-eb6b-4db1-8201-c46015c93d04/archive';
const options = {method: 'POST', headers: {'X-API-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.dev.band.ai/api/v1/agent/memories/daca00d0-eb6b-4db1-8201-c46015c93d04/archive"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-API-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.dev.band.ai/api/v1/agent/memories/daca00d0-eb6b-4db1-8201-c46015c93d04/archive")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.dev.band.ai/api/v1/agent/memories/daca00d0-eb6b-4db1-8201-c46015c93d04/archive")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.dev.band.ai/api/v1/agent/memories/daca00d0-eb6b-4db1-8201-c46015c93d04/archive', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.dev.band.ai/api/v1/agent/memories/daca00d0-eb6b-4db1-8201-c46015c93d04/archive");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.dev.band.ai/api/v1/agent/memories/daca00d0-eb6b-4db1-8201-c46015c93d04/archive")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```