---
title: Toggle WP_DEBUG
description: "Updates the site's wp-config.php to enable or disable WP_DEBUG. Synchronous — the change is applied during the request and the response reflects the final state. Returns 200 on success, 422…"
url: "https://betterdocs.shahrear.msf.bd/index.php/docs/hell0-boys-docs/hell0-boys/wordpress-actions/toggle-wp_debug/"
updated: "2026-08-20"
category: hell0 boys / WordPress Actions
---

# Toggle WP_DEBUG

POST`/sites/{uuid}/wp-debug`

## Code Samples

```curl

                curl --request POST \
  --url 'https://app.xcloud.host/api/v1/sites/{uuid}/wp-debug' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "enabled": true
}'

                const response = await fetch('https://app.xcloud.host/api/v1/sites/{uuid}/wp-debug', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "enabled": true
})
});

const data = await response.json();
console.log(data);

                import requests

headers = {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
}

payload = {
    "enabled": true
}

response = requests.post("https://app.xcloud.host/api/v1/sites/{uuid}/wp-debug", headers=headers, json=payload)

print(response.json())

                <?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://app.xcloud.host/api/v1/sites/{uuid}/wp-debug',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
  'Authorization: Bearer YOUR_TOKEN',
  'Content-Type: application/json'
  ],
  CURLOPT_POSTFIELDS => '{
    "enabled": true
}',
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;

                using System.Net.Http;
using System.Text;

var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST"), "https://app.xcloud.host/api/v1/sites/{uuid}/wp-debug");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");
request.Content = new StringContent(@"{
    ""enabled"": true
}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);

                import java.net.URI;
import java.net.http.*;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://app.xcloud.host/api/v1/sites/{uuid}/wp-debug"))
    .header("Authorization", "Bearer YOUR_TOKEN")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("""
{
    "enabled": true
}
"""))
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

## Response

```json

                {
    "success": true,
    "message": "WP_DEBUG enabled.",
    "data": {
        "site": {
            "uuid": "1a2b3c4d-5e6f-7890-abcd-1234567890ef",
            "name": "my-wordpress-site"
        },
        "wp_debug_enabled": true
    }
}

                {
    "success": false,
    "message": "Unauthenticated.",
    "data": null
}

                {
    "success": false,
    "message": "This action is unauthorized. Your token is missing the required scope.",
    "data": null
}

                {
    "success": false,
    "message": "Not found.",
    "data": null
}

                {
    "success": false,
    "message": "The given data was invalid.",
    "data": null,
    "errors": {
        "domain": [
            "The domain field is required when mode is live."
        ]
    }
}
```

Updates the site's `wp-config.php` to enable or disable `WP_DEBUG`. Synchronous — the change is applied during the request and the response reflects the final state. Returns 200 on success, 422 when the [Server](https://betterdocs.shahrear.msf.bd/encyclopedia/server/)-side script fails. Requires the `write:sites` scope and the `site:manage-update` [Team](https://betterdocs.shahrear.msf.bd/encyclopedia/team/) permission.

## Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `uuid` | string (uuid) | **Required** | UUID of the site |

## Request Body

Content type: `application/json` — **required**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | **Required** | Set to true to enable WP_DEBUG, false to disable. |

```json

                {
    "enabled": true
}
```

## Responses

### 200 — WP_DEBUG toggled successfully

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |
| `data` | object | Optional |  |
| `data.site` | object | Optional |  |
| `data.site.uuid` | string (uuid) | Optional |  |
| `data.site.name` | string | Optional |  |
| `data.wp_debug_enabled` | boolean | Optional |  |

```json

                {
    "success": true,
    "message": "WP_DEBUG enabled.",
    "data": {
        "site": {
            "uuid": "1a2b3c4d-5e6f-7890-abcd-1234567890ef",
            "name": "my-wordpress-site"
        },
        "wp_debug_enabled": true
    }
}
```

### 401 — Missing or invalid authentication token

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |

```json

                {
    "success": false,
    "message": "Unauthenticated.",
    "data": null
}
```

### 403 — Token lacks the required scope

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |

```json

                {
    "success": false,
    "message": "This action is unauthorized. Your token is missing the required scope.",
    "data": null
}
```

### 404 — Resource not found or not accessible to your [Team](https://betterdocs.shahrear.msf.bd/encyclopedia/team/)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |

```json

                {
    "success": false,
    "message": "Not found.",
    "data": null
}
```

### 422 — Request validation failed

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | boolean | Optional |  |
| `message` | string | Optional |  |
| `data` | object | Optional |  |
| `errors` | object | Optional |  |

```json

                {
    "success": false,
    "message": "The given data was invalid.",
    "data": null,
    "errors": {
        "domain": [
            "The domain field is required when mode is live."
        ]
    }
}
```
