
## Unpublish

`POST /v1/apps/:id/unpublish`

Moves a published app to `UNPUBLISHED` and unbinds [placements](/docs/apps/placements) from the Bitrix24 account.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | string | yes | Identifier of an app in `PUBLISHED` status. List: `GET /v1/apps` |

No request body is required — an empty body is allowed.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/apps/YOUR_APP_ID/unpublish" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth app

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/apps/YOUR_APP_ID/unpublish" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/apps/YOUR_APP_ID/unpublish',
  {
    method: 'POST',
    headers: { 'X-Api-Key': 'YOUR_API_KEY' },
  }
)
const body = await res.json()
if (!body.success) throw new Error(body.error.code)
console.log(body.data.placements) // []
```

### JavaScript — OAuth app

```javascript
const res = await fetch(
  'https://vibecode.bitrix24.com/v1/apps/YOUR_APP_ID/unpublish',
  {
    method: 'POST',
    headers: {
      'X-Api-Key': 'YOUR_APP_KEY',
      'Authorization': 'Bearer USER_SESSION_TOKEN',
    },
  }
)
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on successful unpublish |
| `data` | object | The app after unpublish — the same 17 fields returned by [App data](/docs/apps/get) |
| `data.placements` | string[] | Empty array — placements are unbound |
| `data.catalogStatus` | string | After unpublish — `UNPUBLISHED` |
| `data.publishedAt` | string \| null | The last publication date is kept (unpublish does not reset it) |

## Response example

The `data` field mirrors the app object with an empty `placements` array:

```json
{
  "success": true,
  "data": {
    "id": "33c4d5e6-f7a8-49b0-1234-5c6d7e8f9012",
    "title": "Sales dashboard",
    "description": null,
    "scopes": ["crm", "user", "placement"],
    "handlerUrl": "https://vibecode.bitrix24.com/v1/bitrix-handler",
    "appUrl": "https://app-abc12345.vibecode.bitrix24.com",
    "redirectUris": [
      "https://vibecode.bitrix24.com/oauth/complete",
      "http://localhost"
    ],
    "bitrixClientId": "local.7c3d4e5f6a7b80.55556666",
    "prefix": "vibe_app_local_7c3",
    "suffix": "6666",
    "authorId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "portalId": "8b1f0e2a-3c4d-5e6f-7a8b-9c0d1e2f3a4b",
    "createdAt": "2026-06-24T09:12:45.781Z",
    "updatedAt": "2026-06-24T12:47:05.930Z",
    "placements": [],
    "catalogStatus": "UNPUBLISHED",
    "publishedAt": "2026-06-24T10:03:18.204Z"
  }
}
```

## Error response example

404 — the app is not published:

```json
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Published app not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `NOT_FOUND` | App does not exist, belongs to another portal, or is not in `PUBLISHED` status |
| 403 | `FORBIDDEN` | Request is not from the app author and not from a Bitrix24 account administrator |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **Returns to `UNPUBLISHED`, not `PRIVATE`.** Catalog metadata — title, description, icon — is preserved, so re-[publishing](/docs/apps/publish) with an empty body restores the app without refilling it.
- **Unbinding placements does not block the unpublish.** Unbinding runs without waiting for the result of each placement code. A failure to unbind an individual placement does not interrupt the operation — the app moves to `UNPUBLISHED`, and `placements` becomes empty.

## See also

- [Apps](/docs/apps)
- [Publish](/docs/apps/publish)
- [App data](/docs/apps/get)
- [Delete app](/docs/apps/delete)
