---
title: "Associate application to repository"
method: PUT
path: "/api/v1/org/{orgId}/repos/apps"
tags: ["Repositories"]
---

# Associate application to repository

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

## 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.

## Path parameters

- `orgId` string, uuid, required

## Request body

- RepositoryAddApplicationToRepoRequest — Create or update the application to repository mappings. This request replaces all applications associated to each repository in the request.
  - `newRepositoryApps` RepositoryNewRepositoryApp[] — The list of repository to application mappings to set for a repository.
    - `appInfos` RepositoryAppInfo[] — The list of applications to be created for the specified repository.
      - `appStatus` 'ACTIVE' | 'ENV_INCOMPLETE' — 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 — 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.

## Response `200`

OK

- RepositoryAddApplicationToRepoResponse
  - `newRepositoryApps` RepositoryNewRepositoryApp[] — The list of updated repository to application mappings.
    - `appInfos` RepositoryAppInfo[] — The list of applications to be created for the specified repository.
      - `appStatus` 'ACTIVE' | 'ENV_INCOMPLETE' — 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 — 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.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized

---

[API](https://skmtc.dev/stackhawk/apis/stackhawk-public-api.md) · [All operations](https://skmtc.dev/stackhawk/apis/stackhawk-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/stackhawk/stackhawk-public-api/revisions/8252990ac9eb/schema)
