Build
You can organize your test sessions on BrowserStack into builds. You can use this REST API to access the list of builds, update a specific build name, delete a build, and delete multiple builds at the same time.
Note: If you did not use the
build
capability in your tests, then your sessions would be put in an Untitled Build.
It is recommended that you organize your tests into builds and give them relevant names for you to be able to debug them properly using the Automate Dashboard
Get build list
Fetch the 10 recent test builds that have run on BrowserStack using your username and access key. You can also limit the number of builds and paginate through your data.
Request Parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
https://api.browserstack.com/automate/builds.json
# Limit the number of builds to be displayed using "limit" parameter
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
"https://api.browserstack.com/automate/builds.json?limit=5"
# Start the retrieval of records from a particular point using "offset" parameter
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
"https://api.browserstack.com/automate/builds.json?limit=2\&offset=2"
# View a subset of results using "status" parameter
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
"https://api.browserstack.com/automate/builds.json?status=running"
# View specific builds results using "projectId" parameter
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
"https://api.browserstack.com/automate/builds.json?projectId=1234"
-
limit String
Specify the number of results to be displayed. The default value is 10, and the maximum value is 100.
-
offset String
Retrieve builds from a specific point using the
offset
parameter. -
status String
The
status
parameter filters your results by the status of the build. The values accepted by this parameter arerunning
,done
,timeout
, andfailed
. -
projectId Integer
Retrieve all builds related to the specified project ID.
Response Attributes 200 OK
Array
Response
[
{
"automation_build":{
"name":"pricing_build",
"hashed_id":"ca9cccc228cf0e3ff3cb90dd62e2e2bfb4b20bc7",
"duration":15611,
"status":"running",
"build_tag":null,
"public_url":"https://automate.browserstack.com/dashboard/v2/public-build/MkdsKzRhanlWQmtpc"
}
},
{
"automation_build":{
"name":"navigation_build",
"hashed_id":"3b20f82b878c120e6edc7a2b373e65d20fb3ab7c",
"duration":15601,
"status":"running",
"build_tag":null,
"public_url":"https://automate.browserstack.com/dashboard/v2/public-build/LMNjdfsdfhbHBH"
}
},
{...}
]
-
name String
Name of your build.
-
hashed_id String
ID of the build. (This
hashed_id
would be required for invoking the other endpoints in the Build API) -
duration Integer
Duration of build execution.
-
status String
Status of the build (Either
running
,done
,timeout
, orfailed
). -
public_url String
Public URL of your build.
Update build details
You can update the name of your build after the build is complete using the PUT
method.
Request Parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X PUT -H "Content-Type: application/json" \
-d "{\"name\":\"<build-name>\"}" https://api.browserstack.com/automate/builds/<build-id>.json
-
id* String
ID of the build.
-
name* String
The new build name that you want to set.
Accepted characters areA-Z
,a-z
,0-9
,.
,:
,-
,[]
,/
,@
,&
,'
,_
.
Character limit is 255.
Response Attributes 200 OK
JSON
Response
{
"name":"pricing_updated_build",
"duration":20,
"status":"done",
"hashed_id":"ede5ec7d6f24799707aa13860c0856dc4718d927",
"build_tag":null
}
-
name String
Updated name of your build.
-
duration Integer
Duration of build execution.
-
status String
Status of the build.
-
hashed_id String
ID of the build as passed in the request.
Delete build
You can delete a build on the server using the DELETE
method. Please note that deleting a build will delete all the sessions contained within it. Builds once deleted cannot be recovered.
Request Parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X DELETE https://api.browserstack.com/automate/builds/<build-id>.json
-
id* String
ID of the build.
Response Attributes 200 OK
JSON
Response
{
"status":"ok",
"message":"Build a4fb480a55efd6b3c558afb1ee051a7c337b8ef0 was deleted successfully."
}
-
status String
Status of deletion.
-
message String
Build deletion message.
Delete multiple builds
You can delete multiple builds on the server using the DELETE
method. You can delete a maximum of 5 builds at a time. Builds once deleted cannot be recovered.
Request Parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X DELETE "https://api.browserstack.com/automate/builds?buildId=<build-id-1>\&buildId=<build-id-2>\&buildId=<build-id-3>"
-
id* String
IDs of the builds to be deleted.
Response Attributes 200 OK
JSON
Response
{
"message":"The following build(s) were deleted successfully: 83078c39baf5c12cbbfcbd26a788d05ddfad626c,55e9782d749f601d09571023f56a8f0101929428."
}
-
message String
Builds deletion message.
Post terminal logs
Upload terminal logs for your build using the POST
method.
Request Parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-L -X POST 'https://api-cloud.browserstack.com/automate/builds/<build_id>/terminallogs' \
-F 'file=@"/path/file.log"'
-
build_id* String
ID of the test build available on the Automate dashboard.
-
file* Path
Path to the terminal log file on your machine. The max allowed file size is
2MB
.
Response Attributes 200 OK
JSON
Response
{
"status":"success",
"message":"File has been uploaded successfully!"
}
-
status String
Status of terminal log upload.
-
message String
Terminal log upload message.
Update build tags
You can update the build tags after the build completes using the PUT
method.
Request Parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X PUT -H "Content-Type: application/json" \
-d "{\"build_tag\":\"<your-build-tag>\"}" https://api.browserstack.com/automate/builds/<build-id>.json
-
id* String
ID of the build.
-
build_tag* String
The new build tag that you want to set.
Response Attributes 200 OK
JSON
Response
{
"name":"Selenium logs enabled",
"duration":141,
"status":"done",
"hashed_id":"e8cde62c7e261edb013e82ac0096a650b4694b84",
"build_tag":"reg"
}
-
name String
Name of your build.
-
duration Integer
Duration of build execution.
-
status String
Status of the build.
-
hashed_id String
ID of the build as passed in the request.
-
build_tag String
Updated tag of your build.
Note: You can add, edit, or delete the build tags using this API endpoint. To delete a build tag, simply pass an empty string. If you pass an empty string, the tagging will be removed.
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.