# PUT /api/v1/org/{orgId}/repos/apps

**Associate application to repository**

## Replace Repository Applications

Creates the given apps and then adds them to the specified repos.

**Usage:**
Only the id parameters are required for this request. All other fields are ignored.
* `orgId`
* `repoId`
* `appInfos.[*].name` - one entry for the name of each app you want to create.

Note that the other fields in `appInfos` are read-only for this request, and will be ignored.

> 🧾 Audited
> This is recorded as `APPLICATIONS_ADDED_FOR_REPOS` [User Activity](https://apidocs.stackhawk.com/reference/listauditactivity#user-activity-types).

> Requires `write:application` permission.

## Parameters

- `orgId` (in: path, string<uuid>) *(required)* — UUID identifier for this StackHawk Organization.

## Request Body

### application/json

- `newRepositoryApps` (repository.NewRepositoryApp[]) — The list of repository to application mappings to set for a repository.
  - `appInfos` (repository.AppInfo[]) — The list of applications to be created for the specified repository.
    - `appStatus` (string) — Read-only field for the application status.
    - `id` (string) — The application id.
    - `lastScanHost` (string) — Read-only field for the last scan host.
    - `lastScanId` (string) — Read-only field for the last scan id.
    - `lastScanTimestamp` (integer<int64>) — Read-only field for the last scan timestamp.
    - `name` (string) — The application name.
  - `repoId` (string) — The repository id to associate to the list of applications.
- `orgId` (string) — The organization to map an an existing application to an existing repository in.

## Responses

### 200 — OK

#### application/json

- `newRepositoryApps` (repository.NewRepositoryApp[]) — The list of updated repository to application mappings.
  - `appInfos` (repository.AppInfo[]) — The list of applications to be created for the specified repository.
    - `appStatus` (string) — Read-only field for the application status.
    - `id` (string) — The application id.
    - `lastScanHost` (string) — Read-only field for the last scan host.
    - `lastScanId` (string) — Read-only field for the last scan id.
    - `lastScanTimestamp` (integer<int64>) — Read-only field for the last scan timestamp.
    - `name` (string) — The application name.
  - `repoId` (string) — The repository id to associate to the list of applications.
- `orgId` (string) — The organization id where repository to application mappings were updated.

#### application/x-protobuf

- `newRepositoryApps` (repository.NewRepositoryApp[]) — The list of updated repository to application mappings.
  - `appInfos` (repository.AppInfo[]) — The list of applications to be created for the specified repository.
    - `appStatus` (string) — Read-only field for the application status.
    - `id` (string) — The application id.
    - `lastScanHost` (string) — Read-only field for the last scan host.
    - `lastScanId` (string) — Read-only field for the last scan id.
    - `lastScanTimestamp` (integer<int64>) — Read-only field for the last scan timestamp.
    - `name` (string) — The application name.
  - `repoId` (string) — The repository id to associate to the list of applications.
- `orgId` (string) — The organization id where repository to application mappings were updated.

### 400 — Bad Request

- (no body)

### 401 — Unauthorized

- (no body)
