Operations

What an operation is, the kinds and states it has, how to follow one and how to retry one that failed.

Work on a database that takes time runs as an operation. When you create, suspend, resume, delete or restore a database, or rotate one of its keys, the request is recorded as an operation and answered at once; the work then runs in the background. An operation is how you find out how far it got.

Where to see them

  • A database's Operations page lists its operations, newest first, with their state, step and times.
  • The Overview shows the most recent ones, and a banner while one is running or after one failed.
  • The management API returns the newest operation as the database's latestOperation, and the 50 most recent from GET /v1/databases/{databaseId}/operations.

Kinds

KindStarted by
create_databaseCreating a database, or retrying a failed creation
suspend_databaseSuspending
resume_databaseResuming
delete_databaseDeleting
restore_databaseRestoring a deleted database during its grace period
restore_backupRestoring a backup into a new database
rotate_database_keyRotating a database key

States

StateMeaning
pendingRecorded, not started yet
runningIn progress
succeededFinished
failedStopped with an error, given in error
cancelledStopped on purpose: a deletion cancelled by a restore

Steps

While an operation runs, its step names what it is doing, for example placing, creating, configuring and verifying for a creation. Steps are for people to read: show them, but do not write code that depends on their exact text.

Two steps of a deletion last a long time by design:

  • waiting for the grace period: access is blocked and the database can be restored.
  • held in backups: the database is removed and only its backups remain, until their retention ends.

A key rotation waits in waiting for the overlap window until the old key is due to be revoked.

One at a time

A database runs one operation at a time. A request that needs an operation while another is pending or running is refused with a conflict: wait for the current one to finish. There are two exceptions:

  • Restoring a deleted database cancels the deletion that is waiting out its grace period.
  • A key rotation that is waiting out its overlap window does not hold up other operations.

Retrying

Every step of an operation is safe to repeat, so an operation that failed can be run again and continues where it stopped. In the dashboard the failure banner has a Retry button; in the management API it is POST /v1/databases/{databaseId}/retry.

Retry acts on the database's latest operation, and only if that operation failed:

Failed operationWhat retry does
create_databaseRuns the creation again
delete_databaseResumes the deletion
restore_databaseRuns the restore again
suspend_database, resume_databaseRuns it again
rotate_database_keyResumes revoking the old key
restore_backupRefused. Delete the new database and restore the backup again

Retrying when the latest operation did not fail is refused with a conflict.

Following an operation from a script

Poll the database until its state is the one you are waiting for, and stop if the latest operation failed:

curl "$MIMIC_MANAGEMENT_API/v1/databases/$DATABASE_ID" \
  -H "Authorization: Bearer $MIMIC_API_KEY"
{
  "id": "db_…",
  "state": "provisioning",
  "latestOperation": {
    "id": "op_…",
    "databaseId": "db_…",
    "kind": "create_database",
    "state": "running",
    "step": "creating",
    "error": null,
    "createdAt": "2026-01-15T10:00:00.000Z",
    "updatedAt": "2026-01-15T10:00:02.000Z",
    "completedAt": null
  }
}

The response above is shortened; see databases in the API for every field.