Workspace

$envless->workspace->domain->remove()

Detach the custom domain and certificate

php
/** @return RemovedDomainResource */
public function remove(int|float|null $timeout = null): array

Detaches the custom domain and tears down its certificate. The workspace falls back to its envless.cloud subdomain immediately, which breaks any exposed environment URL built on the custom hostname.

Removing a domain that was never claimed succeeds and does nothing, so this is safe to call defensively in teardown scripts. Unlike the other three domain methods this one returns the payload as sent: a RemovedDomainResource, never a domain resource.

If the certificate cannot be detached at the edge the call fails with status 500 and the domain is left in the removing state. Call again to resume from there rather than re-claiming the hostname.

Example

php
use Envless\Envless;

$envless = new Envless();

$result = $envless->workspace->domain->remove();

echo $result['removed'] ? 'removed' : 'nothing to remove', PHP_EOL;

Parameters

ParameterTypeRequiredDescription
$timeoutint|floatNoSeconds each attempt of this call may take, the response body included, before it throws Envless\Exception\NetworkException with isTimeout() true. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

RemovedDomainResource whose removed flag confirms the detach.

Worth knowing

  • After a removal $envless->workspace->domain->get() returns null, the same as a workspace that never claimed a domain.

Required scopes

workspace:write

Underlying endpoint

DELETE /workspace/domain

Request and response schema, every error code, and a live playground.

In TypeScript

envless.workspace.domain.remove()

The same method in @goenvless/sdk, with the same request, retries and errors.