---
title: "Replace repository application mappings"
method: POST
path: "/api/v1/org/{orgId}/repo/{repoId}/applications"
tags: ["Repositories"]
---

# Replace repository application mappings

`POST /api/v1/org/{orgId}/repo/{repoId}/applications`

## Replace Repository Applications

**Replace** the list of applications for the given repository.

**Usage:**
Only the id parameters are required for this request. All other fields are ignored.
* `orgId`
* `repoId`
* `appInfos.[*].id` - one entry for each app you want to map. You must pass in current mappings to maintain them.

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
- `repoId` string, uuid, required

## Request body

- RepositoryReplaceRepositoryAppMappingsRequest — provide a repository and all applications to update repository mappings
  - `appInfos` RepositoryAppInfo[] — The list of application mappings for this 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.
  - `orgId` string — The organization this operation belong to.
  - `repoId` string — The repository id to replace application mappings for.

## Response `200`

OK

- RepositoryReplaceRepositoryAppMappingsResponse
  - `appInfos` RepositoryAppInfo[] — The list of application mappings for this 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.
  - `orgId` string — The organization this operation belong to.
  - `repoId` string — The repository id to replace application mappings for.

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