---
title: "Render a Claude Code SessionStart envelope for a lifecycle hook"
method: POST
path: "/api/agent/hooks/session-start"
tags: ["Agent"]
---

# Render a Claude Code SessionStart envelope for a lifecycle hook

`POST /api/agent/hooks/session-start`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/agent/hooks/session-start`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

T858. Takes the raw `.contextq/config.json` bytes plus a few git facts as `application/x-www-form-urlencoded` and returns the FINISHED Claude Code SessionStart envelope, which the hook prints verbatim. The caller builds and parses no JSON at all, so a plugin hook needs nothing on the machine but bash, curl and git. Answers `204` when the repo is disabled or the boot pack would be empty, so the hook prints nothing.

## Response `200`

The finished SessionStart envelope, ready to print verbatim.

- object
  - `hookSpecificOutput` object
    - `hookEventName` 'SessionStart'
    - `additionalContext` string

## Other responses

- `204`: Nothing to inject — the repo is disabled or the boot pack is empty.
- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
