Temporal Workflow API Starter
Template for building FastAPI gateways for Temporal workflow management.
Overview
temporal-workflow-api-starter is a fork-and-customize template for a FastAPI service that
manages Temporal workflow executions over REST. It does not contain workflow or activity
code — it starts, queries, signals, and approves workflows that run in a separate worker
service, such as one built from temporal-workflow-worker-starter. It composes temporalio
and foundry-temporal to talk to a Temporal server and exposes that as a documented,
authenticated HTTP API.
Key Features
- Workflow lifecycle endpoints — start, check status, list, query, signal, and approve
(human-in-the-loop) a Temporal workflow via
src/routers/workflows.py - Fail-closed bearer authentication —
/workflows/*endpoints requireAPI_AUTH_TOKEN; the API rejects every workflow request when it is unset - Kubernetes-ready health checks —
/health,/health/detailed,/health/temporal, and/health/readyinsrc/routers/health.py - Automatic OpenAPI documentation — Swagger UI at
/docsand ReDoc at/redoc, generated from the Pydantic models insrc/models.py - Dual-tier tests and Postman collections —
tests/unit/andtests/integration/, plus a ready-to-import collection underpostman/
Architecture
The API is a thin FastAPI gateway (src/main.py) in front of a Temporal server. Requests
land on one of two routers — workflows.py for workflow operations and health.py for
liveness/readiness — and src/dependencies.py provides the authenticated Temporal client,
built with foundry-temporal's create_temporal_client. Configuration is loaded from
environment variables through pydantic-settings in src/config.py. The template ships
with MyWorkflow references from temporal-workflow-worker-starter for testing, but
running an actual workflow requires deploying a separate worker service.
Next Steps
- Quickstart — get up and running
- API Design Guide — REST API design principles
- API Endpoints Reference — detailed API reference
- Deployment Guide — production deployment