---
title: "Create an Organization Code Mapping"
url: https://docs.sentry.io/api/integrations/create-an-organization-code-mapping/
---

# Create an Organization Code Mapping | Sentry Docs

POST /api/0/organizations/{organization\_id\_or\_slug}/code-mappings/

Create a repository path mapping for a project and installed integration.

### Path Parameters

* `organization_id_or_slug` *(string)*

  REQUIRED

  The ID or slug of the organization the resource belongs to.

### Body Parameters

* `repository_id` *(integer)*

  REQUIRED

  The ID of a repository belonging to the installed integration.

* `project_id` *(integer)*

  REQUIRED

  The ID of the project to associate with the code mapping.

* `stack_root` *(string)*

  REQUIRED

  The path prefix to replace in stack trace filenames.

* `source_root` *(string)*

  REQUIRED

  The repository path prefix to substitute for the stack trace prefix.

* `integration_id` *(integer)*

  REQUIRED

  The ID of the installed integration that provides the repository.

* `default_branch` *(string)*

  The default branch to use when resolving source files. May be empty for Perforce.

### Scopes

You need to [authenticate via bearer auth token.](https://docs.sentry.io/api/auth.md)

`<auth_token>` requires one of the following scopes:

* `org:admin`
* `org:integrations`
* `org:read`
* `org:write`

```
curl https://sentry.io/api/0/organizations/{organization_id_or_slug}/code-mappings/ \
 -H 'Authorization: Bearer <auth_token>' \
 -H 'Content-Type: application/json' \
 -d '{}'
```

RESPONSESCHEMA

```
Copied
.
```

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
