2020-07-13 17:09:24 -04:00
---
stage: Monitor
2022-01-27 13:14:37 -05:00
group: Respond
2022-09-21 17:13:33 -04:00
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-07-13 17:09:24 -04:00
---
2021-01-28 01:08:59 -05:00
# Error Tracking settings API **(FREE)**
2020-01-13 16:07:39 -05:00
2020-05-21 02:08:25 -04:00
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/34940) in GitLab 12.7.
2020-01-13 16:07:39 -05:00
## Error Tracking project settings
2020-07-24 17:09:16 -04:00
The project settings API allows you to retrieve the [Error Tracking ](../operations/error_tracking.md )
2022-01-30 19:14:49 -05:00
settings for a project. Only for users with Maintainer role for the project.
2020-01-13 16:07:39 -05:00
### Get Error Tracking settings
2020-02-27 04:09:01 -05:00
```plaintext
2020-01-13 16:07:39 -05:00
GET /projects/:id/error_tracking/settings
```
| Attribute | Type | Required | Description |
| --------- | ------- | -------- | --------------------- |
2021-06-28 11:08:03 -04:00
| `id` | integer | yes | The ID or [URL-encoded path of the project ](index.md#namespaced-path-encoding ) owned by the authenticated user |
2020-01-13 16:07:39 -05:00
2020-01-30 10:09:15 -05:00
```shell
2020-05-27 20:08:37 -04:00
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings"
2020-01-13 16:07:39 -05:00
```
Example response:
```json
{
2020-01-16 19:09:00 -05:00
"active": true,
2020-01-13 16:07:39 -05:00
"project_name": "sample sentry project",
"sentry_external_url": "https://sentry.io/myawesomeproject/project",
2021-08-17 02:08:59 -04:00
"api_url": "https://sentry.io/api/0/projects/myawesomeproject/project",
"integrated": false
2020-01-13 16:07:39 -05:00
}
```
2020-02-05 13:09:06 -05:00
### Enable or disable the Error Tracking project settings
2021-11-25 04:13:54 -05:00
The API allows you to enable or disable the Error Tracking settings for a project. Only for users with the
2022-01-30 19:14:49 -05:00
Maintainer role for the project.
2020-02-05 13:09:06 -05:00
2020-02-27 04:09:01 -05:00
```plaintext
2020-02-05 13:09:06 -05:00
PATCH /projects/:id/error_tracking/settings
```
2021-08-17 02:08:59 -04:00
| Attribute | Type | Required | Description |
| ------------ | ------- | -------- | --------------------- |
| `id` | integer | yes | The ID or [URL-encoded path of the project ](index.md#namespaced-path-encoding ) owned by the authenticated user. |
| `active` | boolean | yes | Pass `true` to enable the already configured error tracking settings or `false` to disable it. |
2021-09-08 05:09:10 -04:00
| `integrated` | boolean | no | Pass `true` to enable the integrated error tracking backend. [Available in ](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68260 ) GitLab 14.2 and later. |
2020-02-05 13:09:06 -05:00
```shell
2020-05-27 20:08:37 -04:00
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings?active=true"
2020-02-05 13:09:06 -05:00
```
Example response:
```json
{
"active": true,
"project_name": "sample sentry project",
"sentry_external_url": "https://sentry.io/myawesomeproject/project",
2021-08-17 02:08:59 -04:00
"api_url": "https://sentry.io/api/0/projects/myawesomeproject/project",
"integrated": false
2020-02-05 13:09:06 -05:00
}
```
2021-08-19 08:08:53 -04:00
## Error Tracking client keys
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68384) in GitLab 14.3.
2021-11-25 04:13:54 -05:00
For [integrated error tracking ](https://gitlab.com/gitlab-org/gitlab/-/issues/329596 ) feature. Only for users with the
2022-01-30 19:14:49 -05:00
Maintainer role for the project.
2021-08-19 08:08:53 -04:00
### List project client keys
```plaintext
GET /projects/:id/error_tracking/client_keys
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project ](index.md#namespaced-path-encoding ) owned by the authenticated user. |
```shell
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys"
```
Example response:
```json
[
{
"id": 1,
"active": true,
2021-08-23 23:10:40 -04:00
"public_key": "glet_aa77551d849c083f76d0bc545ed053a3",
"sentry_dsn": "https://glet_aa77551d849c083f76d0bc545ed053a3@gitlab.example.com/api/v4/error_tracking/collector/5"
2021-08-19 08:08:53 -04:00
},
{
"id": 3,
"active": true,
2021-08-23 23:10:40 -04:00
"public_key": "glet_0ff98b1d849c083f76d0bc545ed053a3",
"sentry_dsn": "https://glet_0ff98b1d849c083f76d0bc545ed053a3@gitlab.example.com/api/v4/error_tracking/collector/5"
2021-08-19 08:08:53 -04:00
}
]
```
### Create a client key
Creates a new client key for a project. The public key attribute is generated automatically.
```plaintext
POST /projects/:id/error_tracking/client_keys
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project ](index.md#namespaced-path-encoding ) owned by the authenticated user. |
```shell
curl --request POST --header "PRIVATE-TOKEN: < your_access_token > " --header "Content-Type: application/json" \
"https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys"
```
Example response:
```json
{
"id": 3,
"active": true,
2021-08-23 23:10:40 -04:00
"public_key": "glet_0ff98b1d849c083f76d0bc545ed053a3",
"sentry_dsn": "https://glet_0ff98b1d849c083f76d0bc545ed053a3@gitlab.example.com/api/v4/error_tracking/collector/5"
2021-08-19 08:08:53 -04:00
}
```
### Delete a client key
Removes a client key from the project.
```plaintext
DELETE /projects/:id/error_tracking/client_keys/:key_id
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project ](index.md#namespaced-path-encoding ) owned by the authenticated user. |
| `key_id` | integer | yes | The ID of the client key. |
```shell
curl --request DELETE --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys/13"
```