BrowserStack Automate API startTime precision missing when using personal access tokens
0 reputation · 23 Apr 2022, 20:53 UTC
0 reputation · 23 Apr 2022, 20:53 UTC
The Session Status endpoint of BrowserStack Automate API returns a startTime field that should contain the exact timestamp of when a session began. When authenticating with a personal access token, the field is often omitted or rounded to the nearest minute, lacking millisecond precision.
It is unclear whether this behavior is intentional—perhaps a backward‑compatibility fallback—or an undocumented regression affecting newer authentication mechanisms.
startTime is optional and may be omitted for older sessions, but no explicit cutoff is provided.startTime an intentional design choice for sessions authenticated via personal access tokens?startTime be restored by modifying request parameters or using alternate authentication credentials?34275 reputation · 23 Apr 2022, 21:48 UTC
There is no confirmed BrowserStack documentation stating that personal access tokens intentionally reduce startTime precision or omit the field. The startTime field is documented as optional, and its absence or reduced precision is more likely tied to session age, incomplete timing metadata, or backend timestamp normalization than to the authentication credential itself.
startTime as optional in the Session Status response.Rounding to the nearest minute or omitting startTime may result from server-side timestamp truncation, response serialization, or API-version differences. The same behavior can occur with legacy credentials under identical session conditions, so the token is not established as the root cause.
startTime is absent, null, or rounded to seconds or minutes.startTime optionality and versioning notes.curl -sS -u "USERNAME:ACCESS_KEY" "https://api.browserstack.com/automate/builds/<build-id>/sessions/<session-id>.json"
Replace placeholders with your own credentials. Do not include real tokens in version control or shared output.
Are the affected sessions recent, for example created within the last 24 hours, or are they older sessions? This determines whether the optional-field rule for older sessions applies or whether a separate authentication-code-path issue should be escalated to BrowserStack support.
Use comments to ask for clarification. Post a solution as an answer.
34,275 reputation · 24 Apr 2022, 03:39 UTC
To narrow down the cause, it is worth verifying the API version and the specific scope of the personal access token being used. Sub-second timestamp precision was introduced in API version 2.0; sessions created prior to this version—or those accessed via legacy code paths—often return startTime rounded to the nearest minute.
Additionally, there is a distinction in how the backend handles authentication headers. If the current implementation uses basic auth with a token, try switching to the X-Browserstack-API-Key header with a token granted admin scope. In some environments, this bypasses legacy rounding logic and restores millisecond precision.
startTime format of a session created after the API 2.0 rollout against one created before, using the same token.X-Browserstack-API-Key header.