Documentation / API / docs_search
docs_search
POSThttps://api.oppalerts.com/v1/docs/search
Search the OppAlerts documentation by words, by semantic similarity, or both.
Search the OppAlerts documentation from your code, and find the page that answers a question about a tool, a field, a limit, an error, or a task. POST /v1/docs/search takes query, words with the search operators, and similarity_text, a question or a description in plain language of at most 200 words. Each result has the path, the title, and the 2 addresses of the page, url_html and url_md. Send a path to docs_get to read the whole page as markdown.
What it does
The tool searches every page of the OppAlerts documentation: the guides, the how-to guides, the pages of the web app, and the MCP page and the API page of each tool. It searches by words, by semantic similarity, or both.
queryis a word search. The words match the title and the text of each page together. It takes the search operators oftitle_queryofnews_search, with the same rules. The results are in the order of the word match, and each result has arelevance_weight.similarity_textis a search by meaning. Write a question or a description in plain language, at most 200 words. The results are in the order of similarity, and each result has asimilarity_scorefrom 0 to 100.- Send both, and the words choose the pages, and similarity sets the order.
- The code samples of a page (the JSON and the curl lines) are not searched. Text that more than 10 pages share is not searched either.
- The MCP page and the API page of 1 tool are 1 result: the page that ranks first, with the other page in
paired_page.paired_pageisnullfor every other page. similarity_scoreisnullwhen you send nosimilarity_text, andrelevance_weightisnullwhen you send noquery.
To read a page, send its path to docs_get.
Authentication
Send a token in the Authorization: Bearer header. Authentication and Limits explains the tokens.
Parameters
querystring, optional, at most 500 characters- Words a page must have, matched against the title and the text of the page together. It takes these search operators: AND, OR, MAYBE, NEAR/N, and NOTNEAR/N in capitals, the Negation operator (-), the Phrase search operator, the Proximity search operator (~N), the Exact form modifier (=), the IDF boost modifier (^N), the Wildcard operator (* at the end of a word), and Grouping with parentheses (one level). Advanced Search Operators has the full list. At most 20 words or phrases. Not sent: no words.
similarity_textstring, optional, at most 200 words and 8,192 bytes- A question or a description in plain language that the pages must be near to in semantic similarity. A longer text is refused, and nothing is cut. Not sent: no vector.
sectionslist of strings, optional, at most 12 items- The sections of the documentation to search:
docs-getting-started,docs-how-to,docs-use-cases,docs-opportunity-types,docs-content-types,docs-the-data,docs-app,docs-mcp,docs-api,docs-account,docs-free-pagerank-api, anddocs-faq. Not sent: all sections. results_limitinteger, optional, 1 to 50- The most results. Not sent: 10.
Strict Rules
- A field that is not in the list above is refused. The answer is HTTP 400 with the error code
bad_param. The error names the field: "<field> is not a field of this tool." - A bad value is refused, and the error names the field. A bad value is a value of the wrong type, a number with a fraction for a whole-number field, a value out of its range, an empty text, or a value that is not in its list. A required field that you do not send is refused too. The tool never changes a value that you send.
- Send
query,similarity_text, or both. A call with neither is refused: "This tool needs words or a text: send query, similarity_text, or both." - A
similarity_textof more than 200 words is refused, and nothing is cut: "similarity_text has 201 words. The most is 200 words: send a shorter text. Nothing is cut." - A wrong use of a search operator in
queryis refused with a sentence that names the field, for example "query has a formatting error: OR needs a word on each side." How to Search the Indexes has every rule of a query. - A value of
sectionsthat is not in the list is refused, and the error lists the sections. - An error about the format of a call, such as a refused field, names the field. Its message ends with one sentence: "Read the documentation at https://oppalerts.com/docs for the correct format." Every other error has only its own sentence.
Example
Request
curl -X POST https://api.oppalerts.com/v1/docs/search \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query":"calls left","similarity_text":"how many calls do I have left today","results_limit":3}'
Response
The full sample answer, a call with query and similarity_text.
{
"returned": 3,
"results": [
{
"path": "docs/account/usage.md",
"section": "docs-account",
"title": "Usage",
"url_html": "https://oppalerts.com/docs/account/usage",
"url_md": "https://oppalerts.com/docs/account/usage.md",
"paired_page": null,
"similarity_score": 76.085132,
"relevance_weight": 8521.0
},
{
"path": "docs/mcp/account_calls_left.md",
"section": "docs-mcp",
"title": "account_calls_left",
"url_html": "https://oppalerts.com/docs/mcp/account_calls_left",
"url_md": "https://oppalerts.com/docs/mcp/account_calls_left.md",
"paired_page": {
"path": "docs/api/account_calls_left.md",
"section": "docs-api",
"url_html": "https://oppalerts.com/docs/api/account_calls_left",
"url_md": "https://oppalerts.com/docs/api/account_calls_left.md"
},
"similarity_score": 74.175066,
"relevance_weight": 8533.0
},
{
"path": "docs/getting-started/usage-and-daily-limits.md",
"section": "docs-getting-started",
"title": "Usage and Daily Limits",
"url_html": "https://oppalerts.com/docs/getting-started/usage-and-daily-limits",
"url_md": "https://oppalerts.com/docs/getting-started/usage-and-daily-limits.md",
"paired_page": null,
"similarity_score": 73.629361,
"relevance_weight": 8527.0
}
]
}
Errors
bad_param(HTTP 400): a field is missing, has a wrong value, or is not a field of this tool. The error names the field.search_stopped(HTTP 422): the search took more than 10 seconds and was stopped.backend_error(HTTP 502): the documentation search did not answer. Send the call again after a few seconds.daily_limit(HTTP 429): the account has used all its calls for this tool today. account_calls_left shows when the count resets.
This tool has its own daily count: 3,000 calls a day on a paid plan and 500 on the free plan. It is not an index search, so it does not use the shared count of the news_ and prospects_ tools, and the error one_at_a_time does not apply to it.
Same tool in MCP
The MCP tool is docs_search. Read the MCP page.