> For the complete documentation index, see [llms.txt](https://docs.bugsplat.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bugsplat.com/api-reference/api/defect.md).

# Defect

API Documentation for the BugSplat Defect Endpoint

Operations related to BugSplat's connection with the defect tracker configured on the specified database.

## Get Defect

<mark style="color:blue;">`GET`</mark> `https://app.bugsplat.com/api/logDefect`

Returns information regarding linked defects for a given crash (using id) or crash group (using stackKeyId).

#### Query Parameters

| Name       | Type   | Description                |
| ---------- | ------ | -------------------------- |
| database   | string | BugSplat database to query |
| stackKeyId | number | Crash group to query       |
| id         | number | Crash Id to query          |

{% tabs %}
{% tab title="200 " %}

```json
{
    "status": "success",
    "current_server_time": 1629833567,
    "message": "success",
    "id": 1,
    "defectId": 1
}
```

{% endtab %}
{% endtabs %}

## Create Defect

<mark style="color:green;">`POST`</mark> `https://app.bugsplat.com/api/logDefect`

Create an issue in the associated defect tracker

#### Request Body

| Name         | Type   | Description                                                             |
| ------------ | ------ | ----------------------------------------------------------------------- |
| stackKeyId   | number | Id of the crash group being used to create a new issue                  |
| id           | number | Id of the crash being used to create a new issue                        |
| database     | string | BugSplat database containing the crashId or stackKeyId                  |
| notes        | string | Optional note attached to the new defect                                |
| linkDefectId | string | Optional id of an existing defect to link instead of creating a new one |

{% tabs %}
{% tab title="200 " %}

```json
{
    "status": "success",
    "current_server_time": 1629834214,
    "message": "success",
    "id": 1,
    "defectId": 1
}
```

{% endtab %}
{% endtabs %}

## Remove Defect

<mark style="color:red;">`DELETE`</mark> `https://app.bugsplat.com/api/logDefect`

Removes a defect association from BugSplat. This method will not remove the issue from the associated issue tracker.

#### Query Parameters

| Name       | Type   | Description                                                  |
| ---------- | ------ | ------------------------------------------------------------ |
| stackKeyId | string | Crash group for which the defect association will be removed |
| id         | number | Crash id for which the defect association will be removed    |
| database   | string | BugSplat database containing the crashId or stackKeyId       |

{% tabs %}
{% tab title="200 " %}

```json
{
    "status": "success",
    "current_server_time": 1629834172,
    "message": "success",
    "id": 1
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bugsplat.com/api-reference/api/defect.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
