Skip to content

Docs / API reference

Use the API with an AI agent

Let an AI agent read your time data with a read-only token and these docs in Markdown.

View as Markdown

Docs an agent can read

  • https://t.momentic.studio/llms.txt lists each docs page with a one-line description. Each link points at the page in Markdown.
  • https://t.momentic.studio/llms-full.txt holds the API reference and the help guides as one Markdown document.
  • Each docs page is also served as Markdown: add .md to its address, such as https://t.momentic.studio/docs/api/time-entries.md. A request that asks for text/markdown in its Accept header gets the Markdown at the page's own address.
  • The OpenAPI 3.1 document is at https://t.momentic.studio/api/v2/openapi.json.

Create a token for the agent

  • Create the token as a person whose access matches what the agent needs. A token reads and changes what its person can read and change in the app.
  • Create the token in Settings, API tokens. A new token is read only, with reports:read.
  • Add rates:read only when the agent needs billable rates and amounts, and people:read only when it needs other people's emails.
  • Give the agent the token and the account id shown on the same page. The agent sends them in the Authorization and Harvest-Account-Id headers, with a User-Agent that names the agent.

Keep the agent's access small

  • Start with a read-only token. Add a write scope, such as time:write, only when the agent has to create or change records, and add only the scope it needs.
  • Keep the token out of prompts that are saved or shared, and out of code. Give it to the agent through an environment variable or a secret store.
  • Revoke the token in Settings, API tokens when the agent's work is done.

A prompt to start with

Paste this into the agent's instructions, with the token and account id in the two environment variables it names.

Prompt
Read https://t.momentic.studio/llms.txt and the pages it links to before you call the API. The API follows Harvest API v2 paths, methods and objects under https://t.momentic.studio/api/v2, and its OpenAPI document is at https://t.momentic.studio/api/v2/openapi.json. Send the token from the environment variable TIME_TRACKER_TOKEN as Authorization: Bearer <token>, the account id from TIME_TRACKER_ACCOUNT_ID as Harvest-Account-Id, and a User-Agent that names you, and make only GET requests unless I ask for a change.