---
title: Add repositories to an application
description: Add connected repositories to an application.
url: https://www.hacktron.ai/docs/api/applications/add-application-repositories
---

# Add repositories to an application

Adds up to 50 connected repositories to an application, named by its `id` or `slug`. Use repository ids from [`GET /repos`](/docs/api/repos/list-repos). A repository already in the application stays as it is. The response lists every repository in the application, oldest first, and Hacktron queues an update of the application's threat model. Only organisation admins can call it.

## Request

`POST /applications/{idOrSlug}/repositories`

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/applications/payments/repositories" \
  -H "X-Api-Key: $HACKTRON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "repository_ids": [
    "9b2e7c1a-4f3d-4e8b-a6c5-1d2e3f4a5b6c"
  ]
}'
```

```json title="Response 200 OK" showLineNumbers=false wrap=false
{
  "repos": [
    {
      "application_id": "8d3c5f7e-2b1a-4c9d-9e6f-0a1b2c3d4e5f",
      "repo_url": "https://github.com/acme/api",
      "added_by": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "added_at": "2026-10-02T09:14:00.000Z"
    },
    {
      "application_id": "8d3c5f7e-2b1a-4c9d-9e6f-0a1b2c3d4e5f",
      "repo_url": "https://github.com/acme/billing-worker",
      "added_by": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "added_at": "2026-11-08T10:05:12.000Z"
    }
  ]
}
```

:::

### Path parameters

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

### Body

A required `application/json` body.

| Field | Type | Description |
| --- | --- | --- |
| `repository_ids` | array of string, required | Ids from the repository list. |

## Responses

### 200 OK

| Field | Type | Description |
| --- | --- | --- |
| `repos` | array of object, required | |
| `repos[].application_id` | string, required | |
| `repos[].repo_url` | string, required | |
| `repos[].added_by` | string, required, nullable | |
| `repos[].added_at` | string (date-time), required | |
