> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.beehiiv.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.beehiiv.com/_mcp/server.

# Delete publication <Badge intent="info" minimal outlined>OAuth Scope: publications:write</Badge>

DELETE https://api.beehiiv.com/v2/publications/{publicationId}
Content-Type: application/json

This endpoint is currently in beta and is not yet available to every workspace.

Deletes a publication the same way deleting it from the workspace settings in the app does. This also deletes its subscribers, segments, metrics, and other associated data, frees its subdomain, removes its custom domains, removes its Stripe payout account, and cancels its paid subscriptions. Contact support if a publication was deleted by mistake.

To confirm the deletion, `confirm_name` must exactly match the publication's current name. A mismatch is rejected with a `400` and the code `PUBLICATION_NAME_MISMATCH`. Omitting `confirm_name` is rejected with a `400` and the code `NOT_EXIST_REQUIRED_KEY`, the same as any other missing required field.

A workspace must keep at least one publication. Deleting the last one is rejected with a `422` and the code `LAST_PUBLICATION_IN_WORKSPACE`.

The deletion runs in the background, so this endpoint answers `202`. Once it finishes, getting the publication returns a `404`.

This endpoint requires an API key with access to every publication in the workspace.

Reference: https://developers.beehiiv.com/api-reference/publications/delete

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `publicationId` (string, required) — The prefixed ID of the publication to delete

### Body (application/json)

This endpoint expects an object.

- `confirm_name` (string, required) — The publication's current name, exactly as it appears in the app.

## Response

### 202

Accepted

- `data` (PublicationDeletion, required)

## Errors

### 400 Bad Request Error

Bad Request

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 401 Unauthorized Error

Unauthorized. The API key or OAuth access token is missing, invalid, or expired.

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 403 Forbidden Error

Forbidden

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 404 Not Found Error

Resource Not Found

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 422 Unprocessable Entity Error

Unprocessable Entity

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 429 Too Many Requests Error

Rate Limit Exceeded

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

### 500 Internal Server Error

Internal Server Error

- `status` (integer, required)
- `statusText` (string, required)
- `errors` (list of ErrorDetail, required)

## Types

### PublicationDeletion

- `id` (string, required) — The prefixed ID of the publication being deleted
- `name` (string, required) — The name of the publication being deleted

### ErrorDetail

- `message` (string, required)
- `code` (string, required)

## Examples

**Request**

```json
{
  "confirm_name": "Bee Informed"
}
```

**Response**

```json
{
  "data": {
    "id": "pub_ad76629e-4a39-43ad-8055-0ee89dc6db15",
    "name": "Bee Informed"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.beehiiv.com/v2/publications/pub_ad76629e-4a39-43ad-8055-0ee89dc6db15"

payload = { "confirm_name": "Bee Informed" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.delete(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.beehiiv.com/v2/publications/pub_ad76629e-4a39-43ad-8055-0ee89dc6db15';
const options = {
  method: 'DELETE',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"confirm_name":"Bee Informed"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beehiiv.com/v2/publications/pub_ad76629e-4a39-43ad-8055-0ee89dc6db15"

	payload := strings.NewReader("{\n  \"confirm_name\": \"Bee Informed\"\n}")

	req, _ := http.NewRequest("DELETE", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.beehiiv.com/v2/publications/pub_ad76629e-4a39-43ad-8055-0ee89dc6db15")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"confirm_name\": \"Bee Informed\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.beehiiv.com/v2/publications/pub_ad76629e-4a39-43ad-8055-0ee89dc6db15")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"confirm_name\": \"Bee Informed\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.beehiiv.com/v2/publications/pub_ad76629e-4a39-43ad-8055-0ee89dc6db15', [
  'body' => '{
  "confirm_name": "Bee Informed"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.beehiiv.com/v2/publications/pub_ad76629e-4a39-43ad-8055-0ee89dc6db15");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"confirm_name\": \"Bee Informed\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["confirm_name": "Bee Informed"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beehiiv.com/v2/publications/pub_ad76629e-4a39-43ad-8055-0ee89dc6db15")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```