Record cache usage events
Records cache usage analytics events. The body of this request is an array of cache usage events.
This endpoint is optional but enables cache hit/miss analytics. Implementers can use this data to track cache effectiveness and optimize storage.
Event types:
HIT: A cached artifact was found and usedMISS: No cached artifact was found for the given hash
Source types:
LOCAL: The cache event was on the user’s local filesystem cacheREMOTE: The cache event is for the remote cache
/artifacts/eventsAuthorizationBearer token · headerrequiredBearer token authentication. Pass your authentication token in the Authorization header as Bearer <token>.
For self-hosted implementations, the token format and validation logic is up to the implementer. Common approaches include:
- Static tokens for simple setups
- JWT tokens for stateless authentication
- OAuth2 tokens for integration with identity providers
teamIdstringThe team identifier to perform the request on behalf of. Used for multi-tenant cache implementations where artifacts are scoped to teams.
slugstringThe team slug to perform the request on behalf of. Alternative to teamId for identifying the team.
x-artifact-client-cistringThe continuous integration or delivery environment where this artifact operation is being performed. Examples: github-actions, circleci, jenkins.
x-artifact-client-interactiveintegerIndicates whether the client is running in an interactive shell. 1 for interactive, 0 for non-interactive (CI/scripts).
01application/jsonCacheEventsessionIdstring<uuid>requiredA UUID that identifies the Turborepo session that generated this event
sourcestringrequiredThe source of the cache event.
LOCAL: The event occurred on the user's local filesystem cacheREMOTE: The event is for the remote cache
LOCALREMOTEeventstringrequiredThe type of cache event.
HIT: A cached artifact was foundMISS: No cached artifact was found
HITMISShashstringrequiredThe artifact hash associated with this event
durationintegerThe time taken to generate the artifact in milliseconds. Only meaningful for HIT events.
Events recorded successfully
Bad request. One or more of the provided values in the request query, headers, or body is invalid.
codestringrequiredA machine-readable error code
messagestringrequiredA human-readable error message
Unauthorized. The request is missing a valid authentication token or the token is invalid.
codestringrequiredA machine-readable error code
messagestringrequiredA human-readable error message
Forbidden. The authenticated user does not have permission to access this resource.
codestringrequiredA machine-readable error code
messagestringrequiredA human-readable error message