> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.adid.dev/llms.txt.
> For full documentation content, see https://docs.adid.dev/llms-full.txt.

# DIDComm Connection Invitation Flow

**Used in:** §7.2 Connections & Invitations, §7.6 Encryption & Authentication
**Audience:** Agent Operator, Holder, Backend Developer
**IA ID:** D14

```mermaid
sequenceDiagram
  autonumber
  participant Inviter
  participant API
  participant DB
  participant Mediator
  participant Invitee

  Inviter->>API: POST /api/v1/didcomm/connections/invite
  API->>DB: INSERT connection (state=invited)
  API-->>Inviter: invitation { url, label, recipientKeys, serviceEndpoint }
  Inviter->>Invitee: out-of-band (URL / QR)
  Invitee->>API: POST /api/v1/didcomm/connections/accept (invitationId)
  API->>DB: UPDATE connection (state=responded)
  API->>Mediator: forward connection-response (packed DIDComm)
  Mediator-->>Inviter: deliver inbound
  Inviter->>API: POST /api/v1/didcomm/receive
  API->>DB: UPDATE connection (state=completed)
  API-->>Inviter: ack
```

**Reading guide:** `/didcomm/receive` is exposed both publicly (for mediator delivery, `router.go:63`) and authenticated (for in-platform usage, `router.go:122`). Treat them as two endpoints sharing one handler.

***