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

# Delete a domain

> Detach a custom domain from the current workspace without deleting its links.

Detach one custom domain from the API key's workspace. Requires **Custom
domains: Write** (`custom_domains.delete`).

```bash theme={null}
curl --request DELETE \
  --url https://biq.li/api/v1/domain/biq_dom_01M18D4A8QRJY5G6K3N2W7X9TZ \
  --header 'Authorization: Bearer biqli_your_workspace_api_key' \
  --header 'Accept: application/json'
```

<Warning>
  Links are not deleted. Links in this workspace that used the custom domain
  are moved to Biqli's default short domain, so their short URLs change.
</Warning>

## Response

Deletion returns `200 OK` because the summary matters:

```json theme={null}
{
  "id": "biq_dom_01M18D4A8QRJY5G6K3N2W7X9TZ",
  "detached": true,
  "domain_deleted": false,
  "links_detached": 42,
  "remaining_attachments": 1,
  "status": "success"
}
```

| Field                   | Meaning                                                                   |
| ----------------------- | ------------------------------------------------------------------------- |
| `detached`              | The workspace attachment was removed.                                     |
| `domain_deleted`        | The underlying claim was deleted because no workspace attachments remain. |
| `links_detached`        | Links moved to the default domain in this workspace only.                 |
| `remaining_attachments` | Other workspace attachments still using the domain.                       |

If this was the last attachment, `domain_deleted` is `true` and Biqli queues
the domain cleanup workflow. Other workspaces are never detached by this call.

A repeated call returns `404 resource_not_found`. Malformed and cross-workspace
IDs return that same response. This endpoint accepts one public ID only, not a
host, numeric ID, or comma-separated list.

## Shared API behavior

Authentication is workspace-scoped; see [Authentication](/docs/api-reference/authentication). Errors use the standard envelope and request IDs described in [Errors](/docs/api-reference/errors), and requests are subject to [Rate limits](/docs/api-reference/rate-limits).


## OpenAPI

````yaml DELETE /v1/domain/{domain}
openapi: 3.1.0
info:
  title: Biqli API
  version: 1.0.0
  description: Workspace-scoped REST API for Biqli.
servers:
  - url: https://biq.li/api
security:
  - bearerAuth: []
paths:
  /v1/domain/{domain}:
    delete:
      tags:
        - Domains
      summary: Delete a domain
      description: >-
        Detaches a domain from this workspace and moves its workspace links to
        the default domain. Requires custom_domains.delete.
      operationId: domain.destroy
      parameters:
        - $ref: '#/components/parameters/DomainId'
      responses:
        '200':
          description: Domain detached successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteDomainResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    DomainId:
      name: domain
      in: path
      required: true
      description: Public custom-domain ID. Numeric IDs and hosts are not accepted.
      schema:
        type: string
        pattern: ^biq_dom_[0-9A-HJKMNP-TV-Z]{26}$
  schemas:
    DeleteDomainResponse:
      type: object
      additionalProperties: false
      required:
        - id
        - detached
        - domain_deleted
        - links_detached
        - remaining_attachments
        - status
      properties:
        id:
          type: string
          pattern: ^biq_dom_[0-9A-HJKMNP-TV-Z]{26}$
        detached:
          type: boolean
        domain_deleted:
          type: boolean
        links_detached:
          type: integer
          minimum: 0
        remaining_attachments:
          type: integer
          minimum: 0
        status:
          type: string
          const: success
    ApiError:
      type: object
      required:
        - error
        - request_id
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - invalid_token
                - insufficient_scope
                - upgrade_required
                - quota_exceeded
                - resource_not_found
                - domain_taken
                - alias_taken
                - external_id_taken
                - folder_name_taken
                - tag_name_taken
                - pixel_name_taken
                - biolink_name_taken
                - method_not_allowed
                - url_blocked
                - dns_verification_failed
                - validation_error
                - rate_limit_exceeded
                - internal_server_error
            message:
              type: string
            details:
              type: object
              additionalProperties: true
        request_id:
          type: string
          description: Request identifier to include when contacting support.
  responses:
    Unauthorized:
      $ref: '#/components/responses/ApiErrorResponse'
      description: The workspace API key is missing, invalid, or revoked.
    Forbidden:
      $ref: '#/components/responses/ApiErrorResponse'
      description: >-
        The key lacks a required scope, the workspace must upgrade, or its quota
        is exhausted.
    NotFound:
      $ref: '#/components/responses/ApiErrorResponse'
      description: >-
        The requested resource or referenced public ID is unavailable in the
        key's workspace.
    RateLimited:
      description: The workspace exceeded its plan's API rate limit.
      headers:
        RateLimit-Policy:
          description: Current IETF HTTPAPI quota policy as a structured field.
          schema:
            type: string
            example: '"workspace-api";q=1000;w=60'
        RateLimit:
          description: Current IETF HTTPAPI service limit as a structured field.
          schema:
            type: string
            example: '"workspace-api";r=0;t=17'
        Retry-After:
          description: Seconds to wait before retrying the request.
          schema:
            type: integer
            minimum: 0
            example: 17
        X-RateLimit-Limit:
          description: Legacy maximum request count for the current window.
          schema:
            type: integer
            minimum: 1
            example: 1000
        X-RateLimit-Remaining:
          description: Legacy remaining request count.
          schema:
            type: integer
            minimum: 0
            example: 0
        X-RateLimit-Reset:
          description: Legacy reset time as a UTC Unix timestamp.
          schema:
            type: integer
            format: int64
            example: 1788126519
        X-Biq-Request-Id:
          description: Request identifier for support and tracing.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    InternalError:
      $ref: '#/components/responses/ApiErrorResponse'
      description: The request failed unexpectedly.
    ApiErrorResponse:
      description: API error.
      headers:
        X-Biq-Request-Id:
          description: Request identifier for support and tracing.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Workspace API key
      description: A workspace API key beginning with biqli_.

````