---
title: "Assemble workspace context"
method: POST
path: "/api/v1/desktop/context/inject"
tags: ["Desktop Companion"]
---

# Assemble workspace context

`POST /api/v1/desktop/context/inject`

## Request

- Base URL: `https://www.devspeak.dev`
- URL: `https://www.devspeak.dev/api/v1/desktop/context/inject`
- Auth: HTTP bearer

Builds a compact workspaceContext string from local file chunks. Requires the desktop:projects:write scope.

## Request body

- ContextInjectRequest
  - `projectId` string, required
  - `label` string
  - `query` string: Pending translation input. Chunks are ranked against it so query-relevant files survive the context budget instead of whichever files were enumerated first.
  - `chunks` ContextChunk[], required
    - `path` string, required
    - `content` string, required
    - `symbols` string[]

## Response `200`

Assembled context

- AssembledContextResponse
  - `success` true, required
  - `data` AssembledContext, required
    - `contextId` string, required
    - `contextText` string, required
    - `tokenEstimate` integer, required
    - `chunkCount` integer, required
    - `includedCount` integer: Chunks that fit the context budget. Below chunkCount means context was dropped.

## Other responses

- `400`: Validation error
- `401`: Missing or invalid credentials
- `403`: Missing scope, feature, or plan access
- `500`: Internal server error

---

[API](https://skmtc.dev/devspeak/apis/devspeak-api-v1.md) · [All operations](https://skmtc.dev/devspeak/apis/devspeak-api-v1/llms.txt) · [OpenAPI document](https://skmtc.dev/devspeak/apis/devspeak-api-v1/revisions/7000833a5bbf?raw)
