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

# Delete Domain

> Remove a sending domain from your account using the AutoSend API.

<RequestExample>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url https://api.autosend.com/v1/domains/60d5ec49f1b2c72d9c8b1111 \
    --header 'Authorization: Bearer <token>'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.autosend.com/v1/domains/60d5ec49f1b2c72d9c8b1111"

  headers = {"Authorization": "Bearer <token>"}

  response = requests.delete(url, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.autosend.com/v1/domains/60d5ec49f1b2c72d9c8b1111",
    {
      method: "DELETE",
      headers: {
        Authorization: "Bearer <token>",
      },
    }
  );

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

  ```php PHP theme={null}
  <?php

  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.autosend.com/v1/domains/60d5ec49f1b2c72d9c8b1111",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => [
      "Authorization: Bearer <token>",
    ],
  ]);

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

  echo $response;
  ```

  ```go Go theme={null}
  package main

  import (
    "fmt"
    "io"
    "net/http"
  )

  func main() {
    req, _ := http.NewRequest("DELETE", "https://api.autosend.com/v1/domains/60d5ec49f1b2c72d9c8b1111", nil)
    req.Header.Set("Authorization", "Bearer <token>")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import java.net.URI;
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;

  HttpClient client = HttpClient.newHttpClient();

  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://api.autosend.com/v1/domains/60d5ec49f1b2c72d9c8b1111"))
      .header("Authorization", "Bearer <token>")
      .DELETE()
      .build();

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

  ```ruby Ruby theme={null}
  require "net/http"
  require "uri"

  uri = URI.parse("https://api.autosend.com/v1/domains/60d5ec49f1b2c72d9c8b1111")
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Delete.new(uri.request_uri)
  request["Authorization"] = "Bearer <token>"

  response = http.request(request)
  puts response.body
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": null
  }
  ```
</ResponseExample>

### Authorizations

<ParamField path="Authorization" type="string | header" required>
  Bearer authentication header of the form `Bearer <token>`, where `<token>` is your API key.
</ParamField>

#### Path Parameters

<ParamField path="domainId" type="string" required>
  The id of the domain to remove.
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Indicates whether the domain was removed successfully.
</ResponseField>

<ResponseField name="data" type="null">
  Always `null` on a successful delete.
</ResponseField>

#### Errors

<ResponseField name="404" type="object">
  Returned when no domain with the given `domainId` exists in the project.
</ResponseField>


## OpenAPI

````yaml DELETE /domains/{domainId}
openapi: 3.1.0
info:
  title: Autosend Domains API
  description: >-
    Manage your domains associated with your Autosend project. Domains are used
    to send email via AutoSend. After adding a domain you must configure DNS
    records and trigger verification before it can be used for sending.
  version: 1.0.0
servers:
  - url: https://api.autosend.com/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Domains
    description: Manage AutoSend domains for your Autosend project.
paths:
  /domains/{domainId}:
    delete:
      tags:
        - Domains
      summary: Delete Domain
      description: >-
        Removes a domain from the project. This action cannot be undone. Any
        senders or campaigns using this domain may be affected.
      operationId: deleteDomain
      parameters:
        - $ref: '#/components/parameters/domainId'
      responses:
        '200':
          description: Domain removed successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    nullable: true
                    example: null
              example:
                success: true
                data: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    domainId:
      name: domainId
      in: path
      required: true
      description: The id of the domain.
      schema:
        type: string
        pattern: ^[a-f\d]{24}$
        example: 60d5ec49f1b2c72d9c8b1111
  responses:
    Unauthorized:
      description: Missing or invalid Bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: Unauthorized
    NotFound:
      description: Domain not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: Domain not found
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key issued from the Autosend dashboard. Pass as `Authorization:
        Bearer <token>`.

````