> For the complete documentation index, see [llms.txt](https://docs.rainbird.ai/rainbird/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainbird.ai/rainbird/developer-docs/api-guide/api-request-flow.md).

# 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="https://2183467111-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FehfnPLAHSx4uHugNiyth%2Fuploads%2FptmdFcfbRErQhrJuPZMn%2FapiFlow.png?alt=media&amp;token=b4f93931-b948-42e3-8ef5-9c9fc5743945" 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
