# Delete a saved search

`DELETE /v1/saved_searches/{scope}/{name}`

## Request

### Path

- `scope` · string · required

  Listed values: `account`, `organization`.

  The scope the saved search lives in: `account` for your own, `organization` for one
  shared in your organization (see *Saved searches and scopes*).

- `name` · string, up to 64 characters · required

  Examples: `sector1`, `prod_sector1`, `半导体`.

  The saved search's name: 1 to 64 letters, digits, `_` and `-`, in any script, so
  `sector1` and `半导体` are both valid. Names are case-sensitive, and are compared after
  Unicode NFC normalization. As a URL path segment, non-ASCII characters are
  percent-encoded, as any HTTP client does for you.

## Samples

The request with no input given. The Python and Node samples run on a client logged in as the login pages show, and curl reads an access token from $TOKEN.

Logging in: [Logging in](/docs/login.md), or for a script, [Creating a token for a script](/docs/login/script-token.md).

Every API host serves these pages for its own API. The samples are written for production, https://api.reconnectchina.org, as the pages are before they know their host. On another host, such as the sandbox, use that host instead: in curl's URL and the Shell samples' `login=` line, and as `server` for the Python and Node clients, which log in there too.

### Python

```python
client.delete_saved_search("{scope}", "{name}")
```

### curl

```sh
curl -X DELETE 'https://api.reconnectchina.org/v1/saved_searches/{scope}/{name}' \
  -H "Authorization: Bearer $TOKEN"
```

### Node

```js
await client.deleteSavedSearch("{scope}", "{name}");
```

## Responses

### 204 · Success

Deleted.

No body.

### Errors

Every error is a problem document with the fields below. Its `type` names the problem, and is the address of the problem's page.

- `400` · [`invalid-request`](/docs/v1/problems/invalid-request.md)

  The request is not valid ([`invalid-request`](/docs/v1/problems/invalid-request.md)): a path that cannot be read, a body that
  is not JSON or does not match the schema, an unknown field, a `from` or `to` that is
  not a valid instant expression (an unknown time zone, or a time of day the zone skips,
  included), a `from` that is not earlier than `to`, a `term` that does not parse or is
  longer than your organization's agreement allows, an unknown issuer, a scope in the
  body that does not exist, or a saved search's name that breaks the naming rule.
  `errors` names each offending part: a `pointer` into the body (for the run of a saved
  search, into `parameters` as it ran), or the `parameter` of the path (see
  [problem types](/docs/v1/problems.md)).

- `401` · [`unauthenticated`](/docs/v1/problems/unauthenticated.md)

  No access token, or one that is invalid or has expired ([`unauthenticated`](/docs/v1/problems/unauthenticated.md)). Refresh
  the access token and try again.

  Header `WWW-Authenticate`

  `Bearer`, as [RFC 6750](https://www.rfc-editor.org/rfc/rfc6750) specifies.

- `403` · [`no-organization`](/docs/v1/problems/no-organization.md) · [`multiple-organizations`](/docs/v1/problems/multiple-organizations.md) · [`organization-not-registered`](/docs/v1/problems/organization-not-registered.md) · [`not-entitled`](/docs/v1/problems/not-entitled.md) · [`access-ended`](/docs/v1/problems/access-ended.md) · [`tier-served-elsewhere`](/docs/v1/problems/tier-served-elsewhere.md) · [`scope-not-entitled`](/docs/v1/problems/scope-not-entitled.md) · [`suspended`](/docs/v1/problems/suspended.md)

  The account may not do this. `type` says why: a refusal every operation can meet
  ([`no-organization`](/docs/v1/problems/no-organization.md), [`multiple-organizations`](/docs/v1/problems/multiple-organizations.md), [`organization-not-registered`](/docs/v1/problems/organization-not-registered.md),
  [`not-entitled`](/docs/v1/problems/not-entitled.md), [`access-ended`](/docs/v1/problems/access-ended.md), [`tier-served-elsewhere`](/docs/v1/problems/tier-served-elsewhere.md) or [`suspended`](/docs/v1/problems/suspended.md), see *Problem
  types*), or the organization's agreement, or this server, does not include the scope
  ([`scope-not-entitled`](/docs/v1/problems/scope-not-entitled.md)).

- `404` · [`saved-search-not-found`](/docs/v1/problems/saved-search-not-found.md) · [`scope-not-found`](/docs/v1/problems/scope-not-found.md)

  There is no saved search of that name in that scope ([`saved-search-not-found`](/docs/v1/problems/saved-search-not-found.md)), or the
  scope in the path is not one you can use ([`scope-not-found`](/docs/v1/problems/scope-not-found.md)).

- `429` · [`rate-limited`](/docs/v1/problems/rate-limited.md)

  Too many requests, or too many at the same time ([`rate-limited`](/docs/v1/problems/rate-limited.md)), from your account,
  your organization, or your network address. Wait for `Retry-After` seconds, then send
  the same request again.

  Header `Retry-After`

  How many seconds to wait before sending the same request again.

- `431` · [`headers-too-large`](/docs/v1/problems/headers-too-large.md)

  The request's headers are too large ([`headers-too-large`](/docs/v1/problems/headers-too-large.md)). An access token is far
  below the limit, so look for a header your client adds.

- `503` · [`unavailable`](/docs/v1/problems/unavailable.md)

  The API is temporarily unavailable ([`unavailable`](/docs/v1/problems/unavailable.md)), because our servers are under
  pressure or briefly out of service. Wait for `Retry-After` seconds, then send the same
  request again.

  Header `Retry-After`

  How many seconds to wait before sending the same request again.

- `Any other` · [`internal`](/docs/v1/problems/internal.md)

  Any other error, as a problem document. Includes [`internal`](/docs/v1/problems/internal.md) (500), a failure on our
  side.

#### A problem document's fields

- `type` · string

  Identifies the problem; branch on this. One of the problem types under
  `https://api.reconnectchina.org/docs/v1/problems/`, named in each response's
  description and its `x-problem-types`, and listed in *Problem types*, for example
  `https://api.reconnectchina.org/docs/v1/problems/continuation-expired`. The URL is
  also the type's documentation.

- `title` · string

  A short, human-readable summary of the problem type.

- `status` · integer

  The HTTP status code.

- `detail` · string · may be absent

  A human-readable explanation of this occurrence.

- `errors` · list of objects · may be absent

  For [`invalid-request`](/docs/v1/problems/invalid-request.md), each part of the request that is not valid, and for
  [`range-not-entitled`](/docs/v1/problems/range-not-entitled.md), each end of the range that reaches too far. Each names
  the part in exactly one way: `pointer` for a part of the body, `parameter` for a
  part of the path. A part with several mistakes in it, such as a `term`, has an
  entry for each, and `span` says where in it each one is.

- `errors[].parameter` · string · may be absent

  The name of the path parameter, as this document names it, for example
  `name` in `/v1/saved_searches/{scope}/{name}`.

- `errors[].pointer` · string · may be absent

  A JSON Pointer ([RFC 6901](https://www.rfc-editor.org/rfc/rfc6901)) into
  the request body, for example `/levelIn/0`. Empty for the body as a whole.
  For the run of a saved search, it points into the search as it ran, as
  if the body had been `{"parameters": …}` with the saved parameters and
  your overrides: `/parameters/from` whether `from` was saved or sent.

- `errors[].span` · object · may be absent

  Where in a string a problem is: the characters from `start` up to, not including,
  `end`, counting from 0. Characters are Unicode code points, as `maxLength` counts
  them, so `低空经济` is four; a program that marks text in another unit converts, such
  as a browser, whose strings count a character outside the Basic Multilingual Plane
  as two. Equal `start` and `end` mark the place where something is missing, such as
  the end of a term that stops after `&&`.

- `errors[].span.start` · integer, at least 0

- `errors[].span.end` · integer, at least 0

- `errors[].detail` · string

- `earliestFrom` · string, up to 128 characters · may be absent

  For [`range-not-entitled`](/docs/v1/problems/range-not-entitled.md), the earliest `from` your organization may use, as an
  instant expression such as `now-1y` or `1900-01-01`.

- `latestTo` · string, up to 128 characters · may be absent

  For [`range-not-entitled`](/docs/v1/problems/range-not-entitled.md), the latest `to` your organization may use, as an
  instant expression such as `3000-01-01`.

- `server` · string · may be absent

  For [`tier-served-elsewhere`](/docs/v1/problems/tier-served-elsewhere.md), the server of this API that your account may use,
  one of `servers`, such as `https://sandbox.api.reconnectchina.org`.

### Example responses

400 · No \`strategy\` with \`term\`, and an unknown level

```json
{
  "detail": "The request is not valid in 2 places; `errors` says where.",
  "errors": [
    {
      "detail": "\"strategy\" is a required property",
      "pointer": ""
    },
    {
      "detail": "value is not one of \"centre\", \"provinces\" or 2 other candidates",
      "pointer": "/levelIn/0"
    }
  ],
  "status": 400,
  "title": "Invalid request",
  "type": "https://api.reconnectchina.org/docs/v1/problems/invalid-request"
}
```

400 · A saved search's name with a space in it

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/invalid-request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request is not valid; `errors` says where.",
  "errors": [
    {
      "detail": "A saved search's name is 1 to 64 letters, combining marks, digits, `_` and `-`.",
      "parameter": "name"
    }
  ]
}
```

400 · A term with two mistakes: \`低空经济 && )\`

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/invalid-request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request is not valid in 2 places; `errors` says where.",
  "errors": [
    {
      "detail": "`&&` needs a term on each side.",
      "pointer": "/term",
      "span": {
        "start": 5,
        "end": 7
      }
    },
    {
      "detail": "This `)` closes no `(`.",
      "pointer": "/term",
      "span": {
        "start": 8,
        "end": 9
      }
    }
  ]
}
```

400 · A \`from\` of \`2026-13-01\`, which has no month 13

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/invalid-request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request is not valid; `errors` says where.",
  "errors": [
    {
      "detail": "`13` is not a valid month.",
      "pointer": "/from",
      "span": {
        "start": 5,
        "end": 7
      }
    }
  ]
}
```

401 · No access token

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/unauthenticated",
  "title": "Unauthenticated",
  "status": 401,
  "detail": "The request carries no access token."
}
```

403 · Organization scope on the sandbox

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/scope-not-entitled",
  "title": "Scope not entitled",
  "status": 403,
  "detail": "Saved searches in the scope \"organization\" are not available on this server."
}
```

403 · An organization with sandbox access only, on production

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/tier-served-elsewhere",
  "title": "Served elsewhere",
  "status": 403,
  "detail": "Your organization's access is to https://sandbox.api.reconnectchina.org, not to this server.",
  "server": "https://sandbox.api.reconnectchina.org"
}
```

403 · An account whose application is still under review

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/no-organization",
  "title": "No organization",
  "status": 403,
  "detail": "Your account belongs to no organization."
}
```

404 · No saved search of that name

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/saved-search-not-found",
  "title": "Saved search not found",
  "status": 404,
  "detail": "There is no saved search called \"sector1\" in the scope \"account\"."
}
```

429 · Too many requests from one address

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/rate-limited",
  "title": "Rate limited",
  "status": 429,
  "detail": "This address has sent too many requests."
}
```

431 · Headers over the limit

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/headers-too-large",
  "title": "Headers too large",
  "status": 431,
  "detail": "The request's headers are too large."
}
```

503 · The API cannot take the request now

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/unavailable",
  "title": "Unavailable",
  "status": 503,
  "detail": "The API cannot take this request at the moment."
}
```

default · An error on our side

```json
{
  "type": "https://api.reconnectchina.org/docs/v1/problems/internal",
  "title": "Internal error",
  "status": 500,
  "detail": "The request could not be processed."
}
```
