> ## Documentation Index
> Fetch the complete documentation index at: https://docs.9pic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Unpublish

> Move a live event gallery back to draft

## Overview

Moves a live event back to draft, so participants can no longer open its gallery. Photos and search settings are kept; call [Go Live](/api-reference/pipeline/photos/go-live) again to make the event live.

OAuth only. Requires `events:read` and `events:write`, plus an accepted organiser **admin** membership. Send a bearer token without `X-API-Key`.

The write uses no credits and runs in one call: send `mode: "execute"` with a stable `idempotency_key`. No review token or confirmation is needed; `mode: "preview"` (the default) is an optional dry run. See [Operations](/api-reference/operations) for retry rules.

> [!NOTE]
>
> The event must be live: its gallery enabled and its go-live stage `processed`. Otherwise the request returns `409`.

## Endpoint

```
POST /api/v1/ext/{org_id}/event/{event_id}/pipeline/photos/unpublish
```

## Path Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `org_id` | integer | Yes | Organiser where the caller has an accepted admin membership. |
| `event_id` | integer | Yes | The live event to move back to draft. |

## Request Body

[ReviewedWriteRequest](/api-reference/models/workflow#reviewedwriterequest) with no extra fields.

| Field | Type | Description |
| - | - | - |
| `mode` | string | `execute` to unpublish; `preview` (the default) is a dry run. |
| `idempotency_key` | string | Required with `execute`; stable retry key, up to 200 characters. |

## Example Request

```bash cURL theme={null}
curl -i -X POST \
  -H "Authorization: Bearer <oauth_access_token>" \
  -H "Content-Type: application/json" \
  "https://api.9pic.ai/api/v1/ext/903/event/456/pipeline/photos/unpublish" \
  -d '{"mode": "execute", "idempotency_key": "event-456-unpublish-1"}'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://api.9pic.ai/api/v1/ext/903/event/456/pipeline/photos/unpublish",
    headers={"Authorization": "Bearer <oauth_access_token>"},
    json={"mode": "execute", "idempotency_key": "event-456-unpublish-1"},
)
print(response.status_code, response.json())
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.9pic.ai/api/v1/ext/903/event/456/pipeline/photos/unpublish", {
  method: "POST",
  headers: { "Authorization": "Bearer <oauth_access_token>", "Content-Type": "application/json" },
  body: JSON.stringify({ mode: "execute", idempotency_key: "event-456-unpublish-1" }),
});
console.log(await response.json());
```

## Example Response

```json theme={null}
{
  "responseType": "success",
  "message": "Event moved to draft",
  "data": {
    "mode": "execute",
    "operation": "unpublish_photos",
    "org_id": 903,
    "event_id": 456,
    "review_token": null,
    "expires_at": null,
    "proposed": {
      "client_enabled": false
    },
    "consequences": [
      "Moves the event back to draft; participants can no longer open the gallery.",
      "Photos and search settings are kept; publish again to make the event live."
    ],
    "operation_id": "ddc661a7-8861-4793-9437-af42a82d12f8",
    "status": "completed",
    "result": {
      "event_id": 456,
      "client_enabled": false
    }
  }
}
```

The change is immediate: `status` is `completed` and [Pipeline Status](/api-reference/pipeline/photos/status) reports `is_live: false`.

## Response Models

[ReviewedWriteRequest](/api-reference/models/workflow#reviewedwriterequest) and [GuardedOperationData](/api-reference/models/workflow#guardedoperationdata).

## Error Responses

| Status | Meaning |
| - | - |
| `400` / `422` | Invalid input or missing `idempotency_key` at execution. |
| `401` | Invalid or expired access token. |
| `403` | Missing scopes, membership, or admin role; API keys are rejected. |
| `404` | Event configuration not found. |
| `409` | Event is not currently live, or the retry key belongs to a different action. |
| `503` | Organiser writes are temporarily unavailable. |

See [Errors](/api-reference/errors) and [Conventions](/api-reference/conventions).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.