Source: https://docs.cumuluslabs.io/reference/drafts.discard
Content version: 4e03055a

# drafts.discard

Discard the draft (revision compare-and-set)

## Request {#request}

`DELETE /api/v1/agents/{agent_id}/draft`

- MCP: `drafts_discard`
- SDK: `client.drafts.discard` (SDK path arguments use `path`; MCP uses `params`).
- Minimum API key role: **member**.
- Idempotency: **natural**.

Use the request schema below. Read IDs from earlier operation results.

## Input schema {#input-schema}

```json
{
  "parameters": [
    {
      "name": "agent_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256,
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
      }
    },
    {
      "name": "draft_id",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    },
    {
      "name": "expected_revision",
      "in": "query",
      "required": true,
      "schema": {
        "type": "integer",
        "exclusiveMinimum": true,
        "minimum": 0,
        "maximum": 2147483647
      }
    }
  ],
  "requestBody": null
}
```

## Responses {#responses}

```json
{
  "200": {
    "description": "Discard the draft (revision compare-and-set)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DraftsDiscardResponse200"
        }
      }
    }
  },
  "4XX": {
    "description": "Typed error (ApiError)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  },
  "5XX": {
    "description": "Typed error (ApiError)",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}
```

## Referenced schemas {#schemas}

```json
{
  "components": {
    "schemas": {
      "DraftsDiscardResponse200": {
        "type": "object",
        "properties": {
          "agent": {
            "type": "object",
            "properties": {
              "tenant_id": {
                "type": "string",
                "format": "uuid"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "agent"
                ]
              },
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
              }
            },
            "required": [
              "tenant_id",
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "draft_id": {
            "type": "string",
            "format": "uuid"
          },
          "discarded": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "agent",
          "draft_id",
          "discarded"
        ],
        "additionalProperties": false
      },
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthenticated",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "invalid_request",
                  "idempotency_conflict",
                  "policy_denied",
                  "capability_unavailable",
                  "provider_unavailable",
                  "knowledge_unavailable",
                  "publication_invalid",
                  "run_not_active",
                  "rate_limited",
                  "outcome_unknown",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "none",
                  "unknown"
                ]
              },
              "details": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "code",
              "message",
              "retryable",
              "outcome"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  }
}
```

## Errors and recovery {#errors}

See [API error handling](https://docs.cumuluslabs.io/api#errors) and [Troubleshooting](https://docs.cumuluslabs.io/troubleshooting).

## Related guides {#related-guides}

- [Agents](https://docs.cumuluslabs.io/agents)
- [Build and test recipes](https://docs.cumuluslabs.io/recipes)
