---
title: "Forward a just-minted key into a waiting connect grant (#38)"
method: POST
path: "/v1/agent-keys/connect-grant"
tags: ["agent-keys"]
---

# Forward a just-minted key into a waiting connect grant (#38)

`POST /v1/agent-keys/connect-grant`

## Request

- Base URL: `https://api.bubblio.dev`
- URL: `https://api.bubblio.dev/v1/agent-keys/connect-grant`
- Auth: HTTP bearer

The phone-connect flow's server half: the platform's key route calls this INSTEAD
of returning a fresh key to the browser. The raw key must hash to the named row
(proof the caller holds the very key it is connecting); the write stamps the
waiting quote and its approval, then flips the grant LAST, winner-only. The key
rests encrypted for its ONE delivery through the agent's poll. Idempotent for a
retried POST of the SAME key; a different key against a granted grant is a 409
(`code: conflict`) — one grant, one key, forever.

## Request body

- object
  - `grantId` string, required
  - `key` string, required: The raw bak_ key the mint just returned.
  - `id` string, uuid, required: The minted key's row id.

## Response `200`

Connected (with `already: true` on an idempotent repeat).

- object
  - `ok` boolean
  - `already` boolean

## Other responses

- `400`: One calm sentence naming the malformed field.
- `404`: Uniform miss: unknown, foreign, or malformed grant.
- `409`: Window closed (`code: expired`/`window_closed`), a different key already connected (`code: conflict`), or migration lag.

---

[API](https://skmtc.dev/bubblio/apis/bubblio-agent-door-api.md) · [All operations](https://skmtc.dev/bubblio/apis/bubblio-agent-door-api/llms.txt) · [OpenAPI document](https://skmtc.dev/bubblio/apis/bubblio-agent-door-api/revisions/d858aff9c01d?raw)
