> For the complete documentation index, see [llms.txt](https://docs.openg2p.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openg2p.org/products/pbms/developer-zone/api-reference.md).

# API Reference

The OpenG2P PBMS backend exposes its functionality through two FastAPI micro-services. Both are built on the `openg2p-fastapi-common` framework, wrap every call in the standard G2P request/response envelope, and publish an interactive Swagger UI (at `/docs`) and OpenAPI JSON (at `/openapi.json`) that is the authoritative, always-current specification for each service.

The two portal API services are:

| Service                | Purpose                                                                                                                                                   | Documentation                                                                                             |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| Beneficiary Portal API | Powers the beneficiary-facing self-service portal. Serves a beneficiary's benefit programs and program details. Endpoints are authenticated (OIDC / JWT). | [Beneficiary portal APIs](/products/pbms/developer-zone/api-reference/beneficiary-portal-apis.md)         |
| Staff Portal API       | Backs the Odoo staff UI. Serves the eligibility summary, disbursement envelope/batch views, and beneficiary search.                                       | [Staff portal APIs (for Odoo)](/products/pbms/developer-zone/api-reference/staff-portal-apis-for-odoo.md) |

Both services:

* Run the database migration on container start (`python3 -m <module>.main migrate`) and then serve the app under Gunicorn with the `uvicorn.workers.UvicornWorker` worker class, listening on port `8000` inside the container.
* Share a common request/response envelope defined in `openg2p_fastapi_common.schemas` (see the individual pages for details).

> **Note:** There is no separate "agency app" API service in the PBMS codebase. Agency-facing views are served through the Staff Portal API and the Odoo application; there is no standalone agency-app service to document.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.openg2p.org/products/pbms/developer-zone/api-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
