---
title: "Archive an agent"
description: "Archive an agent — Spinrun Build REST API operation."
url: https://docs.spinrun.ai/api/agents/delete-agent
markdown_url: https://docs.spinrun.ai/api/agents/delete-agent.md
---

# Archive an agent

Archive an agent — Spinrun Build REST API operation.

## DELETE /api/build/agents/{ref}

Archive an agent

Operation id: `deleteAgent`

### Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| ref | path | yes | string | Agent or workflow id or slug. |

### Responses

| Status | Description |
|---|---|
| 200 | Archived. `data` is null. |
| 401 | No or invalid token. The `WWW-Authenticate` header names the authorization server. |
| 403 | The grant has no Build authorization. |
| 404 | No such agent, workflow or run visible to this token. |

#### 200 · `application/json`

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "null"
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}
```

#### 401 · `application/json`

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "additionalProperties": false
}
```

#### 403 · `application/json`

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "additionalProperties": false
}
```

#### 404 · `application/json`

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "additionalProperties": false
}
```
