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

# Publish Status Page

> Publish, unpublish or archive a status page

## Overview

Sets the publication state of a status page. A page is visible to the public only while its status is `published`. The first time a page is published its `last_published_at` is set.

`PUT /api/projects/{projectId}/status-pages/{id}/publish`

## Authentication

| Header | Required | Description |
| - | - | - |
| `X-API-Key` | Yes | Your API key (`Authorization: Bearer {jwt}` also works). API keys need the `read_write` scope. |
| `X-Project-ID` | Yes | Must be the same project UUID as in the URL. |
| `Content-Type` | Yes | `application/json` |

**Required access:** project admin.

## Request body

| Field | Type | Required | Description |
| - | - | - | - |
| `status` | string | Yes | `published` (public), `draft` (hidden) or `archived` (hidden) |

## Response

### 200 OK

Returns the updated status page object (abbreviated here). `is_public` is `true` only for `published`.

```json theme={null}
{
  "success": true,
  "data": {
    "status_page": {
      "id": "0b7c3a52-7d57-4c35-9f0e-5a3b6f1f2a10",
      "name": "Production Status",
      "subdomain": "acme-production",
      "status": "published",
      "is_public": true,
      "last_published_at": 1790000000000
    }
  }
}
```

## Errors

| Status | Code | Cause |
| - | - | - |
| 400 | `INVALID_STATUS` | `status` is missing or not one of `published`, `draft`, `archived` |
| 400 | `PROJECT_ID_REQUIRED` / `INVALID_PROJECT_ID` | `X-Project-ID` header missing or not a UUID |
| 401 | `AUTHENTICATION_REQUIRED` | Missing or invalid credentials |
| 403 | `INSUFFICIENT_PERMISSIONS` | Caller is not a project admin |
| 403 | `ACCESS_DENIED` | The page belongs to another project |
| 403 | `API_KEY_ORGANIZATION_MISMATCH` | The API key belongs to a different organization than the project |
| 403 | `READ_ONLY_API_KEY` | The API key has the `read` scope |
| 404 | `RESOURCE_NOT_FOUND` | The status page does not exist |

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT https://api.uptimeio.com/api/projects/YOUR_PROJECT_ID/status-pages/YOUR_STATUS_PAGE_ID/publish \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "X-Project-ID: YOUR_PROJECT_ID" \
    -H "Content-Type: application/json" \
    -d '{ "status": "published" }'
  ```

  ```javascript JavaScript theme={null}
  const projectId = 'YOUR_PROJECT_ID';
  const statusPageId = 'YOUR_STATUS_PAGE_ID';

  const response = await fetch(
    `https://api.uptimeio.com/api/projects/${projectId}/status-pages/${statusPageId}/publish`,
    {
      method: 'PUT',
      headers: {
        'X-API-Key': process.env.UPTIMEIO_API_KEY,
        'X-Project-ID': projectId,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ status: 'published' }),
    }
  );

  const { data } = await response.json();
  console.log(data.status_page.is_public);
  ```
</CodeGroup>


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