---
title: Update a repository's threat model
description: Fold new context and triage into a threat model.
url: https://www.hacktron.ai/docs/api/repos/update-repository-threat-model
---

# Update a repository's threat model

Folds a repository's new context documents and triage feedback, such as false positives and accepted risks, into its [threat model](/docs/platform/context/threat-models#repository-threat-models). Use the repository's id from [`GET /repos`](/docs/api/repos/list-repos). You need the member role or above.

- When the repository has no threat model yet, Hacktron builds its first one from the code and `initial` is `true`. Documents saved before then are folded in by the next update.
- `started` is `false` when nothing new was waiting to be folded in.
- A first build that can't start returns `503 Service Unavailable`. Try again later.

The update runs in the background for a few minutes. Read the result with [`GET /context-documents/{id}`](/docs/api/context-documents/get-context-document).

## Request

`POST /repositories/{id}/threat-model/sync`

Send an [API key](/docs/api/authentication) with the `write` scope in the `X-Api-Key` header.

:::examples

```bash title="Request" wrap=false
curl -X POST "https://api.hacktron.ai/v1/repositories/<id>/threat-model/sync" \
  -H "X-Api-Key: $HACKTRON_API_KEY"
```

```json title="Response 200 OK" showLineNumbers=false wrap=false
{
  "started": true,
  "initial": false
}
```

:::

### Path parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `id` | string, required | |

## Responses

### 200 OK

| Field | Type | Description |
| --- | --- | --- |
| `started` | boolean, required | Whether an update started; false when nothing new was waiting to be folded in. |
| `initial` | boolean, required | Whether this builds the repository's first threat model from its code. |
