# API request flow

A common approach to using the Rainbird API is described in the diagram below.

1. Start endpoint is called to start a new session.
2. Query endpoint is called to perform a query. The response to query will contain either a question or a result.
3. If a question has been returned, then the response endpoint should be called with an answer. This request may return another question.
4. The response endpoint will return a result once the query has reached a conclusion.

<figure><img src="/files/IP293wgzVHoDL5QC5Gmm" alt=""><figcaption></figcaption></figure>

In addition to the endpoints mentioned in the example flow, the inject endpoint can be used to inject facts into a Rainbird session. This can be used to inject data into Rainbird from other systems and/or to reduce the number of questions asked during an interaction before a result is returned. It is not recommended to inject more than 250 facts per request as this could lead to inconsistent responses.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rainbird.ai/rainbird/developer-docs/api-guide/api-request-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
