Bugs API for Low Code Automation
File a bug in Jira or Azure DevOps from a failed Low Code Automation test run.
Use this endpoint to create a ticket in a connected bug tracker and link it to a failed test run. Connect the bug tracker before your first call. For the setup steps, see Jira or Azure DevOps.
For authentication and the base URL, see the Low Code Automation Reference API overview.
Create a bug
Creates a ticket in a connected bug tracker and links it to a test run. This endpoint requires the Update builds role permission.
Request parameters
In the curl request, replace YOUR_USERNAME and YOUR_ACCESS_KEY with your accountβs username and access key.
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://lcnc-api.browserstack.com/api/v1/public/projects/40906/builds/9a1c77e2b4d0f38561ce0a7f4b21d9903cf8e142/test-runs/f3b90a1157dc4e2b8a06d5391cf7e4488b0a2d67/bugs" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: build-9a1c77e2-run-f3b90a11" \
-d '{
"bug": {
"integration_key": "jira",
"project_id": "CHECKOUT",
"ticket_type_id": "10001",
"summary": "Login button not clickable on checkout",
"description": "Step 4 failed on the checkout flow",
"custom": {
"priority": "High"
}
}
}'
-
project_id* string
Unique identifier of the project. Use either the integer Project Key, for example
22530, or the Project ID, for examplePR-1. To find both, open your project, click Settings, then General, and look under Project details. -
build_id* string
Unique identifier of the build. To get it, open the build, click View metadata, then copy the Build ID.
-
test_run_id* string
Unique identifier of the test run to attach the ticket to. To get it, call the Get build details endpoint and copy the
idof the run from thetest_runsarray in the response. -
Idempotency-Key string
Client-generated identifier for this create request, valid for 24 hours. Retrying with the same key and the same request body returns the original ticket instead of creating a second one, and the response carries an
Idempotent-Replayedheader. A different key creates a new ticket. The key is bound to its original request body, so reusing it with a different body returns a400response. -
bug* Object
βΆ SHOW VALUESDetails of the ticket to create in the bug tracker.
-
integration_key* string
Bug tracker to file the ticket in. The possible values are
jiraandazure. -
project_id* string
Project or repository in the bug tracker that the ticket belongs to.
-
ticket_type_id* string
Issue type to create in the bug tracker.
-
summary* string
Title of the ticket.
-
description string
Body of the ticket.
-
assignee string
Bug tracker user to assign the ticket to.
-
custom Object
Custom fields specific to your bug tracker. The tracker validates these strictly and returns a
422response listing each field it rejects.
-
Response attributes 201 application/json
Response
{
"bug": {
"id": "CHECKOUT-42",
"url": "https://your-org.atlassian.net/browse/CHECKOUT-42"
},
"linked": true
}
-
bug Object
βΆ SHOW VALUESThe ticket created in your bug tracker.
-
id String
Key of the ticket created in your bug tracker, for example
CHECKOUT-42. -
url String
Link to the ticket.
-
-
linked Boolean
Whether the ticket was linked to the test run.
Avoid duplicate tickets on retry
Send an Idempotency-Key header so that a retried request doesnβt file the same bug twice.
Within 24 hours, a retry with the same key and the same request body returns the original ticket instead of creating a second one. The response carries an Idempotent-Replayed header set to true. A different key creates a new ticket.
The key is scoped to a single bug tracker, so sending the same key first to Jira and then to Azure DevOps creates one ticket in each.
Note: Reuse an idempotency key only across retries of the same request. Reusing a key with a different request body returns a
400response, because the key stays bound to the parameters it was first sent with.
Status codes
The following table lists the responses this endpoint returns:
| Code | Meaning | Cause |
|---|---|---|
201 |
Created | The ticket was created and linked to the test run. |
400 |
Bad request | A field is missing or malformed, the bug tracker is unknown, or an Idempotency-Key was reused with a different request body. |
401 |
Unauthorized | The credentials are invalid, or the bug tracker isnβt connected. |
403 |
Forbidden | Your plan doesnβt include this bug tracker, or your role doesnβt have the Update builds permission. Check error.code: forbidden_plan for the plan, forbidden_rbac for the role. |
404 |
Not found | The build or test run doesnβt exist, or it belongs to another group. |
409 |
Conflict | A bug creation with this Idempotency-Key is already in progress. Retry with the same key after the first request completes. |
422 |
Unprocessable | Your bug tracker rejected the ticket fields. |
503 |
Service unavailable | The integration service is unavailable. |
Note: A
401response doesnβt always mean your credentials are wrong. A disconnected bug tracker returns401with the codeintegration_not_connected, anderror.detailscarriessetup_completedset tofalsealong with aredirect_uriyou can use to connect the integration. Checkerror.codebefore you rotate your access key.
A 422 response carries the per-field errors from your bug tracker in error.details, so you can correct the request. For example, a required Jira custom field that is left unset returns 422.
Related topics
- Low Code Automation Reference API overview
- Builds and reports API
- Integrate with Jira
- Integrate with Azure DevOps
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.