# POST /v3/search/subscriptions

Create a search subscription.

**API key:** required. See [Authentication](https://www.secblast.com/docs/authentication).

**Group:** [Webhooks (API: callbacks)](https://www.secblast.com/docs/reference#webhooks-api-callbacks)

## Parameters

This route takes no parameters.

## Request body

A [SearchSubscriptionCreate](https://www.secblast.com/docs/reference/schemas#schema-searchsubscriptioncreate) object, as JSON.

| Field | Type | Required | Description |
|---|---|---|---|
| `endpoint_id` | string | yes | One of the organization's endpoints; it must list filing.new (filing, firehose) or search.match (search). |
| `include_corrections` | boolean | no |   |
| `min_interval_s` | integer \| null | no |   |
| `name` | string | yes | 1 to 800 bytes. |
| `query` | object | yes | The query and filter parameters of /v3/search (q, syntax, match, forms, form_types, form_families, doctypes, ciks, tickers, sics, states, inc_states, primary_only, entityName, locationCode, ...) as JSON members (a list as a comma string or an array), plus items (8-K item codes). A filing-date window (filed_from, filed_to, startdt, enddt, or a dateRange preset) is a 400 naming it, and so is status (a subscription receives new filings); an acceptance window is not stored. An unknown ticker is a 400 naming tickers (q for a ticker: term in q). |

## Responses

| Status | Body | Description |
|---|---|---|
| `201` | [SearchSubscriptionCreated](https://www.secblast.com/docs/reference/schemas#schema-searchsubscriptioncreated) (`application/json`) | Created |
| `400` | [Problem](https://www.secblast.com/docs/reference/schemas#schema-problem) (`application/problem+json`) | Invalid or unknown parameter, or a body that is not one JSON document (code invalid_body). |
| `401` | [Problem](https://www.secblast.com/docs/reference/schemas#schema-problem) (`application/problem+json`) | Missing, invalid or inactive API key (code unauthorized), or a refused access token (code invalid_token: malformed, unknown key, bad signature, expired, wrong issuer or audience, revoked grant). WWW-Authenticate names the protected-resource metadata (RFC 9728). |
| `403` | [Problem](https://www.secblast.com/docs/reference/schemas#schema-problem) (`application/problem+json`) | The credential's scope does not cover this route (code forbidden). |
| `409` | [Problem](https://www.secblast.com/docs/reference/schemas#schema-problem) (`application/problem+json`) | Conflict with the current state. |
| `415` | [Problem](https://www.secblast.com/docs/reference/schemas#schema-problem) (`application/problem+json`) | The body is not sent as Content-Type: application/json (code unsupported_media_type). |
| `503` | [Problem](https://www.secblast.com/docs/reference/schemas#schema-problem) (`application/problem+json`) | Full-text search cannot answer now: search_unavailable (sb_search unreachable or not configured), search_busy (its queue is full), search_timeout (the query hit its time budget), ticker_resolution_unavailable; or the database is unavailable. Retry after the Retry-After delay when one is given. |
| `default` | [Problem](https://www.secblast.com/docs/reference/schemas#schema-problem) (`application/problem+json`) | Any other error (405, 500, 504). |

## Response body

A `201` carries a [SearchSubscriptionCreated](https://www.secblast.com/docs/reference/schemas#schema-searchsubscriptioncreated) object.

| Field | Type | Required | Description |
|---|---|---|---|
| `active` | boolean | yes |   |
| `created_at` | date-time (RFC 3339, UTC) | yes |   |
| `endpoint_id` | string | yes | cbe_ and 24 hex digits. |
| `id` | string | yes | sub_ and 24 hex digits. |
| `include_corrections` | boolean | yes |   |
| `kind` | string | yes | From the query: search when q is not empty, or doctypes, primary_only=true or entityName is given; else filing when a filing-level filter is given (forms, form_types, form_families and their exclusions, ciks, tickers, sics, states, inc_states, locationCode, items); else firehose. filing and firehose deliver filing.new, search delivers search.match. A filing subscription counts against limits.filter. Text subscriptions (kind search) are not offered: a create or PATCH whose query has q, doctypes, primary_only=true or entityName is a 400 invalid_parameter naming that parameter. One of: `filing`, `firehose`, `search`. |
| `min_interval_s` | integer \| null | yes | Digest interval; null: every event is delivered alone. |
| `name` | string | yes |   |
| `query` | object | yes | As stored: q, syntax, match and the structured filters as /v3/search/parse normalises them, tickers resolved into ciks at save time (no tickers member), items as given, accepted_from and accepted_to always null. |
| `query.filters` | object | yes |   |
| `query.match` | string | yes | One of: `exact`, `stem`. |
| `query.q` | string | yes |   |
| `query.syntax` | string | yes | One of: `sb`, `edgar`. |
| `updated_at` | date-time (RFC 3339, UTC) | yes |   |
| `resolved` | object | yes | The tickers of the query and the CIKs they were resolved to at save time; in the answers of POST and of a PATCH with a query. |
| `resolved.tickers` | object | no |   |

## Example request

```bash
curl -sS -X POST -H "Authorization: Bearer $SECBLAST_API_KEY" \
  -H "Content-Type: application/json" -d @body.json \
  'https://api.secblast.com/v3/search/subscriptions'
```

## More in Webhooks (API: callbacks)

Previous: [`GET /v3/search/subscriptions`](https://www.secblast.com/docs/reference/get-search-subscriptions) · Next: [`GET /v3/search/subscriptions/{id}`](https://www.secblast.com/docs/reference/get-search-subscriptions-id)
