# at.happyproto.server.removeDomain

> Remove a custom domain from one of the caller's instances. HappyProto stops serving it. Customers only.

- Kind: procedure
- Authority: server.happyproto.at
- Lexicon: 1
- Published by [happyproto.at](https://lexicon.garden/identity/did:plc:mo7vq4jbioxwafy5zkcc3eux), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.server.removeDomain)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.server.removeDomain/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.server.removeDomain/analytics)

## Procedure (`at.happyproto.server.removeDomain`)

Type: procedure · POST

### Input (application/json)

- `domainId` (string, required): The domain's UUID.
- `idempotencyKey` (string, required): A UUID the client generates once per intended change and resends on every retry of it, so a retry gets the original reply instead of acting twice.
- `instanceId` (string, required): The instance's UUID.

### Output (application/json)

- `jobId` (string): The background job following the routing change, when there was one. Poll it with at.happyproto.server.getJob.

### Errors

- `AuthRequired`: This endpoint requires an authenticated caller.
- `Forbidden`: The caller is not a HappyProto customer, or the provisioner refused them.
- `InvalidRequest`: instanceId, domainId or idempotencyKey is not a UUID.
- `NotFound`: No such instance or domain, or it is not the caller's. The cases are indistinguishable.
- `NotAvailable`: Custom domains are not switched on yet.
- `InvalidSlug`: Passed through from the provisioner.
- `SlugTaken`: Passed through from the provisioner.
- `NotEntitled`: Passed through from the provisioner.
- `InstanceLimit`: Passed through from the provisioner.
- `NoCapacity`: Passed through from the provisioner.
- `OperationInProgress`: Passed through from the provisioner: the instance is already changing, or a request with this idempotencyKey is still running.
- `InvalidHostname`: Passed through from the provisioner.
- `PlatformHostname`: Passed through from the provisioner.
- `DomainExists`: Passed through from the provisioner.
- `DomainLimit`: Passed through from the provisioner.
- `TooSoon`: Passed through from the provisioner.
- `DomainIsPrimary`: The domain is the instance's primary. Make the platform subdomain primary first.
- `NotVerified`: Passed through from the provisioner.
- `CertificateNotReady`: Passed through from the provisioner.
- `VersionTooOld`: Passed through from the provisioner.
- `Upstream`: The provisioner is unreachable, not configured, or answered with an error it does not explain to callers, or the job could not be started.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Remove a custom domain from one of the caller's instances. HappyProto stops serving it. Customers only.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller is not a HappyProto customer, or the provisioner refused them.",
          "name": "Forbidden"
        },
        {
          "description": "instanceId, domainId or idempotencyKey is not a UUID.",
          "name": "InvalidRequest"
        },
        {
          "description": "No such instance or domain, or it is not the caller's. The cases are indistinguishable.",
          "name": "NotFound"
        },
        {
          "description": "Custom domains are not switched on yet.",
          "name": "NotAvailable"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InvalidSlug"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "SlugTaken"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotEntitled"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InstanceLimit"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NoCapacity"
        },
        {
          "description": "Passed through from the provisioner: the instance is already changing, or a request with this idempotencyKey is still running.",
          "name": "OperationInProgress"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InvalidHostname"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "PlatformHostname"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "DomainExists"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "DomainLimit"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "TooSoon"
        },
        {
          "description": "The domain is the instance's primary. Make the platform subdomain primary first.",
          "name": "DomainIsPrimary"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotVerified"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "CertificateNotReady"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "VersionTooOld"
        },
        {
          "description": "The provisioner is unreachable, not configured, or answered with an error it does not explain to callers, or the job could not be started.",
          "name": "Upstream"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "domainId": {
              "description": "The domain's UUID.",
              "type": "string"
            },
            "idempotencyKey": {
              "description": "A UUID the client generates once per intended change and resends on every retry of it, so a retry gets the original reply instead of acting twice.",
              "type": "string"
            },
            "instanceId": {
              "description": "The instance's UUID.",
              "type": "string"
            }
          },
          "required": [
            "instanceId",
            "domainId",
            "idempotencyKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "jobId": {
              "description": "The background job following the routing change, when there was one. Poll it with at.happyproto.server.getJob.",
              "type": "string"
            }
          },
          "required": [],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "at.happyproto.server.removeDomain",
  "lexicon": 1
}
```
