---
title: "Update repository context"
method: POST
path: "/api/v2/contexts/update"
tags: ["Repository Context"]
---

# Update repository context

`POST /api/v2/contexts/update`

## Request

- Base URL: `https://zeropath.com`
- URL: `https://zeropath.com/api/v2/contexts/update`
- Auth: API key in header `X-ZeroPath-API-Token-Id` and API key in header `X-ZeroPath-API-Token-Secret`

Update an existing context by contextId. Omitted fields and scope are preserved. Missing IDs return 404 and never create a context. Requires permission over both existing and requested assignments.

## Request body

- UpdateContextInput
  - `organizationId` string: Organization ID. Resolved from authentication when omitted.
  - `title` string: Optional label. Empty or whitespace-only titles clear the label.
  - `context` string: Nonblank natural-language context used in subsequent scans.
  - `globPattern` string: File glob. Defaults to ** on creation; omission preserves the value on update.
  - `applicableSourceTypes` string[]: Source types to target. An empty array applies to all source types.
  - `scanPhases` string[]: Scan phases to target. Omission preserves phases on update; creation uses the documented default phase set.
  - `scope` 'allRepositories' | 'repositories' | 'tags': Explicit scope. repositories requires repositoryIds; tags requires tagIds. Conflicting selectors are rejected.
  - `allRepositories` true: Apply to every current and future repository. Cannot be combined with repositoryIds or scope: tags.
  - `repositoryIds` string[]: Direct repository assignments. Omission on update preserves scope; use allRepositories: true to change it.
  - `tagIds` string[]: Additional tag assignments. On create, tagIds alone creates tag-only scope. On update, tagIds alone replaces direct tags and preserves scanner-setting assignments; use scope: tags to switch to tag-only scope.
  - `contextId` string, required

## Response `200`

Successful response

- ContextIdResponse
  - `id` string, required

## Other responses

- `400`: Error Response
- `401`: Error Response
- `403`: Error Response
- `404`: Error Response
- `409`: Error Response

---

[API](https://skmtc.dev/zeropath/apis/zeropath-api.md) - [All operations](https://skmtc.dev/zeropath/apis/zeropath-api/llms.txt) - [OpenAPI document](https://skmtc.dev/zeropath/apis/zeropath-api/revisions/126e9c80ba0d?raw)
