Datasets API
Use the Low Code Automation Datasets API to read the values that your tests saved to a writable test dataset.
When your tests save values to a writable test dataset, you can read those values from your own scripts or CI/CD pipelines. For example, you can clean up test records or pass generated IDs to another system. In the API, a writable test dataset is called an output dataset and has the output dataset type.
All endpoints on this page use the base URL https://lcnc-api.browserstack.com/api/v1/public and HTTP Basic authentication with your BrowserStack username and access key. Your plan must include test data management, and your role must have the View data configuration permission.
Read saved values
To read the values that your tests saved:
- Find the ID of your project using the List projects endpoint. You can use either the
project_id, for examplePR-1, or theproject_key, for example22530. - Find the ID of the dataset using the List output datasets endpoint. You can also copy the ID from Metadata > Test dataset ID on the dataset page.
- Optionally, check the details of the dataset, such as the row count, using the Get a dataset endpoint.
- Read the rows using the List dataset rows endpoint. While
has_moreistruein the response, call the endpoint again withafterset to thenext_cursorvalue.
To fetch only the rows that were added since your last read, save the last next_cursor value and pass it as after in your next request. Row IDs are never reused, even after the dataset is cleared, so the response contains only new rows. The rowNumber value restarts at 1 after the dataset is cleared, so use id to track rows.
A build that writes to the dataset might still be running when you read it. In that case, all_writers_finished is false, and more rows might still arrive. Wait until all_writers_finished is true before you treat the data as complete.
In each row, columns that the step didnβt fill are returned as empty strings (""). For example, if a dataset has three columns and a step saves one value, the row contains one value and two empty strings. This is expected and doesnβt indicate data loss.
List output datasets
Fetches the writable test datasets in a project. This is the List datasets endpoint with the type parameter set to output.
Request parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X GET "https://lcnc-api.browserstack.com/api/v1/public/projects/PR-1/datasets?type=output" \
-H "accept: application/json"
-
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. -
name string
Return only datasets whose name matches this value.
-
type string
Return only datasets of this type. Use
inputfor datasets that provide data to tests, oroutputfor datasets that tests write to. Any other value returns a400response. -
page integer
Page to fetch. Pages are 1-based. The default is
1. -
per_page integer
Number of records per page. The default is
50and the maximum is100.
Response attributes 200 application/json
Response
{
"datasets": [
{
"id": "728553e52f04f0c58bdec6b95df790f4b89c20a7",
"name": "Order IDs",
"description": "",
"file_name": "Order IDs.csv",
"column_names": ["Order IDs", "Products"],
"column_count": 2,
"row_count": 1,
"dataset_type": "output",
"clearing_behaviour": "reset_per_build",
"row_ceiling": 100,
"used_in_tests_count": 2,
"used_in_modules_count": 0,
"tests": [
{ "id": "437e9ce4328fa7e24b711fee15daee97bd038dfd", "name": "Checkout flow" },
{ "id": "6f88cd9e874a2a50e1300ff71c28ed1d9212461f", "name": "Untitled test" }
],
"modules": []
}
],
"paging": { "page": 1, "per_page": 50, "total": 1, "total_pages": 1, "best_effort": true }
}
-
datasets Array[Object]
βΆ SHOW VALUESDatasets that match the request.
-
id String
Unique identifier of the dataset.
-
name String
Name of the dataset.
-
description String
Description of the dataset. Empty string (
"") when not set. -
file_name String
Name of the uploaded file.
-
column_names Array[String]
Column names in the dataset.
-
column_count Integer
Number of columns.
-
row_count Integer
Number of rows.
-
used_in_tests_count Integer
Number of tests that use the dataset.
-
used_in_modules_count Integer
Number of modules that use the dataset.
-
tests Array[Object]
βΆ SHOW VALUESTests that use the dataset.
-
id String
Unique identifier.
-
name String
Display name.
-
-
modules Array[Object]
βΆ SHOW VALUESModules that use the dataset.
-
id String
Unique identifier.
-
name String
Display name.
-
-
dataset_type String
Type of the dataset.
inputfor datasets that provide data to tests, andoutputfor datasets that tests write to. -
clearing_behaviour String
Data clearance schedule of the dataset. Possible values are
accumulate(Never, the default),reset_per_build(Before every cloud run (Builds)), andscheduled(Custom). Returned asnullfor input datasets. -
row_ceiling Integer
Maximum number of rows that a writable dataset can hold. Returned for every dataset, but applies only to writable datasets. The default is
100.
-
-
paging Object
βΆ SHOW VALUESPagination details of the response.
-
page Integer
Page returned. Pages are 1-based.
-
per_page Integer
Number of records per page.
-
total Integer
Total number of records that match the request. When
best_effortistrue, this is an upper bound. -
total_pages Integer
Total number of pages. When
best_effortistrue, this is an upper bound. -
best_effort Boolean
Returned as
truewhentotalandtotal_pagesare upper bounds rather than exact counts. When you see it, page through the results until you receive an empty list instead of relying ontotal_pages. Absent when the counts are exact.
-
Response 400 application/json
The value of type isnβt input or output.
Response
{
"error": {
"code": "invalid_request",
"message": "string"
}
}
Get a dataset
Fetches the details of an output dataset, such as its columns, row count, and whether a build is still writing to it.
Request parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X GET "https://lcnc-api.browserstack.com/api/v1/public/projects/PR-1/datasets/YOUR_DATASET_ID" \
-H "accept: application/json"
-
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. -
dataset_id* string
Unique identifier of the dataset. Use the
idreturned by the List output datasets endpoint.
Response attributes 200 application/json
Response
{
"dataset": {
"id": "728553e52f04f0c58bdec6b95df790f4b89c20a7",
"name": "Order IDs",
"description": "",
"dataset_type": "output",
"clearing_behaviour": "reset_per_build",
"columns": ["Order IDs", "Products"],
"row_count": 1,
"row_ceiling": 100,
"all_writers_finished": true
}
}
-
dataset Object
βΆ SHOW VALUESDetails of the dataset.
-
id String
Unique identifier of the dataset.
-
name String
Name of the dataset.
-
description String
Description of the dataset. Empty string (
"") when not set. -
dataset_type String
Type of the dataset. Always
outputfor this endpoint. -
clearing_behaviour String
Data clearance schedule of the dataset. Possible values are
accumulate(Never, the default),reset_per_build(Before every cloud run (Builds)), andscheduled(Custom). -
columns Array[String]
Column names in the dataset.
-
row_count Integer
Number of rows in the dataset.
-
row_ceiling Integer
Maximum number of rows that the dataset can hold. The default is
100. -
all_writers_finished Boolean
Returned as
falsewhile a build that writes to the dataset is still running, which means more rows might still arrive. Returned astruewhen no such build is running.
-
Response 401 application/json
The username or access key is missing or invalid.
Response
{
"error": {
"code": "unauthenticated",
"message": "string"
}
}
Response 403 application/json
Your plan doesnβt include test data management (forbidden_plan), or your role doesnβt have the View data configuration permission (forbidden_rbac).
Response
{
"error": {
"code": "forbidden_rbac",
"message": "string"
}
}
Response 404 application/json
The project or dataset doesnβt exist, the dataset isnβt an output dataset, or the dataset belongs to another project or group.
Response
{
"error": {
"code": "not_found",
"message": "string"
}
}
Response 503 application/json
An upstream dependency is temporarily unavailable. Retry the request.
Response
{
"error": {
"code": "dependency_unavailable",
"message": "string"
}
}
List dataset rows
Fetches the rows that your tests saved to an output dataset, oldest first.
Request parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X GET "https://lcnc-api.browserstack.com/api/v1/public/projects/PR-1/datasets/YOUR_DATASET_ID/rows?limit=100" \
-H "accept: application/json"
-
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. -
dataset_id* string
Unique identifier of the dataset. Use the
idreturned by the List output datasets endpoint. -
limit integer
Number of rows to return. The default is
50and the maximum is100. Values above100are capped at100. Values below1or non-numeric values fall back to50. -
after string
Row cursor to start after. Pass the
next_cursorvalue from the previous response to fetch the next set of rows.
Response attributes 200 application/json
Response
{
"rows": [
{
"id": "132444",
"rowNumber": 1,
"data": {
"Order IDs": "ORD-10234",
"Products": "Wireless mouse"
}
}
],
"meta": {
"limit": 100,
"next_cursor": "132444",
"has_more": false,
"all_writers_finished": true
}
}
-
rows Array[Object]
βΆ SHOW VALUESRows in the dataset, oldest first.
-
id String
Unique identifier of the row. Row IDs are never reused, even after the dataset is cleared.
-
rowNumber Integer
Position of the row in the dataset. Restarts at
1after the dataset is cleared. To track rows, useidinstead. -
data Object
Values in the row, as key-value pairs of column name and saved value. Columns that the step didnβt fill are returned as empty strings (
"").
-
-
meta Object
βΆ SHOW VALUESPagination and completion details of the response.
-
limit Integer
Maximum number of rows in the response.
-
next_cursor String
Cursor for the next request. Pass it as the
afterparameter to fetch the rows that follow. -
has_more Boolean
Returned as
truewhen more rows are available after this response. -
all_writers_finished Boolean
Returned as
falsewhile a build that writes to the dataset is still running, which means more rows might still arrive. Returned astruewhen no such build is running.
-
Response 400 application/json
The value of after isnβt a valid row cursor.
Response
{
"error": {
"code": "invalid_request",
"message": "string"
}
}
Response 401 application/json
The username or access key is missing or invalid.
Response
{
"error": {
"code": "unauthenticated",
"message": "string"
}
}
Response 403 application/json
Your plan doesnβt include test data management (forbidden_plan), or your role doesnβt have the View data configuration permission (forbidden_rbac).
Response
{
"error": {
"code": "forbidden_plan",
"message": "string"
}
}
Response 404 application/json
The project or dataset doesnβt exist, the dataset isnβt an output dataset, or the dataset belongs to another project or group.
Response
{
"error": {
"code": "not_found",
"message": "string"
}
}
Response 503 application/json
An upstream dependency is temporarily unavailable. Retry the request.
Response
{
"error": {
"code": "dependency_unavailable",
"message": "string"
}
}
Related topics
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.