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

# searchCasts

Search for casts

> **Group:** Cast APIs

Use this when you need: **Search for casts**.

## Usage

```ts theme={"system"}
import { NeynarAPIClient, Configuration } from "@neynar/nodejs-sdk";

const client = new NeynarAPIClient(
  new Configuration({ apiKey: "YOUR_NEYNAR_API_KEY" })
);

const res = await client.searchCasts({
  q: "example", // Query string to search for casts. Supported operators:  | Operator  | Description                                                                                              | | --------- | -------------------------------------------------------------------------------------------------------- | | &#x60;+&#x60;       | Acts as the AND operator. This is the default operator between terms and can usually be omitted.         | | &#x60;\\|&#x60;      | Acts as the OR operator.                                                                                 | | &#x60;*&#x60;       | When used at the end of a term, signifies a prefix query.                                                  | | &#x60;\&quot;&#x60;       | Wraps several terms into a phrase (for example, &#x60;\&quot;star wars\&quot;&#x60;).                                          | | &#x60;(&#x60;, &#x60;)&#x60;  | Wrap a clause for precedence (for example, &#x60;star + (wars \\| trek)&#x60;).                                     | | &#x60;~n&#x60;      | When used after a term (for example, &#x60;satr~3&#x60;), sets &#x60;fuzziness&#x60;. When used after a phrase, sets &#x60;slop&#x60;. | | &#x60;-&#x60;       | Negates the term.                                                                                        | | &#x60;before:&#x60; | Search for casts before a specific date. (e.g. &#x60;before:2025-04-20&#x60; or &#x60;before:2025-04-20T23:59:59&#x60;)      | | &#x60;after:&#x60;  | Search for casts after a specific date. (e.g. &#x60;after:2025-04-20&#x60; or &#x60;after:2025-04-20T00:00:00&#x60;)         |
  // xNeynarExperimental: true, 
  // mode: "value", 
  // sortType: "value", 
  // authorFid: 123, 
  // viewerFid: 123, 
  // parentUrl: "example", 
  // channelId: "example", 
  // limit: 123, 
  // cursor: "example", 
});
console.log(res);
```

## Parameters

| Parameter             | Type                      | Required | Description                                            |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| --------------------- | ------------------------- | :------: | ------------------------------------------------------ | -------- | ----------- | - | --------- | -------------------------------------------------------------------------------------------------------- | - | ----- | ------------------------------------------------------------------------------------------------ | - | ---- | -- | ------------------------ | - | ------ | --------------------------------------------------------- | - | ----------- | ----------------------------------------------------------------------------- | - | ------------ | ------------------------------------------------------------ | --------- | - | ------- | --------------------------------------------------------------------------------------------------------------- | - | ----- | ----------------- | - | ----------- | ------------------------------------------------------------------------------------------------------- | - | ---------- | ---------------------------------------------------------------------------------------------------- | - |
| `q`                   | `string`                  |     ✅    | Query string to search for casts. Supported operators: | Operator | Description |   | --------- | -------------------------------------------------------------------------------------------------------- |   | \`+\` | Acts as the AND operator. This is the default operator between terms and can usually be omitted. |   | \`\\ | \` | Acts as the OR operator. |   | \`\*\` | When used at the end of a term, signifies a prefix query. |   | \`\&quot;\` | Wraps several terms into a phrase (for example, \`\&quot;star wars\&quot;\`). |   | \`(\`, \`)\` | Wrap a clause for precedence (for example, \`star + (wars \\ | trek)\`). |   | \`\~n\` | When used after a term (for example, \`satr\~3\`), sets \`fuzziness\`. When used after a phrase, sets \`slop\`. |   | \`-\` | Negates the term. |   | \`before:\` | Search for casts before a specific date. (e.g. \`before:2025-04-20\` or \`before:2025-04-20T23:59:59\`) |   | \`after:\` | Search for casts after a specific date. (e.g. \`after:2025-04-20\` or \`after:2025-04-20T00:00:00\`) |   |
| `xNeynarExperimental` | `boolean`                 |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| `mode`                | `SearchCastsModeEnum`     |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| `sortType`            | `SearchCastsSortTypeEnum` |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| `authorFid`           | `number`                  |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| `viewerFid`           | `number`                  |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| `parentUrl`           | `string`                  |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| `channelId`           | `string`                  |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| `limit`               | `number`                  |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |
| `cursor`              | `string`                  |     ❌    | -                                                      |          |             |   |           |                                                                                                          |   |       |                                                                                                  |   |      |    |                          |   |        |                                                           |   |             |                                                                               |   |              |                                                              |           |   |         |                                                                                                                 |   |       |                   |   |             |                                                                                                         |   |            |                                                                                                      |   |

## Response

Returns a `RequestArgs` object.

## Error Handling

```ts theme={"system"}
try {
  const res = await client.searchCasts({
    q: "example"
  });
  // use res
} catch (err) {
  // Axios/HTTP errors, invalid params, auth issues, etc.
  console.error(err);
}
```

## Related API Reference

📖 **API Reference:** [searchCasts](/reference/search-casts)

For detailed information about the HTTP endpoint, request/response schemas, and additional examples, see the complete API documentation.

## Tips

* Provide a **viewerFid** when supported to respect mutes/blocks and include `viewer_context`.
* Keep requests scoped (e.g., use `limit`) to improve latency.
* Cache results where sensible.
