---
title: "Create a new DSN for a project"
method: POST
path: "/projects/{project_id}/dsns"
---

# Create a new DSN for a project

`POST /projects/{project_id}/dsns`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/dsns`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required

## Request body

- CreateDSNRequest
  - `base_url` string, nullable
  - `deployment_id` integer, nullable
  - `environment_id` integer, nullable
  - `name` string, nullable

## Response `201`

DSN created

- ProjectDSNResponse
  - `created_at` string, required
  - `deployment_id` integer, nullable
  - `dsn` string, required
  - `environment_id` integer, nullable
  - `event_count` integer, required
  - `id` integer, required
  - `is_active` boolean, required
  - `name` string, required
  - `project_id` integer, required
  - `public_key` string, required

## Other responses

- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Project not found

## Changes

- **2026-07-27** `1b060c0a4ba3`: 4 info
  - the endpoint scheme security `bearer_auth` was added to the API
  - api tag `dsn` removed
  - added the non-success response with the status `401`
  - added the non-success response with the status `403`

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/dsns/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
