Query

Validate a Boolean query

Check a Boolean query before searching: read it (or import it from Talkwalker, Brandwatch, Meltwater, Onclusive or X, or detect which), explain it in English…

POST/v1/query/validate
0credits
x-api-keystringheader

API key (`sfk_...`)

Request body

requiredapplication/json
Response fields
41

Endpoint-specific response payload.

datavalid
boolean

Whether the query can be read.

Why it can't be read; null when valid.

dataerrorreason
string

Machine-readable reason, such as `ambiguous_precedence`.

dataerrormessage
string

What's wrong and how to fix it.

dataerrorstart
integer

Where the problem starts in the query (UTF-16 offset).

dataerrorend
integer

Where it ends (UTF-16 offset, exclusive).

datanormalizedQuery
stringnullable

The query in Social Fetch's syntax, with every operator explicit. It always parses back to the same query.

dataexplanation
stringnullable

The query in plain language.

With `syntax: auto`, the syntax the query was read in and why; null otherwise. Send that syntax to search with it.

datadetectedsyntax
string

Syntax the query is written in: `native` (Social Fetch's Boolean language), or another tool's to import: `x` (X search), `onclusive`, `talkwalker`, `brandwatch` (also Cision Social Listening) or `meltwater`.

one of: native, x, onclusive, talkwalker, brandwatch, meltwater

What gave the syntax away, as written in the query, such as `NEAR/2f`; empty when nothing did.

datadetectedmarks[]
stringoptional

How an imported query carried over; null for native queries.

dataimportsyntax
string

Another tool's syntax: `x` (X search), `onclusive`, `talkwalker`, `brandwatch` (also Cision Social Listening) or `meltwater`.

one of: x, onclusive, talkwalker, brandwatch, meltwater

dataimportfidelity
string

The worst clause's status, summarised.

one of: exact, approximate, partial

dataimportclauses[]start
integer

Where the clause starts in the query.

dataimportclauses[]end
integer

Where it ends (exclusive).

dataimportclauses[]text
string

The clause as written.

dataimportclauses[]status
string

How faithfully the clause carried over.

one of: exact, equivalent, approximated, unsupported

dataimportclauses[]note
string

What changed, in plain language.

dataimportclauses[]translatedTo
stringoptional

The clause in Social Fetch's syntax, when there is one.

dataimportsince
stringnullable

A date the imported query held (X's since:).

dataimportuntil
stringnullable

A date the imported query held (X's until:).

The plan on each platform.

dataplatforms[]platform
string

A platform a query can search.

one of: twitter, reddit, youtube, tiktok, linkedin, threads, instagram, hackernews, facebook

dataplatforms[]coverage
string

`full`: every part of the query can be searched; `partial`: some can't (see notes); `none`: nothing can.

one of: full, partial, none

What won't be covered, and why.

dataplatforms[]notes[]
stringoptional

What would be searched, in the platform's own syntax.

dataplatforms[]searchTerms[]
stringoptional
dataplatforms[]estimatedCredits
integer

At most what this platform would charge: its share of `maxCredits`, or less when its searches need fewer.

≥ 0

dataplatforms[]custom
booleanoptional

True when `searchTerms` are the searches chosen in `platformSearches`, not those planned from the query. Absent otherwise.

dataestimatedCredits
integer

At most what a search with these settings would charge.

≥ 0

Plain-language cautions, most important first.

datawarnings[]
stringoptional

Metadata describing the request and billing outcome.

metarequestId
string

Unique request identifier for tracing this API call.

min 1 chars

metacreditsCharged
integer

Credits charged for this request.

≥ 0

metaversion
string

Public API version that served the response.

one of: v1

Code example

curl "https://api.socialfetch.dev/v1/query/validate" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"from:nasa OR from:esa -filter:replies","syntax":"x","platforms":["twitter","reddit"],"since":"2026-11-01T00:00:00Z","maxCredits":20}' \
  -X POST

Responses

The query read, explained and planned, or why it can't be read (`valid: false`, with the error's position).