Skip to main content

API Clients & API Keys

Column-level detail for api_client, api_key

Overview

This domain has 2 tables in the public schema (managed by Prisma), covering external system access to the platform API. api_client is the identity of the calling system (holding a client id and secret); api_key is a key issued to that client, scoped to a specific LINE OA and organization.

Table api_client

ColumnTypeNullableDefaultDescription
idSERIALNOauto incrementPrimary key
nameTEXTNO-Name of the calling system or application
descriptionTEXTYES-Additional description of the client
client_idTEXTNO-Client identifier used for authentication
client_secretTEXTNO-Secret paired with client_id
status"CommonStatus"NO'active'Record status (shared system enum)
created_dateTIMESTAMPTZ(3)NOnow()Creation timestamp
created_byINTEGERNO0Creator user id
updated_dateTIMESTAMPTZ(3)YES-Last update timestamp (Prisma @updatedAt)
updated_byINTEGERYES0Last updater user id
deleted_dateTIMESTAMPTZ(3)YES-Soft-delete timestamp

Table api_key

ColumnTypeNullableDefaultDescription
idSERIALNOauto incrementPrimary key
titleTEXTNO-Human-readable label so admins can tell keys apart
keyTEXTNO-The key value presented on API calls
api_client_idINTEGERNO-Client the key was issued to (references api_client.id)
line_oa_idINTEGERNO-LINE OA this key may access
organization_idINTEGERNO-Organization owning the key
status"CommonStatus"NO'active'Record status (shared system enum)
created_dateTIMESTAMPTZ(3)NOnow()Creation timestamp
created_byINTEGERNO0Creator user id
updated_dateTIMESTAMPTZ(3)YES-Last update timestamp (Prisma @updatedAt)
updated_byINTEGERYES0Last updater user id
deleted_dateTIMESTAMPTZ(3)YES-Soft-delete timestamp

Notes

  • Indexes: api_client on (client_id, client_secret, status) — matching the client authentication query; api_key on (organization_id, line_oa_id, status)
  • Neither table declares database-level foreign keys — api_key.api_client_id references api_client.id logically, and line_oa_id / organization_id reference line_oa / organization
  • status uses the shared PostgreSQL enum "CommonStatus", whose values are active, inactive, processing, delete, completed, expired, draft, failed. Revoking a key means setting status to anything other than active
  • Both tables soft-delete via deleted_date rather than removing rows, so API call history stays traceable back to the key that made it