# DB-2-API — Use case

> Turn SQL queries and stored procedures into governed REST endpoints — without a service layer. Auth, audit, rate limits, and OpenAPI come included.

*Developers · SQL → API · For developers*

## Your SQL is already an API. Apinizer just publishes it.

DB-2-API turns a parameterized query or stored procedure into a governed REST endpoint. The runtime handles auth, rate limits, validation, audit, and the OpenAPI spec.

[Five-minute quickstart](https://apinizer.com/developers/quickstart) · [Open API Creator](https://apinizer.com/products/db-to-api)

---

## The problem

*The problem*

### Half the 'service layer' in the world is one stored procedure with a Spring wrapper.

Engineers spend whole sprints writing thin services in front of legacy databases — controllers, DTOs, validators — just to expose a query. Apinizer's DB-2-API skips the service: bind a SQL query (or stored procedure), declare parameters and types, and the gateway publishes it as a REST endpoint with full governance.

---

## Capabilities

### SQL or stored procedure

Bind a parameterized SQL query or a stored procedure name. The gateway handles binding, paging, type coercion, and result shaping.

### Governed from day zero

Auth, rate limits, audit, encryption — all the API-Gateway controls apply automatically. DB-2-API is not a bypass; it's a governed shortcut.

### OpenAPI generated

Parameters, response shape, status codes — OpenAPI spec generated from the binding. Partner portal lists it like any other API.

### Credential vault

DB credentials live in the encrypted vault. The query references them by name; the platform never logs them, never exposes them.

### Multiple database engines

PostgreSQL, MySQL, MSSQL, Oracle, Db2 — the same binding pattern works across engines.

### Full audit trail

Every request captured — caller, parameters, latency, row count. The DB call shows up in audit the way every other endpoint does.

---

## Real-world examples

### Government

**Scenario:** Ankara ministry exposes 40 legacy stored procedures as a citizen-services API

**Outcome:** Each procedure became a governed REST endpoint in a day. The mainframe doesn't know anything changed; the developer portal lists the new APIs the same morning.

**Metric:** 40 procs, 1 sprint

### Manufacturing

**Scenario:** Stuttgart OEM exposes MES queries to partner factories

**Outcome:** Production-line queries published with rate-limit and partner-scoped auth. Suppliers self-onboard via the portal; no thin services to maintain.

### Healthcare

**Scenario:** Stockholm hospital exposes patient-summary queries on an internal API

**Outcome:** FHIR-shaped responses from underlying relational tables. Audit covers every read; consent enforced at the binding layer.

### Retail

**Scenario:** Madrid retailer publishes inventory queries to 230 stores

**Outcome:** Each store calls an inventory lookup; cache keeps DB load flat. New endpoints ship without writing service code.

### Public sector

**Scenario:** Amsterdam transit authority exposes timetable lookups as REST

**Outcome:** What used to be a SOAP service from 2008 is now a paged REST endpoint with OpenAPI. Cache hit-rate at 98% during peak.

### Insurance

**Scenario:** Milan insurer exposes a 25-year-old claim-status procedure

**Outcome:** Procedure unchanged; the gateway publishes it as REST with auth, rate-limit, and audit. Claims chatbot integrates without touching the legacy team.

### Energy

**Scenario:** Prague utility exposes meter-reading queries to ESCOs

**Outcome:** ESCOs subscribe via the portal; the gateway throttles per ESCO. The database team stops fielding ad-hoc requests for exports.

### Banking

**Scenario:** Baku bank exposes statement queries to mobile + branch + partner

**Outcome:** One binding, three consumer groups, three rate limits. Audit covers every call; the legacy DB stays where it is.

---

## Recommended modules

- [DB to API](https://apinizer.com/products/db-to-api) — Turn queries and stored procedures into governed REST endpoints in minutes.
- [API Creator](https://apinizer.com/products/api-creator) — DB-2-API alongside Script-2-API and Mock API — the full Creator surface.
- [API Gateway](https://apinizer.com/products/api-gateway) — Runtime that applies auth, rate limits, audit to every DB-2-API endpoint.
- [API Portal](https://apinizer.com/products/api-portal) — Surface DB-2-API endpoints alongside the rest of your API catalogue.

---

## Resources

- [DB-2-API overview](https://docs.apinizer.com/en) — How to bind a query or procedure, declare parameters, and ship a governed endpoint.
- [DB to API product](https://apinizer.com/products/db-to-api) — The full Creator surface for database-backed endpoints.
- [API Creator hub](https://apinizer.com/products/api-creator) — DB-2-API, Mock API, Script-2-API — all in one place.
- [Analytics Engine](https://apinizer.com/products/analytics-engine) — Per-endpoint, per-consumer telemetry — including DB-2-API endpoints.
- [APIops manifests](https://apinizer.com/developers/apiops) — Define bindings as code, review in Git, apply idempotently.
- [Architecture overview](https://docs.apinizer.com/en/concepts/architecture) — How DB-2-API fits in the platform topology.

---

## Related use cases

- [Script-2-API (Groovy / JS)](https://apinizer.com/solutions/script-2-api) — For developers
- [Mock APIs](https://apinizer.com/solutions/mock-apis) — For developers
- [Legacy modernization](https://apinizer.com/solutions/legacy-modernization) — For executives
- [Connector library (15+)](https://apinizer.com/solutions/connector-library) — For developers

---

## Next step

*SQL as API*

**Skip the service layer. Ship the endpoint.**

A 30-minute walkthrough — bind, declare, publish, govern — on a Kubernetes of your choice.

[Book a Demo](https://calendly.com/apinizer/15min) · [Read the docs](https://apinizer.com/developers/docs)

---

## Links

- Products: https://apinizer.com/products
- AI Gateway: https://apinizer.com/products/ai-gateway
- Solutions: https://apinizer.com/solutions
- Pricing: https://apinizer.com/pricing
- Developers: https://apinizer.com/developers
- Documentation: https://docs.apinizer.com/index-en
- Blog: https://apinizer.com/blog
- Contact: https://apinizer.com/company/contact

© 2026 Apinizer. All rights reserved.
