Start a search
Start a search from a question in plain words. The body has one key, query.
The Accept request header picks the response:
application/json(the default;*/*or noAcceptheader gives the same) returns thesearch_idand the state of the search at that moment.text/event-streamreturns the event stream of the search, from its first event tosearch.finished. TheX-Search-Idresponse header carries thesearch_id, so you can resume onGET /agent/searches/{search_id}/eventsif the stream breaks.
Error responses are JSON whatever Accept says.
A start returns 202 with the new search_id and its state, which is running.
If you send the same Idempotency-Key with the same query again, the response is
200 with the current state of the first search, and that search can already be
over. Always read state from the body, not from the status code. Treat every
state that is not succeeded, failed or cancelled as still in progress,
because a later release adds queued.
Only POST is allowed on this path. A GET returns 405 with
{"detail": "Method \"GET\" not allowed."}, and it counts toward the start limit.
The start costs nothing and returns X-Credits-Used: 0. The first read after the
search ends charges it. Before a search begins, the API checks that your balance
covers 8 credits for each search of your account that has no charge yet, this one
included. The check takes no credits, and 8 credits is not the price of a search:
a search usually costs much less.
Default rate-limit is 6 starts per minute for each account. A request that gets an error counts toward it too. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset (the seconds until the limit resets). Send an email to gtm@crustdata.co to discuss higher limits if needed for your use case.
Authorizations
Headers
Body
The question, in plain words.
Response
A repeat of an Idempotency-Key with the same query: the body has the first search's search_id and its current state, which can already be succeeded, failed or cancelled. A streaming start also returns 200, with the event stream as the body.
A search id and its state at the moment of the response.
The state of a search. succeeded, failed and cancelled are end states. Every search in progress is running today. queued is not returned today; a later release adds it for a search that waits in a queue. Treat every state that is not an end state as in progress. This enum is closed.
queued, running, succeeded, failed, cancelled "running"

