# Assign project repositories

Assign project repositories

`PUT /api/projects/{id}/repositories`

Required permission: `project:update`.

## Parameters

| Name | In | Type | Required | Description |

| --- | --- | --- | --- | --- |

| `id` | path | `string` | Yes | — |

| `Idempotency-Key` | header | `string` | No | Required for writes authenticated by a service credential and for service-account lifecycle writes. Other session writes may opt in. Reuse the key and payload for retries. Settled keys remain reserved for at least seven days; a transient 4xx releases its key. Changed payloads return 409. Match any legacy clientOperationId/clientMessageId in the body. |

## Request body

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `repositories` | `object[]` | Yes | — | — |
| `repositories.baseBranch` | `string \| null` | No | — | — |
| `repositories.baseBranch.Option 1` | `string` | No | min length 1 | — |
| `repositories.baseBranch.Option 2` | `null` | No | — | — |
| `repositories.repositoryId` | `string` | Yes | min length 1 | — |
| `repositories.sourceControlConnectionId` | `string` | No | min length 1 | — |
| `clientOperationId` | `string` | No | min length 1, max length 64 | — |

```json
{
  "repositories": [
    {
      "repositoryId": "repo_example",
      "baseBranch": "main"
    }
  ]
}
```

## Example request

```bash
curl --request PUT \
  --url https://api.hoplite.sh/api/projects/id/repositories \
  --header "X-Api-Key: $HOPLITE_API_KEY" \
  --header "Idempotency-Key: $HOPLITE_OPERATION_ID" \
  --header 'Content-Type: application/json' \
  --data '{
  "repositories": [
    {
      "repositoryId": "repo_example",
      "baseBranch": "main"
    }
  ]
}'
```

## 200 response

Successful response

Content type: `application/json`. Response type: `object`.

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `ok` | `boolean` | Yes | constant true | — |
| `project` | `object` | Yes | — | — |
| `project.id` | `string` | Yes | — | — |
| `project.name` | `string` | Yes | — | — |
| `project.description` | `string \| null` | No | — | — |
| `project.taskCode` | `string` | No | — | — |
| `project.repos` | `object[]` | No | — | — |
| `project.repos.repoFullName` | `string` | Yes | — | — |
| `project.repos.repositoryId` | `string` | No | — | — |
| `project.repos.branch` | `string` | No | — | — |
| `project.githubInstallationId` | `string` | No | — | — |
| `project.defaultBranch` | `string \| null` | No | — | — |
| `project.previewPort` | `integer` | No | min 3000, max 9999 | — |
| `project.setupScript` | `string \| null` | No | — | — |
| `project.runScript` | `string \| null` | No | — | — |
| `project.archiveScript` | `string \| null` | No | — | — |
| `project.instructions` | `string \| null` | No | — | — |
| `project.defaultModel` | `string \| null` | No | — | — |
| `project.reasoningEffort` | `string \| null` | No | — | — |
| `project.reasoningEffort.Option 1` | `string` | No | off · none · minimal · low · medium · high · xhigh · max | — |
| `project.reasoningEffort.Option 2` | `null` | No | — | — |
| `project.agentSpeed` | `string \| null` | No | — | — |
| `project.agentSpeed.Option 1` | `string` | No | standard · fast | — |
| `project.agentSpeed.Option 2` | `null` | No | — | — |
| `project.prReviewAutofixDefault` | `boolean \| null` | No | — | — |
| `project.sandboxSpec` | `object \| null` | No | — | — |
| `project.sandboxSpec.Option 1` | `object` | No | — | — |
| `project.sandboxSpec.Option 1.defaultCpu` | `integer \| null` | No | — | — |
| `project.sandboxSpec.Option 1.defaultCpu.Option 1` | `integer` | No | min 1, max 9007199254740991 | — |
| `project.sandboxSpec.Option 1.defaultCpu.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 1.defaultMemoryGiB` | `integer \| null` | No | — | — |
| `project.sandboxSpec.Option 1.defaultMemoryGiB.Option 1` | `integer` | No | min 1, max 9007199254740991 | — |
| `project.sandboxSpec.Option 1.defaultMemoryGiB.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 1.maxCpu` | `integer \| null` | No | — | — |
| `project.sandboxSpec.Option 1.maxCpu.Option 1` | `integer` | No | min 1, max 9007199254740991 | — |
| `project.sandboxSpec.Option 1.maxCpu.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 1.maxDiskGiB` | `integer \| null` | No | — | — |
| `project.sandboxSpec.Option 1.maxDiskGiB.Option 1` | `integer` | No | min 1, max 9007199254740991 | — |
| `project.sandboxSpec.Option 1.maxDiskGiB.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 1.maxMemoryGiB` | `integer \| null` | No | — | — |
| `project.sandboxSpec.Option 1.maxMemoryGiB.Option 1` | `integer` | No | min 1, max 9007199254740991 | — |
| `project.sandboxSpec.Option 1.maxMemoryGiB.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 1.staffMaxCpu` | `integer \| null` | No | — | — |
| `project.sandboxSpec.Option 1.staffMaxCpu.Option 1` | `integer` | No | min 1, max 9007199254740991 | — |
| `project.sandboxSpec.Option 1.staffMaxCpu.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 1.staffMaxDiskGiB` | `integer \| null` | No | — | — |
| `project.sandboxSpec.Option 1.staffMaxDiskGiB.Option 1` | `integer` | No | min 1, max 9007199254740991 | — |
| `project.sandboxSpec.Option 1.staffMaxDiskGiB.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 1.staffMaxMemoryGiB` | `integer \| null` | No | — | — |
| `project.sandboxSpec.Option 1.staffMaxMemoryGiB.Option 1` | `integer` | No | min 1, max 9007199254740991 | — |
| `project.sandboxSpec.Option 1.staffMaxMemoryGiB.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 1.runtimeProfile` | `string \| null` | No | — | — |
| `project.sandboxSpec.Option 1.runtimeProfile.Option 1` | `string` | No | docker-compose | — |
| `project.sandboxSpec.Option 1.runtimeProfile.Option 2` | `null` | No | — | — |
| `project.sandboxSpec.Option 2` | `null` | No | — | — |
| `project.framework` | `string \| null` | No | — | — |
| `project.prebuildsEnabled` | `boolean` | No | — | — |
| `project.prebuildsPreference` | `string \| null` | No | — | — |
| `project.prebuildsPreference.Option 1` | `string` | No | enabled · disabled | — |
| `project.prebuildsPreference.Option 2` | `null` | No | — | — |
| `project.createdAt` | `string` | No | — | — |
| `project.updatedAt` | `string` | No | — | — |

```json

```

## Response headers

| Header | Type | Statuses | Description |

| --- | --- | --- | --- |

| `RateLimit` | `string` | `200`, `400`, `401`, `402`, `403`, `404`, `409`, `410`, `429`, `500`, `501`, `503` | Current ingress policy, remaining requests, and seconds until reset, for example `"ingress";r=599;t=60`. |

| `RateLimit-Policy` | `string` | `200`, `400`, `401`, `402`, `403`, `404`, `409`, `410`, `429`, `500`, `501`, `503` | Ingress quota and window, for example `"ingress";q=600;qu="requests";w=60`. |

| `X-RateLimit-Limit` | `integer` | `200`, `400`, `401`, `402`, `403`, `404`, `409`, `410`, `429`, `500`, `501`, `503` | Maximum requests allowed in the current rolling window. |

| `X-RateLimit-Remaining` | `integer` | `200`, `400`, `401`, `402`, `403`, `404`, `409`, `410`, `429`, `500`, `501`, `503` | Requests remaining in the current rolling window. |

| `X-RateLimit-Reset` | `integer` | `200`, `400`, `401`, `402`, `403`, `404`, `409`, `410`, `429`, `500`, `501`, `503` | Unix timestamp when the current rolling window resets. |

| `x-request-id` | `string` | `200`, `400`, `401`, `402`, `403`, `404`, `409`, `410`, `429`, `500`, `501`, `503` | Request correlation ID. |

| `Retry-After` | `integer` | `429`, `503` | Seconds until another request should be attempted. |

| `X-Retry-After` | `integer` | `429`, `503` | Legacy retry delay in seconds. |

## Status codes

- `200` — Successful response

- `400` — Invalid request. Validation responses include field paths.

- `401` — The API key is missing, invalid, or lacks the operation's permission.

- `402` — The organization does not have access to the requested product capability.

- `403` — The key's current user no longer has the required organization membership or role.

- `404` — The resource is not available in the authenticated scope.

- `409` — The request conflicts with a retry receipt or current resource state.

- `410` — The event cursor has expired; capture a fresh head and resource snapshot.

- `429` — The API-key rate limit has been exceeded.

- `500` — The API encountered an unexpected failure.

- `501` — The deployment has not configured the requested capability.

- `503` — A required API dependency, including the rate limiter, is unavailable.