Using the API's "Get viewing records", you can import into internal systems (BI, HR, quality management, and so on) who viewed which SOP and when, and how they answered its questions. The contents are the same as the CSV of "Viewing records" → "Work records" for an SOP. For the basics of issuing a key and calling the API, see Search and read SOPs from internal systems and AI (API, beta).
Available on the Enterprise plan. The owner sets up the key from a PC web browser. It is provided as a beta version.
※ Before using this feature, be sure to read the "Rules to Follow and Disclaimer" in Search and read SOPs from internal systems and AI (API, beta). If you use this feature, you are considered to have agreed to them.
Allow reading viewing records with a key
Viewing records can be retrieved only with keys for which [Also allow reading viewing records] is selected. It is not selected by default.
- Open [Owner Functions] in the side menu.
- Select the [Integrations] tab at the top, and open [API (search and read SOPs)].
- For a new key, click [Issue key]. For an existing key, click the pencil icon (Edit) on its row.
- Select [Also allow reading viewing records], then click [Issue] (or [Save] when editing).
In the "Viewing records" column of the key list, it shows whether the key can read viewing records (Yes / No).
When you turn on reading viewing records for an existing key, or change the Groups to show of a key that can read viewing records, a notification email is sent to all owners of the team.
Viewing records include the viewer's name and email (for an Email-free account, the login ID), the question text and answers, and the completion comment. This information is passed on to the system that uses the key, and to the people who use that system. For keys used by systems that many people use, such as chatbots or internal portals, do not select [Also allow reading viewing records]. Issue a separate key for the system that imports the records.
Scope of records returned
- SOPs: Only records of published SOPs that can be viewed with the key (the same scope as search and read). Only viewings of a published version are returned.
- People: Only records of people who currently belong to one of the [Groups to show] of the key (including subgroups under them). A key with no groups selected returns records of all members. This is decided differently from the SOP scope, which treats a person as belonging to all of the selected groups.
- Viewings of drafts, viewings in recording mode, viewings through an External Sharing URL without logging in, and viewings as a Guest are not returned.
Because people are decided by their current membership, records from a person's previous department are not returned through keys for that previous department's group.
Get viewing records
Call GET /viewing-records with query parameters such as the period.
| Item | Description |
|---|---|
| from (required) | The start of the period (this time is included). The period is decided by the time the viewing started. Write it as a date (2026-10-01 means 0:00 in Japan time), or as a date and time with a time zone offset (2026-10-01T09:00:00+09:00, 2026-10-01T00:00:00Z, and so on). In the URL, write "+" as %2B. |
| to | The end of the period (this time is not included). Use the same format as from. If omitted, the period runs up to the time of the call. The period can be up to 366 days after from. |
| procedureId | Returns only the records of this SOP (the SOP id or versionId). Records of all versions are returned. |
| limit | The maximum number of records to return (1 to 500, default 100) |
| cursor | To get the next part, add the next.cursor from the previous response. |
curl "https://api.divedx.com/v1/viewing-records?from=2026-10-01&to=2026-11-01&limit=100" \
-H "Authorization: Bearer dapi_..."
The records are returned in order of the time the viewing started, oldest first.
{
"records": [
{
"id": "-NrAbc",
"procedure": { "id": "-NaBcD1", "versionId": "-NxYzW9", "version": 3, "title": "Furnace temperature control", "kind": "steps" },
"user": { "id": "uid…", "email": "alice@example.com", "name": "Alice" },
"startedAt": "2026-10-01T09:00:00+09:00",
"completedAt": "2026-10-01T09:05:00+09:00",
"durationSec": 300,
"status": "stumble",
"comment": "It was OK",
"answers": [
{ "step": 3, "stepId": "sC", "title": "Check", "question": "Browning color", "type": "Select", "result": "ok", "value": "Good", "aiCheck": "ng" }
]
}
],
"next": { "cursor": "…" },
"requestId": "req_…"
}
| Item | Description |
|---|---|
| id | The ID of the record. When importing, overwrite using this ID. |
| procedure | The SOP ID (same as the id in search and read), the ID and version number of the version viewed (0 is the first version), the title of the current published version, and the kind (steps means an SOP divided into steps; file means a File-based SOP). |
| user | The viewer's Dive ID, email (for an Email-free account, the login ID), and name. For people not on the team's member list, the email and name are null. |
| startedAt / completedAt | The date and time the viewing started and was completed. For a viewing that is not completed, completedAt is null. |
| durationSec | The number of seconds from start to completion (the same as "View duration" on the screen). For a viewing that is not completed, this is null. |
| status | The status of that viewing (see the table below). |
| comment | The comment written at completion. |
| answers | The answer to each question (see the table below). Questions are those of the latest published version. Answers to questions deleted in a later version are not returned. |
Status (status)
The first matching item from the top is used. This is decided in the same way as the status in Work records on the screen.
| Value | Meaning |
|---|---|
| preview | Reference (viewed with the questions skipped) |
| incomplete | Incomplete (not completed. Even if there are abnormal answers, this applies when it is not completed.) |
| abnormal | Completed with abnormal answers |
| stumble | Completed after giving a wrong answer and then a correct answer (Stumble) |
| noAnswer | Completed without answering any question |
| partial | Completed after answering some of the questions |
| ok | Completed |
Answers (answers)
| Item | Description |
|---|---|
| step / stepId | The step number and step ID in the latest published version. The step ID usually does not change even when the SOP is revised. |
| title / question / type | The step name, the question text, and the question type (Select, SelectMulti, YesNo, Input, InputNumber, and so on). |
| result | One of the following: ok (normal, passed), ng (abnormal, failed), checked (answered; a question with no correct answer), measured (a number was entered), skipped (no answer in this viewing record; not reached, skipped, or not in the viewed version). |
| value | The answer in the same form as on the screen: the chosen option (multiple choices are joined with ", "), Yes / No, or the text or number entered. If a question with a correct answer was passed, this is the correct value. |
| aiCheck | The result of the AI photo check (for reference). One of: ok (matches), ng (needs to be checked), unknown (cannot be judged). For questions without an AI check, this is null. Photos are not returned. |
Status and answer values may increase in the future. Please build your system so that it skips any value it does not recognize.
Get the next records and continue importing
- If next is not null, there are more records. Add next.cursor as cursor and call again with the same from, to, and procedureId (different values return a 400). If to was omitted, the next records also run up to the time of the first call.
- Even if fewer records than limit are returned, or none at all, there are more records if next is present.
- Records may be completed later, or answers may be added later. If the start is within the period, the content may change after it is retrieved.
- The time the viewing started is the clock of the device used for viewing. A record viewed offline and sent later may fall into an earlier period after it is retrieved.
When importing continuously, retrieve the last few days again once a day (overlapping), and overwrite by the record id. If you retrieve a long period again at short intervals, you will hit the request limit below.
Request limits
- Retrieving viewing records is limited to 30 times per minute and about 1,000 times per day (Japan time) per key. These also count toward the limit for search and read.
- If the limit is exceeded, 429 is returned. Wait for the number of seconds in the Retry-After header, then call again.
When an error occurs
| Status | code | Main causes and what to do |
|---|---|---|
| 400 | invalid_request | Possible causes: from is missing, the date or time format is wrong, the period is longer than 366 days, or cursor does not match from, to, or procedureId. Check what you are sending. |
| 403 | insufficient_scope | The key does not have [Also allow reading viewing records] selected. Check the key's settings. |
| 404 | not_found | The SOP for procedureId does not exist, is outside the key's scope, or exists only as a draft. |
| 429 | rate_limited | The request limit has been exceeded. Wait for the number of seconds in Retry-After. |
| 503 | unavailable | Temporarily unable to process the request. Wait a while, then call again. |
Other errors (key, expiry, plan, and source IP address) are the same as for search and read (see "When an error occurs" in Search and read SOPs from internal systems and AI (API, beta)).
Differences from the CSV exported from the screen
- Viewings of File-based SOPs and viewings with no answer fields are also returned. For File-based SOPs, answers is empty and procedure.kind is file.
- Status and answers are returned as symbols (see the tables above), not as words.
- For the AI photo check, only the result symbol is returned. The text of the findings and the photos are not returned.
- Long text is cut off partway and "…" is added at the end (answer values and completion comments up to 2,000 characters, questions up to 1,000 characters, titles up to 300 characters, names up to 200 characters, and emails up to 320 characters). Up to 300 answers are returned per viewing.
Check usage (for owners)
In the [Usage] area of the [API (search and read SOPs)] card, the number of viewing record retrievals for each key is shown (as "Viewing records N times"). Changes to a key (turning reading viewing records on or off) are recorded in the Audit log.
Frequently asked questions
Q. The number of viewing records on the screen does not match.
A. The API also returns viewings of File-based SOPs and viewings with no answer fields. It also narrows people by their current membership in the key's Groups to show. For this reason, the count may differ from the number of "Work records" on the screen.
Q. Do viewings made by searching and reading SOPs through the API count as viewing records?
A. No. Viewing records include only viewings of SOPs on the Dive screen, the app, or smart glasses.
Q. Can I retrieve records older than one year?
A. The period of a single call can be up to 366 days. For earlier periods, change from and to and call again. Note that some records in older formats are not returned.
Related
Search and read SOPs from internal systems and AI (API, beta)
Check viewing records by SOP (viewers, Work records, Stumble map)