Developers
Bring your recorded AI usage into the tools you build.
Make your first API request
Create a personal credential and read a page of synced usage. Personal API access is included in Free.
Start with a read requestBrowse endpoints, request parameters and response schemas.
Understand recorded usage, reporting and local automation.
Find session identifiers and connect work to a customer or ticket.
Create or revoke personal API credentials under Account settings.
Watch the API walkthrough
Follow credential setup, usage reads and session tags in 2 minutes 43 seconds.
Read the transcript
Use the Tokematic API to pull your usage records into your own script or dashboard, and to set work tags on sessions. Personal API access is free. We will use a personal space and a credential that has only the permissions the script needs. This credential is for Tokematic, separate from any AI vendor key.
In web Settings, open Account, then Credentials. Under Tokematic API Credentials, choose Create credential and give it a clear label, such as Personal dashboard. Choose Personal as the owner. Read usage records lets the script read. Add tags to sessions is separate; turn it on only if the script will set tags. Neither permission can change a usage record.
The credential is shown once. Copy it into your password manager or secret store, tick I saved this credential and keep it out of source code, screenshots and command history. Requests send it in the Authorization header as a bearer credential. Anyone holding it can do what it is allowed to do.
In Credentials, open Connection details and copy the group prefix. It identifies your space. Put it in the records request shown here, ask for Usage Report records and send your credential in the Authorization header. The response contains records and a next cursor; keep following the cursor until it is empty. You can filter by field and date, and ask only for changes since a version to keep a dashboard current.
To tag a session, first list the tagged sessions and take the provider and vendor session ID from that response. The usage record ID is a different identifier. With Add tags to sessions permission, send the update shown here. It sets Customer to Acme and Work type to Research. Fields you leave out stay as they were. Send null to clear a field. Comment holds a free-text note. Usage records are untouched.
Responses to your credential carry an allowance header, so your script can see how much it has left before it runs out. A rate limit response uses status four twenty-nine with a retry-after value; wait that long. Allowances have hourly, daily and monthly windows shared by every credential you own, so a new credential does not reset them.
When a script is finished, return to Credentials and revoke its credential. New requests with it fail at once. Data the script already copied stays wherever it put it. If you are replacing a credential, update the script before revoking the old one.
Start with Read usage records. Add tags to sessions only for scripts that change tags. Revoke a credential when its script retires.