# Unfile threads from folder (https://docs.capy.ai/api-reference/folders/unfile-threads-from-folder)

`DELETE https://api.capy.ai/api/v1/folders/{folderId}/threads`

Removes one or more threads from a folder and returns a per-thread outcome list without archiving or deleting the threads.

## Authorization

Send an API key as a bearer token: `Authorization: Bearer $CAPY_API_KEY`. See https://docs.capy.ai/api-reference/authentication.md.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `folderId` | path | string | yes |  |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `threadIds` | string[] | yes |  |

## Responses

- `200` FileThreadsResult: `FileThreadsResultEncoded`
- `400` capy/InvalidRequest: `capy_InvalidRequestEncoded`
- `401` capy/Unauthorized: `capy_UnauthorizedEncoded`
- `403` capy/Forbidden: `capy_ForbiddenEncoded \| capy_ForbiddenEncoded`
- `404` capy/ThreadOrganizationNotFound: `capy_ThreadOrganizationNotFoundEncoded`
- `429` capy/RateLimited: `capy_RateLimitedEncoded`

## Example

```bash
curl -X DELETE "https://api.capy.ai/api/v1/folders/{folderId}/threads" \
  -H "Authorization: Bearer $CAPY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"threadIds":[]}'
```

## Referenced schemas

```json
{
  "FileThreadsResultEncoded": {
    "type": "object",
    "properties": {
      "outcomes": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ThreadOutcomeEncoded"
        }
      }
    },
    "required": [
      "outcomes"
    ],
    "additionalProperties": false
  },
  "ThreadOutcomeEncoded": {
    "type": "object",
    "properties": {
      "threadId": {
        "type": "string"
      },
      "outcome": {
        "type": "string",
        "enum": [
          "ok",
          "not_found",
          "not_allowed"
        ]
      }
    },
    "required": [
      "threadId",
      "outcome"
    ],
    "additionalProperties": false
  },
  "capy_InvalidRequestEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/InvalidRequest"
        ]
      },
      "message": {
        "type": "string"
      }
    },
    "required": [
      "_tag",
      "message"
    ],
    "additionalProperties": false
  },
  "capy_UnauthorizedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Unauthorized"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_ForbiddenEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Forbidden"
        ]
      },
      "mfaRequiredOrgId": {
        "type": "string"
      },
      "ssoRequired": {
        "type": "boolean"
      },
      "passkeyRequired": {
        "type": "boolean"
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_ThreadOrganizationNotFoundEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/ThreadOrganizationNotFound"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_RateLimitedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/RateLimited"
        ]
      },
      "retryAfterSeconds": {
        "type": "integer"
      }
    },
    "required": [
      "_tag",
      "retryAfterSeconds"
    ],
    "additionalProperties": false
  },
  "FileThreadsRequest": {
    "type": "object",
    "properties": {
      "threadIds": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "threadIds"
    ],
    "additionalProperties": false
  }
}
```

Full document: https://docs.capy.ai/openapi.json