Back to Gitlabhq

Error Tracking API

doc/api/error_tracking.md

18.11.26.3 KB
Original Source

{{< details >}}

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

{{< /details >}}

Use this API to interact with the Error Tracking feature for projects. For more information, see Error Tracking.

Prerequisites:

  • You must have the Maintainer or Owner role.

Retrieve Error Tracking settings

Retrieves the Error Tracking settings for a specified project.

plaintext
GET /projects/:id/error_tracking/settings
AttributeTypeRequiredDescription
idintegeryesThe ID or URL-encoded path of the project
shell
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings"

Example response:

json
{
  "active": true,
  "project_name": "sample sentry project",
  "sentry_external_url": "https://sentry.io/myawesomeproject/project",
  "api_url": "https://sentry.io/api/0/projects/myawesomeproject/project",
  "integrated": false
}

Create Error Tracking settings

{{< history >}}

{{< /history >}}

Creates Error Tracking settings for a specified project.

[!note] This API is only available when used with integrated error tracking.

plaintext
PUT /projects/:id/error_tracking/settings

Supported attributes:

AttributeTypeRequiredDescription
idintegeryesThe ID or URL-encoded path of the project.
activebooleanyesPass true to enable the error tracking setting configuration or false to disable it.
integratedbooleanyesPass true to enable the integrated error tracking backend.

Example request:

shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings?active=true&integrated=true"

Example response:

json
{
  "active": true,
  "project_name": null,
  "sentry_external_url": null,
  "api_url": null,
  "integrated": true
}

Update Error Tracking project settings

Updates Error Tracking settings for a specified project.

plaintext
PATCH /projects/:id/error_tracking/settings
AttributeTypeRequiredDescription
idintegeryesThe ID or URL-encoded path of the project.
activebooleanyesPass true to enable the already configured error tracking settings or false to disable it.
integratedbooleannoPass true to enable the integrated error tracking backend.
shell
curl --request PATCH --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings?active=true"

Example response:

json
{
  "active": true,
  "project_name": "sample sentry project",
  "sentry_external_url": "https://sentry.io/myawesomeproject/project",
  "api_url": "https://sentry.io/api/0/projects/myawesomeproject/project",
  "integrated": false
}

List all project client keys

Lists all integrated error tracking client keys for a specified project.

plaintext
GET /projects/:id/error_tracking/client_keys
AttributeTypeRequiredDescription
idinteger or stringyesThe ID or URL-encoded path of the project.
shell
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys"

Example response:

json
[
  {
    "id": 1,
    "active": true,
    "public_key": "glet_aa77551d849c083f76d0bc545ed053a3",
    "sentry_dsn": "https://[email protected]/errortracking/api/v1/projects/5"
  },
  {
    "id": 3,
    "active": true,
    "public_key": "glet_0ff98b1d849c083f76d0bc545ed053a3",
    "sentry_dsn": "https://[email protected]/errortracking/api/v1/projects/5"
  }
]

Create a client key

Creates an integrated error tracking client key for a specified project. The public key attribute is generated automatically.

plaintext
POST /projects/:id/error_tracking/client_keys
AttributeTypeRequiredDescription
idinteger or stringyesThe ID or URL-encoded path of the project.
shell
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --url "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys"

Example response:

json
{
  "id": 3,
  "active": true,
  "public_key": "glet_0ff98b1d849c083f76d0bc545ed053a3",
  "sentry_dsn": "https://[email protected]/errortracking/api/v1/projects/5"
}

Delete a client key

Deletes an integrated error tracking client key from a specified project.

plaintext
DELETE /projects/:id/error_tracking/client_keys/:key_id
AttributeTypeRequiredDescription
idinteger or stringyesThe ID or URL-encoded path of the project.
key_idintegeryesThe ID of the client key.
shell
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys/13"