# Manage keys and read activity

Page: https://galatea.co/api/docs/keys-and-activity

A management key can mint, change and delete the organization's other keys and read its request log, all without a browser.

The dashboard is for a person. An agent that runs on its own needs the same two things a person has there: the ability to rotate its credential, and the ability to read what its requests cost. Both are on the public API, and both act only inside the organization the calling key belongs to.

## The two kinds of key

A key is one of two types, and the type is chosen when it is created. An inference key calls the models. A management key manages the organization: it creates and revokes keys, reads usage and billing. One key cannot do both, and each type is refused on the other's routes, so a management key that leaks cannot spend the balance and an inference key in a CI job cannot mint its way out.

Choose the type on the Keys page of the dashboard: Management key. Inside the management type there are two permissions. billing:write reads the receipts and reads or writes the automatic top up setting. keys:write lists, creates, changes and deletes the organization's other keys. Every key can end itself without a scope; keys:burn remains accepted for compatibility. A management key may grant only the permissions and the spending cap it holds itself. A management key may be minted only by an account that owns the organization, from a key that holds no cap or ceiling itself.

What the management type lets a key do.

| Route | Needs | Answers |
| --- | --- | --- |
| GET /v1/keys | a management key with keys:write | every key of the organization, newest first |
| POST /v1/keys | a management key with keys:write | the new key, and its secret once |
| PATCH /v1/keys/{id} | a management key with keys:write | the key as it now stands |
| DELETE /v1/keys/{id} | a management key with keys:write | the id, and deleted: true |
| GET /v1/activity | a management key | one page of the request log |
| POST /v1/key/burn | any active key, with no scope needed | its own id, and disabled: true |

## The key object

Every answer carries the same object the dashboard's keys page draws. Two of its fields are not columns: spent_micros is what the key has spent in its own reset window and remaining_micros is its cap less that spend. Both are folded from the usage events on the read, so they always agree with the log, and a key with no cap answers remaining_micros as null rather than a number nobody set.

```mint a key, list the keys, then disable the one you made
curl https://api.galatea.co/v1/keys \
  -H "Authorization: Bearer $GALATEA_MANAGEMENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"laptop","spending_cap_micros":5000000,"limit_reset":"daily"}'

curl https://api.galatea.co/v1/keys \
  -H "Authorization: Bearer $GALATEA_MANAGEMENT_KEY"

curl -X PATCH https://api.galatea.co/v1/keys/key_0123456789abcdef0123456789abcdef \
  -H "Authorization: Bearer $GALATEA_MANAGEMENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"disabled":true}'
```

The secret is in the create answer and nowhere else, because only its hash is stored. A lost key is replaced, never recovered. A disable takes effect at once: the edge purges the key it has cached, so the next request with it is a 401 with the code key_disabled rather than waiting out the cache.

Every key ends itself with POST /v1/key/burn, including existing inference and management keys with no scopes: no id and no body, because the key that stops is the one in the request. It cannot name another key or re-enable itself. The row and its history stay, and the burn is audited.

## Read the request log

GET /v1/activity answers the same rows the dashboard's activity table lists and its CSV export downloads: one row per request, with the model, the token counts, the cost, the timings and the status. The cost is the ledger's own rule applied to the usage event and the price row the request was charged at, so it matches the figure the charge moved.

The filters are the dashboard's. from and to are UTC days, both inclusive, and a bare call reads the last 30 days. key and model narrow to one key or one model. status is ok, aborted or failed, where failed covers both failures. limit is the page size, 1 to 500 and 100 by default.

Paging is a cursor, not a page number: the answer carries next_cursor, which names the last row it sent, and the next call passes it back as after. A short page is the last page and carries a null.

```one page of one key's requests, then the next page
curl "https://api.galatea.co/v1/activity?from=2026-10-01&to=2026-10-18&status=ok&limit=50" \
  -H "Authorization: Bearer $GALATEA_API_KEY"

curl "https://api.galatea.co/v1/activity?after=<next_cursor from the last answer>" \
  -H "Authorization: Bearer $GALATEA_API_KEY"
```

A key that has been deleted leaves its requests in the log with key_name equal to its id, because the money moved and the row is the record of it.

[The Keys page](https://galatea.co/api/dashboard/keys)

[The API reference](https://galatea.co/api/docs/reference)
