Guide · Control Tower for Claude

Count Claude use by department from your own records

DuckDB2026-11-05Script ran before publishing, PDF by email

The short answer

You can count how much each department uses Claude from two files you already hold: the Claude Enterprise analytics export and your HR file, joined on work email. The result shows people, active users, messages, conversations and sessions per department and product. The records in our runs are generated: an invented company and invented people.

What you will have at the end

One Python file, claude_use_by_department.py, joins the Claude Enterprise analytics export to your HR file on the email address, checks its own result and writes three CSV files: claude_use_by_department.csv, claude_use_by_product.csv and claude_unmapped_users.csv. It needs only the duckdb Python module (DuckDB: Python client (read 2026-11-05) installs it with pip install duckdb). It has no API key and no network code: it reads files you saved.

The export names each person by email address. Only your HR file knows which department each person belongs to, and public data about Claude use describes people in general, not the departments of your company. The script puts the two together, and anyone it cannot place goes to a department called Unmapped instead of disappearing. The CSV files linked here come from our generated records, so they show the shape of your result and nothing about any real company.

Get the full guide (PDF) for the same steps with the complete code, both runs in full and a checklist.

What you need

The usage export, one saved answer per day

The Claude Enterprise Analytics API has a users endpoint, GET /v1/organizations/analytics/users, that returns each user's activity for the day you give in its date parameter (Anthropic: List User Activity (read 2026-11-05)). Only Claude Enterprise organizations have it. The Primary Owner turns on API access and creates an analytics key with the read:analytics scope in claude.ai organization settings. Data starts on 2026-01-01, usually arrives about one day late, and the whole API allows 60 requests a minute for the organization (Anthropic: Analytics APIs (read 2026-11-05)).

Save one day like this. The command comes from the docs, with the key in an environment variable and never in a file. We did not run this fetch: we have no customer's key, and we never use our own organization's data.

bash: save one day (not run by us)
curl -s "https://api.anthropic.com/v1/organizations/analytics/users?date=2026-11-03&limit=1000" \
  -H "anthropic-version: 2026-10-21" \
  -H "x-api-key: $ANALYTICS_KEY" \
  -o days/2026-11-03.json

The answer holds a data list with one record per user and a next_page value that is null on the last page. If next_page is not null, ask again with &page= and that value and save the answer as days/2026-11-03-2.json. Do this for each of the 30 days; if each day fits on one page, 30 requests stay inside the limit of 60 a minute. The docs page shows the key in the x-api-key header, while the endpoint reference's example shows an Authorization: Bearer header; use whichever the pages show on the day you run it.

The script reads these fields, named as the reference names them. A null or missing field counts as zero. Real answers carry many more fields, which the script ignores; our generated records carry only these.

WhatField in each recordCounted as
Whouser.id, user.email_addressthe person; the email is the join key
Chatchat_metrics.message_count, chat_metrics.distinct_conversation_countmessages, conversations
Claude Codeclaude_code_metrics.core_metrics.distinct_session_countsessions
Coworkcowork_metrics.distinct_session_countsessions
Officeoffice_metrics.<app>.distinct_session_count for excel, outlook, powerpoint and wordsessions, added up
Designdesign_metrics.distinct_session_countsessions
Chat and Cowork unifiedchat_cowork_unified_metrics.chat messages and conversations; chat_cowork_unified_metrics.sessions.distinct_session_countadded to Chat and to Cowork

Most activity in Chat and Cowork unified is reported in its own object, not in the chat and Cowork fields, so the script adds that object in; without it people who use it could look idle (Anthropic: Analytics APIs (read 2026-11-05)).

The HR file, one row per employee

Include people who do not use Claude: they are the other half of every share. Required columns: email (the work email the person signs in to Claude with), department and manager_email (blank for at most one person, the most senior; the script allows one blank and does not check who it is). Optional: location, role, hire_date (YYYY-MM-DD) and cost_center. The script ignores the optional columns and any others, takes the columns in any order and matches header names without regard to case. Emails are matched ignoring case and surrounding spaces.

Method

  1. Check the HR file. The three required columns are there, no email appears twice, and every manager_email is also an email in the file, except the one blank.
  2. Read the day files. The 30 days end on the date of the newest file (or the date you give with --last-day). Every day must be there exactly once and none may be empty or unreadable.
  3. Match each Claude user to the HR file by email. A Claude user with no match, with no email at all, or whose HR row has no department, goes to the department Unmapped. Unmapped is counted and listed in a CSV, never dropped. Department names match ignoring case and surrounding spaces. Two Claude user ids with the same HR email count as one person, and the match report says how many extra ids it found.
  4. Decide who is active. A person is active on a day when messages, Claude Code sessions, Cowork sessions, Office sessions and Design sessions on that day add up to more than zero. The script counts people active in the last 7 days and in the last 30 days, both ending on the last day.
  5. Count by department. People in the HR file, Claude users, active in 7 days, active in 30 days, the share of the department active in 30 days, messages, conversations and sessions, and use by product.
  6. Hide small groups. A department with fewer than 5 people shows -- in every count, on the screen and in the CSV files, so no one person stands out. In a larger department, any count of 1 to 4 people shows -- too: an active count (and, for 30 days, its share), a product fewer than 5 people used with its amount, and every usage count of a department with fewer than 5 Claude users. Unmapped is shown with its count however small, because it is a fix list for the Claude admin, the person who runs your rollout, not a group of colleagues.
  7. Check the result. Seven checks run on the script's own result. If one fails, the script prints the failure, writes no CSV and exits with code 1. Unmapped users are a finding, not a failure.

Our active-person rule is our own and broader than Anthropic's. Anthropic counts a user as active for a day with a chat message, a Claude Code session with tool use or git activity, or a Cowork session with tool use or message activity (Anthropic: Analytics APIs (read 2026-11-05)). Ours also counts Office and Design, so your numbers may differ from the active-user counts in Anthropic's own reports.

The join is plain SQL in DuckDB. The excerpt below matches each Claude user to a department, then adds up that person's days. The department totals come from the same tables, so the totals check can compare them with totals the script adds up separately, straight from the day files.

python and SQL: the join (excerpt of the script)
# one row per Claude user id: the email on its latest day, matched to the HR file. A person is
# their HR email when matched (two user ids with one HR email are one person), else the user id.
con.execute("""CREATE TABLE ud AS
    SELECT u.user_id, u.email, h.email AS hr_email, coalesce(h.department, ?) AS department,
           coalesce(h.email, 'id:' || u.user_id) AS person
    FROM (SELECT user_id, arg_max(email, day) AS email FROM activity GROUP BY user_id) u
    LEFT JOIN hr h ON h.email = u.email""", [UNMAPPED])
con.execute("""CREATE TABLE per_user AS
    SELECT d.person, min(d.hr_email) AS email, d.department,
           sum(a.messages) AS messages, sum(a.conversations) AS conversations,
           sum(a.code_sessions) AS code_sessions, sum(a.cowork_sessions) AS cowork_sessions,
           sum(a.office_sessions) AS office_sessions, sum(a.design_sessions) AS design_sessions,
           max(CASE WHEN a.day > ? AND a.messages + a.code_sessions + a.cowork_sessions
                    + a.office_sessions + a.design_sessions > 0 THEN 1 ELSE 0 END) AS act7,
           max(CASE WHEN a.messages + a.code_sessions + a.cowork_sessions
                    + a.office_sessions + a.design_sessions > 0 THEN 1 ELSE 0 END) AS act30
    FROM ud d JOIN activity a USING (user_id)
    GROUP BY d.person, d.department""", [last - dt.timedelta(days=RECENT_DAYS)])

We ran the script with these versions:

Python 3.12.15 duckdb 1.5.6

Run 1. Generated records, clean

The records are generated: an invented company with 298 invented people at example.com addresses, 12 departments, 30 days, a fixed seed, and field names from the reference. They are not Data Meaning's own Claude organization and not any real person's activity. The script makes them itself:

bash
python3 claude_use_by_department.py --make-demo demo
Wrote 298 HR rows and 30 day files to demo (generated, seed 54)

Then the real run, with the two paths a reader passes. The first line names the files, the checks come next, then the match report and two tables:

bash
python3 claude_use_by_department.py --hr demo/hr.csv --days demo/days
HR file: demo/hr.csv (298 rows)   Day files: demo/days (30 read)

Checks
  [PASS] HR file has the three required columns: email, department, manager_email found among 7 columns
  [PASS] no email appears twice in the HR file: 0 email(s) on more than one row, 0 row(s) with a blank email
  [PASS] every manager_email is an email in the HR file: 0 manager(s) not in the file, 1 blank manager_email (at most 1 allowed)
  [PASS] every day file is readable and not empty: 0 unreadable, 0 empty, 0 record(s) without a user
  [PASS] every day in the range is present exactly once: 30 of 30 days present from 2026-10-05 to 2026-11-03
  [PASS] no Claude user appears twice on the same day: 0 user(s) twice on a day
  [PASS] department totals equal the export's own totals: all six measures agree

Match report
  Claude users in the export:  266
  matched to the HR file:      266
  unmapped (department 'Unmapped'): 0
  HR rows with no Claude activity in the 30 days: 97 of 298
  extra Claude user ids for a person already counted: 0

Use by department, 2026-10-05 to 2026-11-03 (-- hides any count of fewer than 5 people)
Department          People  Users  Active 7d  Active 30d  Active %  Messages  Conversations
Customer Support        44     38         19          22      50.0      3166            516
Data and Analytics      20     18         14          15      75.0      2399            383
Engineering             62     56         51          55      88.7      7066           1120
Executive Office        --     --         --          --        --        --             --
Finance                 22     20         10          11      50.0      1050            170
Internal Audit          --     --         --          --        --        --             --
Legal                    7      6         --          --        --        --             --
Marketing               30     26         24          24      80.0      5288            857
Operations              26     23         12          15      57.7      2499            388
People                  14     12          5           6      42.9       611            107
Product                 18     15         14          14      77.8      2185            343
Sales                   48     46         31          32      66.7      6315           1023
Unmapped                 0      0          0           0       n/a         0              0

Use by product: people who used it / amount (chat counts messages, the others count sessions)
Department             Chat  Claude Code  Cowork  Office  Design
Customer Support    22/3166          0/0     0/0     0/0     0/0
Data and Analytics  15/2399       15/270   13/85   12/50     0/0
Engineering         55/7066      55/1570  47/214     0/0   14/40
Executive Office         --           --      --      --      --
Finance             10/1050          0/0     0/0  11/121     0/0
Internal Audit           --           --      --      --      --
Legal                    --          0/0     0/0     0/0     0/0
Marketing           24/5288          0/0  22/122  24/220  24/365
Operations          15/2499          0/0   11/59  15/164     0/0
People                6/611          0/0     0/0      --     0/0
Product             14/2185        14/56  13/104   14/57   13/51
Sales               32/6315          0/0  26/141  31/358     0/0
Unmapped                0/0          0/0     0/0     0/0     0/0

All checks passed. Wrote claude_use_by_department.csv, claude_use_by_product.csv and claude_unmapped_users.csv (next to the script, or in --out)

How to read it

  • Checks first. All seven passed, so the script wrote the three CSV files. Read the tables only when that line says so.
  • The match report is the admin's to-do list. 266 Claude users, all 266 matched, none unmapped, no extra user ids. 97 of the 298 HR rows had no Claude activity in the 30 days: people with no seat and people with a seat who never used it. A real run's Unmapped line is where you find contractors, shared mailboxes and people whose email in Claude differs from the one in HR. Our generated export lists seat holders who did nothing; your export may not, and those people then show only in the HR-rows count.
  • Active % is active in 30 days divided by people in the HR file, not by Claude users. Engineering shows 55 active of 62 people, 88.7. Operations shows 15 of 26, 57.7.
  • -- hides any count of fewer than 5 people. Executive Office (3 people) and Internal Audit (4) show a dash in every column, on screen and in the CSV files. Legal (7 people) shows its people and Claude users but hides its active counts and its chat, because fewer than 5 of its people were active. People hides its Office cell, because fewer than 5 of its people used Office. Unmapped is the exception and shows its count.
  • In the product table, 55/7066 reads: 55 people used chat, 7066 messages in total. Chat counts messages. Claude Code, Cowork, Office and Design count sessions.
  • The patterns are our generator's, not findings. We set each department's adoption and product mix when we generated the records, so do not read Customer Support's chat-only row as a fact about customer support.

The CSV files from this run: claude_use_by_department.csv (one row per department), claude_use_by_product.csv (one row per department and product) and claude_unmapped_users.csv (the Claude users with no HR match or no department: file, record number in the file, Anthropic user id and email; in this run it holds only its header line, because nobody was unmapped).

Run 2. The same records with five planted errors

The same generator with --plant-errors writes a second copy with five planted errors: a repeated HR row, a manager who is not in the file, a missing day, a user twice on one day and a Claude user who is not in the HR file. The repeated HR row trips two checks. The unmapped user trips none: the match report shows it. Each error is planted for certain: the script stops if it cannot plant one.

bash
python3 claude_use_by_department.py --make-demo demo-planted --plant-errors
Wrote 299 HR rows and 29 day files to demo-planted (generated, seed 54)
  planted: one HR row repeated (HR data row 299 copies row 11)
  planted: manager_email on HR data row 21 is not in the file
  planted: day file for 2026-10-20 removed
  planted: one record repeated on 2026-10-27
  planted: a Claude user whose email is not in the HR file, on the last 3 days
bash
python3 claude_use_by_department.py --hr demo-planted/hr.csv --days demo-planted/days
HR file: demo-planted/hr.csv (299 rows)   Day files: demo-planted/days (29 read)

Checks
  [PASS] HR file has the three required columns: email, department, manager_email found among 7 columns
  [FAIL] no email appears twice in the HR file: 1 email(s) on more than one row, 0 row(s) with a blank email; data rows [11, 299]
  [FAIL] every manager_email is an email in the HR file: 1 manager(s) not in the file, 1 blank manager_email (at most 1 allowed); data rows [21]
  [PASS] every day file is readable and not empty: 0 unreadable, 0 empty, 0 record(s) without a user
  [FAIL] every day in the range is present exactly once: 29 of 30 days present from 2026-10-05 to 2026-11-03; missing 2026-10-20
  [FAIL] no Claude user appears twice on the same day: 1 user(s) twice on a day; first at 2026-10-27.json record 267
  [FAIL] department totals equal the export's own totals: messages 30669 vs 30500; conversations 4920 vs 4888; code_sessions 1857 vs 1813; cowork_sessions 694 vs 688

Match report
  Claude users in the export:  267
  matched to the HR file:      266
  unmapped (department 'Unmapped'): 1
  HR rows with no Claude activity in the 30 days: 97 of 299
  extra Claude user ids for a person already counted: 0

5 CHECK(S) FAILED: no tables shown, no CSV written

Five of the seven checks failed, the script exited with code 1 and wrote no CSV and showed no table, because numbers from a failed run cannot be trusted. The match report still found the fifth planted error: one Claude user with no HR match. That one is a finding, not a failure: once the five failures are fixed, the run writes that user to the unmapped list. The two checks that passed are the two this run did not plant an error for.

Which planted error trips which check:

CheckWhat trips it in run 2
HR file has the three required columnsNot planted in run 2. Rename or delete manager_email in the HR file to trip it.
No email appears twice in the HR fileOne HR row repeated (the same email on two rows).
Every manager_email is an email in the HR fileOne row's manager_email set to an address that is not in the file.
Every day file is readable and not emptyNot planted in run 2. Cut a day file short, or empty its data list, to trip it.
Every day in the range is present exactly onceThe day file for 2026-10-20 removed.
No Claude user appears twice on the same dayOne record repeated inside the 2026-10-27 file.
Department totals equal the export's own totalsThe repeated HR row: the join counts that person's activity twice, so the department sums come out higher than the export's own totals (30669 messages against 30500).

Run it on your own records

To run it on your own records, change the value of HR_FILE at the top of the script to the path of your HR file, and the value of DAYS_DIR to the folder that holds your saved day files. Nothing else needs editing: the columns can be in any order, there can be extra columns, and emails can be in any case.

Or leave the script alone and pass the same two paths when you run it: python3 claude_use_by_department.py --hr your-hr-file.csv --days your-folder. The CSV files go next to the script, or to the folder you give with --out.

Three things must be true of your files. The HR file's headers are email, department and manager_email (rename them in your HR export if yours differ; the script does not guess). The day files are named YYYY-MM-DD.json, with -2, -3 for further pages of the same day. The day files hold the API's answer as saved. Other files in the folder are ignored and counted on the first line of the output.

We tested this path on a second set of records built differently from the demo: other file and folder names, a different column order, extra columns, upper-case emails with spaces around them, a Claude user whose email is null, null counts and a blank optional value, plus a copy of that data with planted errors. The script, with only those two lines changed, caught the planted errors and passed the clean copy. This is the clean copy's run:

HR file: people.csv (12 rows)   Day files: exports_oct (30 read)

Checks
  [PASS] HR file has the three required columns: email, department, manager_email found among 6 columns
  [PASS] no email appears twice in the HR file: 0 email(s) on more than one row, 0 row(s) with a blank email
  [PASS] every manager_email is an email in the HR file: 0 manager(s) not in the file, 1 blank manager_email (at most 1 allowed)
  [PASS] every day file is readable and not empty: 0 unreadable, 0 empty, 0 record(s) without a user
  [PASS] every day in the range is present exactly once: 30 of 30 days present from 2026-10-05 to 2026-11-03
  [PASS] no Claude user appears twice on the same day: 0 user(s) twice on a day
  [PASS] department totals equal the export's own totals: all six measures agree

Match report
  Claude users in the export:  6
  matched to the HR file:      5
  unmapped (department 'Unmapped'): 1
  HR rows with no Claude activity in the 30 days: 8 of 12
  extra Claude user ids for a person already counted: 0

Use by department, 2026-10-05 to 2026-11-03 (-- hides any count of fewer than 5 people)
Department  People  Users  Active 7d  Active 30d  Active %  Messages  Conversations
Finance          5     --         --          --        --        --             --
Legal           --     --         --          --        --        --             --
Sales            5     --         --          --        --        --             --
Unmapped         0      1          1           1       n/a       120             30

Use by product: people who used it / amount (chat counts messages, the others count sessions)
Department   Chat  Claude Code  Cowork  Office  Design
Finance        --           --      --      --      --
Legal          --           --      --      --      --
Sales          --           --      --      --      --
Unmapped    1/120          0/0     0/0     0/0     0/0

All checks passed. Wrote claude_use_by_department.csv, claude_use_by_product.csv and claude_unmapped_users.csv (next to the script, or in --out)

Get the full guide as a PDF

We'll email you a link to it. Please use your work email.

Limits

  • This is not a client result and not a measurement of any company. The records in every run are generated, and the fetch from the real API was not run by us. Your own export is the only evidence about your own departments.
  • Activity shows how much and where, not what the work was about or whether it paid off. The export holds counts, not conversations. A department with fewer active people has not necessarily got less out of Claude.
  • One HR file means one department per person. Someone who moved departments counts in their current department for the whole period.
  • Claude Enterprise only. The Analytics API is available to Claude Enterprise organizations (Anthropic: Analytics APIs (read 2026-11-05)).
  • Per-day files avoid estimated counts. In date-range mode the API recomputes distinct counts approximately (typical error under 2%, per the reference (read 2026-11-05)). The script asks for one day at a time and adds the days up. A conversation that runs over two days counts once on each; the reference says a Claude Code session essentially never spans a UTC day, and its date parameter is a UTC day.
  • Claude Code through Amazon Bedrock is not in the export (Anthropic: Analytics APIs (read 2026-11-05)), so a department that codes through Bedrock will look quieter than it is.
  • Recent days can change. The reference says a day's data may be revised by a few percent over the following days. Save the days again if you need exact numbers.
  • The script cannot see a missing newest day. The 30 days end at the newest file. Pass --last-day to pin the end.
  • A dash hides a count only on the screen and in the CSV files. The match report prints total Claude users and total HR rows with no activity, so do not share it next to the department table if every dash must stay hidden.
  • The unmapped list holds your people's work emails. Treat it like the HR file itself.

Tested on

Tested on

Platform
DuckDB 1.5.6, run from Python 3.12.15
Edition
Open-source DuckDB library (pip install duckdb)
Date
2026-11-05
Records
Generated: an invented company, 298 invented people at example.com addresses, 30 days ending 2026-11-03, fixed seed 54. Field names from Anthropic's reference (read 2026-11-05). Not a run against the real API.
Code
claude_use_by_department.py
Results
claude_use_by_department.csv, claude_use_by_product.csv, claude_unmapped_users.csv

Every run on this page came from the file you can download, with a fixed seed, so a rerun on the same generated records gives the same output.

When this is not enough

  • You need to know what each department uses Claude for. The export counts messages and sessions. What the work was needs the conversations themselves, and this guide does not read them.
  • You need to know whether it paid off. Counts show adoption, not value. That takes a before-and-after on a measure the department already tracks.
  • You want these counts next to what each department spends and whether Claude is set up safely. Control Tower for Claude shows leaders what each department uses Claude for, what each one spends, and whether Claude is set up safely. It labels every conversation by kind of work, keeping the label, never the conversation. It needs an HR file of every employee with a department and a manager, the same file this guide uses.

Find out what each department uses Claude for

This guide counts how much each department uses Claude. The guide does not read conversations, so its counts cannot say what the work was about or whether Claude paid off.

Control Tower for Claude shows leaders what each department uses Claude for, what each one spends, and whether Claude is set up safely. Control Tower for Claude needs an HR file of every employee with a department and a manager, the same file this guide uses.

See what Control Tower for Claude shows