# Remove a specials target

Revokes the agency's registration. The target itself is removed only when no other agency
registered it and it is still a shadow (discovery) target; a published target keeps running
(`kept_serving`). The agency keeps read access to history already collected.

## Endpoint

```
DELETE https://api.motorsdynamic.com/api/v2/targets/{domainId}
```

## Plan and price

| Plan | Access | Price |
| --- | --- | --- |
| Free | No | not included |
| Growth | No | not included |
| Scale | No | not included |
| Enterprise | Yes | contract |

A call is billed when it answers 2xx. See [pricing](https://developers.motorsdynamic.com/pricing.md).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domainId` | path | integer | yes | Site id (`id` from GET /dealers). |
| `kinds` | query | `specials` | no |  |
| `agency_id` | query | integer | no |  |

## Example request

curl:

```bash
curl -X DELETE "https://api.motorsdynamic.com/api/v2/targets/201?kinds=specials" \
  -H "x-api-key: $MD_API_KEY"
```

JavaScript:

```javascript
const res = await fetch("https://api.motorsdynamic.com/api/v2/targets/201?kinds=specials", {
  method: "DELETE",
  headers: { "x-api-key": process.env.MD_API_KEY },
});
if (!res.ok) throw new Error(`${res.status} ${(await res.json()).error}`);
const data = await res.json();
console.log(data);
```

Python:

```python
import os, requests

res = requests.delete(
    "https://api.motorsdynamic.com/api/v2/targets/201?kinds=specials",
    headers={"x-api-key": os.environ["MD_API_KEY"]},
    timeout=10,
)
res.raise_for_status()
print(res.json())
```

## Example response

```json
{
  "data": {
    "domain_id": 201,
    "agency_id": 2,
    "kinds": [
      {
        "kind": "specials",
        "status": "target_removed"
      }
    ]
  }
}
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| `data` | object |  |
| `data.domain_id` | integer |  |
| `data.agency_id` | integer |  |
| `data.kinds[]` | array of object |  |
| `data.kinds[].kind` | string |  |
| `data.kinds[].status` | `not_registered` or `kept_for_other_agencies` or `target_removed` or `kept_serving` |  |

## Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_parameter` | A parameter is missing or malformed. The message names it. |
| 401 | `invalid_api_key` | The key is missing, revoked or mistyped. |
| 402 | `plan_required` | The endpoint is on a higher plan. The body names the plan and links to the upgrade. |
| 403 | `not_entitled` | The key may not read this dealer or source. |
| 429 | `rate_limited or quota_exceeded` | Slow down (see `Retry-After`), or the Free monthly calls are used up. |
| 504 | `query_timeout` | The query passed its 4 second budget. Narrow the filters. Not billed. |

Every error has the same body: `{ "error": "<code>", "message": "..." }`. Full list: [errors](https://developers.motorsdynamic.com/docs/errors.md).
