> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: delete(request: WixHttpFunctionRequest)

# Method package: wixHttpFunctions

# Method menu location: wixHttpFunctions --> delete

# Method Link: https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/delete.md

# Method Description:

A function that responds to requests made with the HTTP DELETE method.

The HTTP DELETE method is usually called by consumers to delete an existing resource.
 If defined in this way and the resource is deleted, the function should respond
 with a 200 (OK) status code.

 Respond to the request by returning a [`WixHttpFunctionResponse`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/wix-http-function-response/introduction.md)
 object you create using one of the [`response()`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/response.md), [`ok()`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/ok.md),
 [`created()`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/created.md), [`notFound()`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/not-found.md),
 [`serverError()`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/server-error.md), [`badRequest()`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/bad-request.md),
 or [`forbidden()`](https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/forbidden.md) functions.

 The `delete()` function is not a function that you call from your code. You define
 the function in a file named **http-functions.js** in your site's Backend section.
 The function is called when your users make HTTP requests using the associated
 URLs as described below.

 All DELETE requests with the following URL will be routed to this function:

 Premium sites:

 ```
 https://www.{user_domain}/_functions/
 ```

 Free sites:

 ```
 https://{user_name}.wixsite.com/{site_name}/_functions/
 ```


> **Notes:**
>
> - The HTTP DELETE request can't contain a body and
>   can't contain the header `"Content-Type": "application/json"`.
>   If the request breaks this syntax and includes either of these,
>   the function returns a 400 (Bad Request) status code.
> - You must publish your site at least once before using both the testing and production endpoints. 
>   When you make changes to production endpoints you must publish your site for them to take effect. Testing endpoints will use the latest code in the editor.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Create a DELETE HTTP function

```javascript
// In http-functions.js

import {ok} from 'wix-http-functions';

// URL looks like:
// https://www.mysite.com/_functions/myFunction/someId
// or:
// https://user.wixsite.com/mysite/_functions/myFunction/someId
export function delete_myFunction(request) {

  const toRemove = request.path[0];

  // remove the resource

  return ok();
}

```

## Create a DELETE HTTP function

```javascript
// In http-functions.js

import {ok, serverError} from 'wix-http-functions';
import wixData from 'wix-data';

// URL looks like:
// https://www.mysite.com/_functions/myFunction/76bf-8bfa-714
// or:
// https://user.wixsite.com/mysite/_functions/myFunction/76bf-8bfa-714
export function delete_myFunction(request) {
  let options = {
    "headers": {
      "Content-Type": "application/json"
    }
  };
  // delete the item from a collection
  return wixData.remove("myCollection", request.path[0])
    .then( (results) => {
      options.body = {
        "deleted": results
      };
      return ok(options);
    } )
    // something went wrong
    .catch( (error) => {
      options.body = {
        "error": error
      };
      return serverError(options);
    } );
}

```

---