---
id: w2/m5/t002
title: REST — GET /v1/services/{id}/deploys + /deploys/{deployId}, Render shapes
worker: worker2
status: done
estimate: 25m
depends_on: [w2/m5/t001]
---

## Objective

Expose deploy history on the Render-compatible REST surface: `GET /v1/services/{id}/deploys` (the `{deploy, cursor}` list envelope) and `GET /v1/services/{id}/deploys/{deployId}`, shapes verified against Render's OpenAPI.

## Context

- Follow the established envelope rules (`docs/ADR006-bex-api.md`): Render's list envelope, omit fields bex can't honor (commit metadata before w1/m5 builds exist), stay a safe superset.
- Routes also serve under the `/v1/apps` alias.

## Steps

1. Routes in the feature's `rest.go` delegating to `ListDeploys`/`GetDeploy`.
2. Store-less mode (`BEX_CP_DB_URI` unset) → 503, matching the env-vars precedent.
3. Update `docs/ADR006-bex-api.md`.

## Files

- `lego/backend/internal/apps/rest.go` (or the deploys feature's `rest.go`)
- `docs/ADR006-bex-api.md`

## Acceptance criteria

- [ ] List returns Render's `[{deploy, cursor}]` envelope, newest-first; get returns one deploy; 404 unknown; 503 without the store.

## Out of scope

- Trigger endpoint (t003); pagination beyond the single-page envelope (matching existing list endpoints).
