Home API How to update or clear the testing reports filter via API

How to update or clear the testing reports filter via API

Last updated on Apr 28, 2026

The PUT /api/v1/tests/reports/filter endpoint updates or clears the saved testing reports filter. The request body can include active, a date range, groupByName, testIds, departments and jobTitles; if {} or a body with only null values or empty collections is sent, the server clears the filter. Access requires a Bearer token with the tests.write scope.

Which endpoint is used?

Use PUT /api/v1/tests/reports/filter. The endpoint changes the saved testing reports filter for the user context from the Bearer token.

Parameter Value
Method PUT
Endpoint /api/v1/tests/reports/filter
Base URL [https://smartway.pro](https://smartway.pro)
Auth Bearer token
Content-Type application/json

What is this API endpoint used for?

This endpoint is used to manage the filter applied to testing report search and export. It is used before retrieving a report list or creating an Excel export.

What prerequisites are required before sending the request?

  • A Bearer token is required.

  • The token must include the tests.write scope.

Prerequisite Description Required
access_token Bearer token Yes
tests.write Scope for updating the saved filter Yes

Which parameters must be sent in the request?

Headers

Header Type Required Description
Authorization string Yes Bearer token in the Bearer <access_token> format
Accept string Yes application/json
Content-Type string Yes application/json

Path parameters

Path parameters are absent.

Query parameters

Query parameters are absent.

Request body

Parameter Type Required Description
active boolean No Filter by report activity
startDate string (date) No Date range start
endDate string (date) No Date range end
groupByName boolean No Group multiple test attempts into one row with the maximum result and specified attempt count
testIds int64[] No Set of test IDs for the filter
departments string[] No Set of departments for the filter
jobTitles string[] No Set of job titles for the filter

curl example

Example request to update the filter:

curl -X PUT 'https://smartway.pro/api/v1/tests/reports/filter' \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "active": true,
    "startDate": "2026-03-01",
    "endDate": "2026-03-10",
    "groupByName": true,
    "testIds": [5, 200001],
    "departments": ["Sales"],
    "jobTitles": ["Manager"]
  }'

Example request to clear the filter:

curl -X PUT 'https://smartway.pro/api/v1/tests/reports/filter' \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{}'

What response does the API return?

A successful request returns 200 OK and a PublicTestReportFilterResponse object with the current filter state.

{
  "active": true,
  "startDate": "2026-03-01",
  "endDate": "2026-03-10",
  "groupByName": true,
  "testIds": [5, 200001],
  "departments": ["Sales"],
  "jobTitles": ["Manager"]
}

What do the API response fields mean?

Field Type Description
active boolean Filter by report activity
startDate string Date range start
endDate string Date range end
groupByName boolean Grouping of multiple test attempts
testIds array Set of test IDs for the filter
departments array Set of departments for the filter
jobTitles array Set of job titles for the filter

What happens under the hood?

  • The filter is bound to userKey, which is taken from the Bearer token subject.

  • For a company API key, userKey has the format company-api-key:{companyId}.

  • Filter updates are not bound to a specific active key ID.

  • The external client does not send idUser.

  • If an empty object {} or a body with only null values or empty collections is sent, the server clears the filter.

  • If endDate < startDate, the API returns 400 Bad Request.

  • Access requires the tests.write scope.

Which edge cases should be considered?

Scenario API behaviour Integrator action
Empty body {} The server clears the filter Send {} when the filter must be reset
Body with only null values or empty collections The server clears the filter Use it to clear the filter
endDate < startDate API returns 400 Bad Request Validate the date range before sending the request
Company API key rotation The update is not bound to a specific active key ID Do not create a dependency on the active key ID

Which errors can the API return?

HTTP status Description
400 Bad Request Invalid date range or other invalid filter values
401 Unauthorized Missing or invalid Bearer token
403 Forbidden Insufficient permissions
500 Internal Server Error Unexpected error
503 Service Unavailable Service failure

How to use the result in subsequent API requests?

After the filter is updated or cleared, subsequent testing report search and export requests are executed with the current filter applied.

Example report search after updating the filter:

curl -X POST 'https://smartway.pro/api/v1/tests/reports/search' \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Accept: application/json'

Which mistakes should integrators avoid?

  • Sending idUser in the request body or query string.

  • Sending endDate earlier than startDate.

  • Expecting the filter to be bound to a specific active key ID.

  • Forgetting that an empty {} clears the filter.

  • Calling the endpoint without the tests.write scope.

FAQ

How do I clear the filter?

Send an empty JSON object {} or a body with only null values or empty collections.

What happens if endDate < startDate?

The API returns 400 Bad Request.

Do I need to send idUser?

No. The external client does not send idUser.

Which scope is required?

The tests.write scope is required.

What is the filter bound to?

The filter is bound to userKey, which is taken from the Bearer token subject.