# Remove a custom domain DELETE https://api2.freecustom.email/v1/custom-domains/{domain} Permanently removes a custom domain from your account. **Side effects:** - All API inboxes registered at `@{domain}` are automatically unregistered. - The domain is also removed from the webapp dashboard. **Plan required:** Growth ($49/mo) or Enterprise ($149/mo). Reference: https://docs.freecustom.email/free-custom-email-api/v-1/custom-domains/domain/remove-a-custom-domain ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: collection version: 1.0.0 paths: /v1/custom-domains/{domain}: delete: operationId: remove-a-custom-domain summary: Remove a custom domain description: > Permanently removes a custom domain from your account. **Side effects:** - All API inboxes registered at `@{domain}` are automatically unregistered. - The domain is also removed from the webapp dashboard. **Plan required:** Growth ($49/mo) or Enterprise ($149/mo). tags: - >- subpackage_v1.subpackage_v1/customDomains.subpackage_v1/customDomains/domain parameters: - name: domain in: path description: The bare domain name to remove (e.g. `mail.acme.com`). required: true schema: type: string - name: Authorization in: header description: Bearer authentication required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: >- #/components/schemas/v1_custom-domains_{domain}_Remove a custom domain_Response_200 '401': description: Unauthorized content: application/json: schema: $ref: >- #/components/schemas/DeleteV1Custom-domainsDomainRequestUnauthorizedError '403': description: Forbidden content: application/json: schema: $ref: >- #/components/schemas/DeleteV1Custom-domainsDomainRequestForbiddenError '404': description: Not Found content: application/json: schema: $ref: >- #/components/schemas/DeleteV1Custom-domainsDomainRequestNotFoundError '429': description: Too Many Requests content: application/json: schema: $ref: >- #/components/schemas/DeleteV1Custom-domainsDomainRequestTooManyRequestsError servers: - url: https://api2.freecustom.email components: schemas: v1_custom-domains_{domain}_Remove a custom domain_Response_200: type: object properties: message: type: string success: type: boolean inboxes_removed: type: array items: type: string format: email required: - message - success - inboxes_removed title: v1_custom-domains_{domain}_Remove a custom domain_Response_200 DeleteV1Custom-domainsDomainRequestUnauthorizedError: type: object properties: error: type: string message: type: string success: type: boolean required: - error - message - success title: DeleteV1Custom-domainsDomainRequestUnauthorizedError DeleteV1Custom-domainsDomainRequestForbiddenError: type: object properties: error: type: string message: type: string success: type: boolean upgrade_url: type: string format: uri required: - error - message - success - upgrade_url title: DeleteV1Custom-domainsDomainRequestForbiddenError DeleteV1Custom-domainsDomainRequestNotFoundError: type: object properties: error: type: string message: type: string success: type: boolean required: - error - message - success title: DeleteV1Custom-domainsDomainRequestNotFoundError DeleteV1Custom-domainsDomainRequestTooManyRequestsError: type: object properties: hint: type: string error: type: string message: type: string success: type: boolean credits_url: type: string format: uri upgrade_url: type: string format: uri required: - hint - error - message - success - credits_url - upgrade_url title: DeleteV1Custom-domainsDomainRequestTooManyRequestsError securitySchemes: bearerAuth: type: http scheme: bearer ``` ## SDK Code Examples ```python v1_custom-domains_{domain}_Remove a custom domain_example import requests url = "https://api2.freecustom.email/v1/custom-domains/mail.acme.com" headers = {"Authorization": "Bearer "} response = requests.delete(url, headers=headers) print(response.json()) ``` ```javascript v1_custom-domains_{domain}_Remove a custom domain_example const url = 'https://api2.freecustom.email/v1/custom-domains/mail.acme.com'; const options = {method: 'DELETE', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go v1_custom-domains_{domain}_Remove a custom domain_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api2.freecustom.email/v1/custom-domains/mail.acme.com" req, _ := http.NewRequest("DELETE", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby v1_custom-domains_{domain}_Remove a custom domain_example require 'uri' require 'net/http' url = URI("https://api2.freecustom.email/v1/custom-domains/mail.acme.com") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Delete.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java v1_custom-domains_{domain}_Remove a custom domain_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.delete("https://api2.freecustom.email/v1/custom-domains/mail.acme.com") .header("Authorization", "Bearer ") .asString(); ``` ```php v1_custom-domains_{domain}_Remove a custom domain_example request('DELETE', 'https://api2.freecustom.email/v1/custom-domains/mail.acme.com', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp v1_custom-domains_{domain}_Remove a custom domain_example using RestSharp; var client = new RestClient("https://api2.freecustom.email/v1/custom-domains/mail.acme.com"); var request = new RestRequest(Method.DELETE); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift v1_custom-domains_{domain}_Remove a custom domain_example import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api2.freecustom.email/v1/custom-domains/mail.acme.com")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "DELETE" request.allHTTPHeaderFields = headers 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() ```