Skip to main content

What each event means

The event types returned by GET /v1/analytics/audit-logs/events and by the CSV export, with the fields each one carries and how to join them.
Every audit event has the same envelope and an event-specific payload in action.data. This page documents the envelope, the five event types you need to account for usage, and how to combine them into one row per generation.

Event envelope

The CSV export carries the same events with one column per field (action_verb, action_data, member_auth…). action_data, action_old_state and action_new_state are JSON objects in their cell. See the file.

Usage events

creation.executed

One event per status change of a generation: an image, a video, an audio clip, an upscale, or any other creation. A generation therefore produces several events. Group them by action.resource_id. action.data:
Compare statuses case-insensitively. Generations made in the app send them in lower case (completed); generations requested through the REST API send CREATED, IN_PROGRESS, COMPLETED and FAILED.
A generation made in the app, from start to end:
Only the fields that change are shown; each element is a full event.

account.credits.consumed

One event per movement of credits: a charge (verb: consumed) or the refund of a charge (verb: refunded). It covers every charge on the team’s credits, including the ones that are not a generation. action.data on a charge: action.data on a refund:
A generation requested through the REST API reports its charge on creation.executed (credits_consumed) and has no consumed event of its own, so the same charge is never listed twice. Its refund, if any, still arrives as an account.credits.consumed event with verb: refunded.

project.file.changed

A file of a project was created or changed. When a generation finishes, the file it produced is saved to a project and this event says where. action.data:

creation.downloaded

A member downloaded a creation, or copied it. action.data:

account.session.login

A member signed in.

One row per generation

To build a table with one row per generation, its cost and what happened to it:
1

Read the generations

Read creation.executed and group the events by action.resource_id. The latest event by date gives the current status; member, action.context.tool and action.data.project_reference are the same in all of them.
2

Take the charge

The charge of a generation is action.data.credits_consumed when it is present, and otherwise the highest action.data.credits among its events. Do not add up credits across the events of one generation: every event repeats the same amount.
3

Add the billing detail

For the quantity and the unit that were billed, read account.credits.consumed with verb: consumed and match its transaction_ids with the transaction_ids of the generation.
4

Apply the refunds

Read account.credits.consumed with verb: refunded. A refund belongs to the generation whose transaction_ids contain its rolled_back_transaction_id. Net cost is the charge minus credits_refunded.
5

Add the file and the downloads

project.file.changed with verb: created and action.data.creation_sqid equal to the generation’s action.resource_id gives the file and its project. creation.downloaded with that same action.resource_id gives who downloaded it and when.
Filter the feed with event_type to read only these types, for example event_type=creation.executed,account.credits.consumed.
An event_type value that is not in the list below is ignored instead of rejected. If none of the values you send is valid, the response holds events of every type.

Delivery and deduplication

Events are delivered at least once: the same event can reach you more than once, always with the same event_id. Keep one row per event_id. Events are recorded when they happen, not when a generation ends, so the events of one generation can be far apart in time and fall in different pages or different exports. Join by identifier, never by position.

All event types

event_type accepts these values. New event types and new keys in action.data can be added at any time. Ignore the ones you do not know instead of failing on them.