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

# Delete Listing

> Take a listing offline when the car is sold or withdrawn

Use this call when a car is sold or withdrawn. It is a soft delete: the listing gets status `sold` and a sold date, and Okasie takes it offline about an hour later (60 to 75 minutes). After that its status reads `inactive` in [List Listings](https://docs.okasie.be/api-reference/listings/list.md) (with `status=all`). The listing is not removed from Okasie's database.

> [!NOTE]
>
> Requires the `write:listings` scope.

To publish the same car again later, send it with [Create/Update Listing](https://docs.okasie.be/api-reference/listings/upsert.md) and `status: "active"`, using the same reference.

The call is idempotent: deleting a listing that is already sold or offline returns the same response. Each call sets the sold date to the current time.

## Path parameter

**externalReference** `string` *required*

The reference you used when creating the listing.

No request body is needed.

## Response

HTTP 200 with the [rate limit headers](https://docs.okasie.be/rate-limiting.md).

**data.listingId** `string`

Okasie listing UUID.

**data.externalReference** `string`

Your reference.

**data.status** `string`

Always `sold`.

```bash cURL theme={null}
curl -X DELETE "https://www.okasie.be/api/external/v1/listings/DV-123456" \
  -H "Authorization: Bearer YOUR_API_SECRET"
```

```javascript Node.js theme={null}
const response = await fetch(
  "https://www.okasie.be/api/external/v1/listings/DV-123456",
  {
    method: "DELETE",
    headers: { Authorization: `Bearer ${process.env.PARTNER_SECRET}` },
  }
);
console.log(await response.json());
```

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

response = requests.delete(
    "https://www.okasie.be/api/external/v1/listings/DV-123456",
    headers={"Authorization": f"Bearer {os.getenv('PARTNER_SECRET')}"},
)
print(response.json())
```

```json 200 theme={null}
{
  "data": {
    "listingId": "0c52cae7-bcaa-4b37-be0d-1b78c92c5225",
    "externalReference": "DV-123456",
    "status": "sold"
  }
}
```

```json 404 theme={null}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Listing not found for this partner"
  }
}
```

## Errors

| Status | Code | When |
| - | - | - |
| 401 | `UNAUTHORIZED` | Missing or unknown API key, or the key lacks `write:listings` |
| 429 | `RATE_LIMITED` | Rate limit reached; the body has `retryAt` |
| 400 | `INVALID_REFERENCE` | The path reference is empty |
| 404 | `NOT_FOUND` | Your key has no listing with this reference |
| 403 | `PROFILE_FORBIDDEN` | The listing belongs to a dealer that is no longer linked to your key |
| 500 | `FETCH_FAILED` / `UPDATE_FAILED` | Okasie could not read or update the listing; retry later |

> [!WARNING]
>
> When a dealer stops publishing on Okasie, delete its listings **before** Okasie removes the dealer from your key. Afterwards your key can no longer change them (`403 PROFILE_FORBIDDEN`).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.