API Key

  • Belongs to a Tenant.
  • Lets a Tenant use the API.

Life Cycle

RouteCreateReadUpdateDelete
/admin/api/keys
/admin/api/keys/new
/admin/api/keys/:id
/app/:tenant/settings/api/keys
/app/:tenant/settings/api/keys/new
/app/:tenant/settings/api/keys/:id

Properties

NameTitleTypeDescription
tenantId *TenantTenant
key *KeyUUIDAutogenerated
alias *AliasStringShows as 'created by XYZ' on Custom Entity Rows
max *MaxIntMaximum number of usages
expires *ExpiresDateTime
active *ActiveBoolean
entities *EntitiesApiKeyEntity[]CRUD permissions of Custom Entities
apiKeyLogs API Key LogsApiKeyLog[]IP, Endpoint, Method, Params, Status and Error
logs LogsLog[]API Key audit trails/events
createdRows RowsRow[]Custom entity rows created by API Key

Model

model ApiKey {
  id              String         @id @default(cuid())
  createdAt       DateTime       @default(now())
  createdByUserId String
  createdByUser   User           @relation(fields: [createdByUserId], references: [id], onDelete: Cascade)
  tenantId        String
  tenant          Tenant         @relation(fields: [tenantId], references: [id], onDelete: Cascade)
  key             String         @default(uuid())
  alias           String
  max             Int
  expires         DateTime
  active          Boolean
  entities        ApiKeyEntity[]
  apiKeyLogs      ApiKeyLog[]
  logs            Log[]
  rows            Row[]

  @@unique([tenantId, alias])
}

cookies.titleSmall

cookies.descriptionSmall shared.learnMore.