Download OpenAPI specification:
勤怠管理システムのバックエンドAPI仕様書
ほとんどのエンドポイントでJWT Bearer認証が必要です。
/api/v1/auth/register でユーザー登録/api/v1/auth/login でログインしてトークンを取得Authorization: Bearer {token} ヘッダーに含めてリクエストユーザーには以下のロールが存在します。
| ロール | 説明 |
|---|---|
employee |
一般社員。自分の勤怠情報のみ操作可能 |
admin |
管理者。全社員の情報を参照・管理可能 |
admin タグのエンドポイントは admin ロールのユーザーのみアクセスできます。
新規社員を登録します
| email required | string <email> メールアドレス |
| password required | string <password> >= 6 characters パスワード(6文字以上) |
| name required | string 名前 |
| role | string Default: "employee" Enum: "admin" "employee" ロール(省略時はemployee) |
{- "email": "yamada@example.com",
- "password": "password123",
- "name": "山田太郎",
- "role": "employee"
}{- "id": "550e8400-e29b-41d4-a716-446655440000",
- "email": "yamada@example.com",
- "name": "山田太郎",
- "role": "employee",
- "created_at": "2024-01-01T18:00:00+09:00",
- "updated_at": "2024-01-01T18:00:00+09:00"
}メールアドレスとパスワードでログインし、JWTトークンを取得します
| email required | string <email> メールアドレス |
| password required | string <password> パスワード |
{- "email": "yamada@example.com",
- "password": "password123"
}{- "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbXBsb3llZV9pZCI6IjU1MGU4NDAwLWUyOWItNDFkNC1hNzE2LTQ0NjY1NTQ0MDAwMCIsInJvbGUiOiJlbXBsb3llZSJ9.example",
- "employee": {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "email": "yamada@example.com",
- "name": "山田太郎",
- "role": "employee",
- "created_at": "2024-01-01T18:00:00+09:00",
- "updated_at": "2024-01-01T18:00:00+09:00"
}
}指定した年月の勤怠一覧を取得します。 自分の勤怠のみ取得できます。
| year_month required | string^\d{4}-(0[1-9]|1[0-2])$ Example: year_month=2026-04 対象年月(YYYY-MM形式) |
[- {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "employee_id": "550e8400-e29b-41d4-a716-446655440001",
- "date": "2024-01-01",
- "clock_in": "2024-01-01T09:00:00+09:00",
- "clock_out": "2024-01-01T18:00:00+09:00",
- "created_at": "2024-01-01T18:00:00+09:00",
- "updated_at": "2024-01-01T18:00:00+09:00"
}
]{- "id": "550e8400-e29b-41d4-a716-446655440000",
- "employee_id": "550e8400-e29b-41d4-a716-446655440001",
- "date": "2024-01-01",
- "clock_in": "2024-01-01T09:00:00+09:00",
- "clock_out": "2024-01-01T18:00:00+09:00",
- "created_at": "2024-01-01T18:00:00+09:00",
- "updated_at": "2024-01-01T18:00:00+09:00"
}{- "id": "550e8400-e29b-41d4-a716-446655440000",
- "employee_id": "550e8400-e29b-41d4-a716-446655440001",
- "date": "2024-01-01",
- "clock_in": "2024-01-01T09:00:00+09:00",
- "clock_out": "2024-01-01T18:00:00+09:00",
- "created_at": "2024-01-01T18:00:00+09:00",
- "updated_at": "2024-01-01T18:00:00+09:00"
}ログイン中の社員自身の申請一覧を取得します。
| status | string Enum: "PENDING" "APPROVED" "REJECTED" Example: status=PENDING ステータスでフィルタリング |
| page | integer >= 1 Default: 1 Example: page=1 ページ番号(1始まり) |
| per_page | integer [ 1 .. 100 ] Default: 20 Example: per_page=20 1ページあたりの件数 |
{- "applications": [
- {
- "id": "550e8400-e29b-41d4-a716-446655440001",
- "employee": {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "name": "山田太郎"
}, - "type": "ATTENDANCE_CORRECTION",
- "status": "PENDING",
- "reason": "電車の遅延により出勤時刻が遅れました",
- "created_at": "2024-01-15T09:00:00+09:00",
- "updated_at": "2024-01-15T09:00:00+09:00",
- "details": {
- "date": "2024-01-15",
- "requested_clock_in": "2024-01-15T09:30:00+09:00",
- "requested_clock_out": "2024-01-15T18:30:00+09:00"
}
}
], - "total": 5,
- "page": 1,
- "per_page": 20
}勤怠打刻の修正申請を行います。
requested_clock_in と requested_clock_out の少なくとも一方は必須です。
| type required | string Value: "ATTENDANCE_CORRECTION" 申請種別 |
| date required | string <date> 修正対象の日付 |
| requested_clock_in | string or null <date-time> 修正後の出勤時刻(requested_clock_out と少なくとも一方必須) |
| requested_clock_out | string or null <date-time> 修正後の退勤時刻(requested_clock_in と少なくとも一方必須) |
| reason required | string 申請理由 |
{- "type": "ATTENDANCE_CORRECTION",
- "date": "2024-01-15",
- "requested_clock_in": "2024-01-15T09:30:00+09:00",
- "reason": "電車の遅延により出勤時刻が遅れました"
}{- "id": "550e8400-e29b-41d4-a716-446655440001",
- "employee": {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "name": "山田太郎"
}, - "type": "ATTENDANCE_CORRECTION",
- "status": "PENDING",
- "reason": "電車の遅延により出勤時刻が遅れました",
- "created_at": "2024-01-15T09:00:00+09:00",
- "updated_at": "2024-01-15T09:00:00+09:00",
- "details": {
- "date": "2024-01-15",
- "requested_clock_in": "2024-01-15T09:30:00+09:00",
- "requested_clock_out": "2024-01-15T18:30:00+09:00"
}
}自分の申請を取り消します。
PENDING(申請中)状態の申請のみ取り消し可能です。
APPROVED(承認済み)または REJECTED(却下済み)の申請は取り消しできません。
| id required | string <uuid> Example: 550e8400-e29b-41d4-a716-446655440001 申請ID |
{- "id": "550e8400-e29b-41d4-a716-446655440001",
- "employee": {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "name": "山田太郎"
}, - "type": "ATTENDANCE_CORRECTION",
- "status": "PENDING",
- "reason": "電車の遅延により出勤時刻が遅れました",
- "details": {
- "date": "2024-01-15",
- "requested_clock_in": "2024-01-15T09:30:00+09:00",
- "requested_clock_out": null
}, - "created_at": "2024-01-15T09:00:00+09:00",
- "updated_at": "2024-01-15T09:00:00+09:00"
}全社員の一覧を取得します。
このエンドポイントはadminロールの社員のみ実行できます。
| page | integer >= 1 Default: 1 Example: page=1 ページ番号(1始まり) |
| per_page | integer [ 1 .. 100 ] Default: 20 Example: per_page=20 1ページあたりの件数 |
| role | string Enum: "admin" "employee" Example: role=employee ロールでフィルタリング |
{- "employees": [
- {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "email": "yamada@example.com",
- "name": "山田太郎",
- "role": "employee",
- "created_at": "2024-01-01T18:00:00+09:00",
- "updated_at": "2024-01-01T18:00:00+09:00"
}
], - "total": 42,
- "page": 1,
- "per_page": 20
}指定したIDの社員情報を更新します。
このエンドポイントはadminロールの社員のみ実行できます。
name / email / role のうち少なくとも1つを指定してください。
自分自身の role を変更することはできません。
| id required | string <uuid> Example: 550e8400-e29b-41d4-a716-446655440000 更新する社員のUUID |
| name | string 名前 |
string <email> メールアドレス | |
| role | string Enum: "admin" "employee" ロール |
{- "name": "山田花子"
}{- "id": "550e8400-e29b-41d4-a716-446655440000",
- "email": "yamada@example.com",
- "name": "山田太郎",
- "role": "employee",
- "created_at": "2024-01-01T09:00:00+09:00",
- "updated_at": "2026-05-09T18:00:00+09:00"
}指定したIDの社員詳細情報と勤怠一覧を取得します。
このエンドポイントはadminロールのユーザーのみ実行できます。
year_month で勤怠の取得対象年月を絞り込めます。
page / per_page で勤怠一覧のページネーションを制御できます。
| id required | string <uuid> Example: 550e8400-e29b-41d4-a716-446655440000 社員のUUID |
| year_month | string^\d{4}-(0[1-9]|1[0-2])$ Example: year_month=2024-01 勤怠取得の対象年月(YYYY-MM形式) |
| page | integer >= 1 Default: 1 Example: page=1 勤怠一覧のページ番号(1始まり) |
| per_page | integer [ 1 .. 100 ] Default: 20 Example: per_page=20 勤怠一覧の1ページあたりの件数 |
{- "id": "550e8400-e29b-41d4-a716-446655440000",
- "email": "yamada@example.com",
- "name": "山田太郎",
- "role": "employee",
- "created_at": "2024-01-01T09:00:00+09:00",
- "updated_at": "2024-01-01T09:00:00+09:00",
- "attendances": {
- "records": [
- {
- "id": "660e8400-e29b-41d4-a716-446655440001",
- "employee_id": "550e8400-e29b-41d4-a716-446655440000",
- "date": "2024-01-15",
- "clock_in": "2024-01-15T09:00:00+09:00",
- "clock_out": "2024-01-15T18:00:00+09:00",
- "created_at": "2024-01-15T09:00:00+09:00",
- "updated_at": "2024-01-15T18:00:00+09:00"
}
], - "total": 20,
- "page": 1,
- "per_page": 20
}
}指定したIDの社員を削除します。
このエンドポイントはadminロールの社員のみ実行できます。
削除した社員に紐づく勤怠レコードも合わせて削除されます。 自分自身のアカウントは削除できません。
| id required | string <uuid> Example: 550e8400-e29b-41d4-a716-446655440000 削除する社員のUUID |
{- "id": "550e8400-e29b-41d4-a716-446655440000",
- "email": "yamada@example.com",
- "name": "山田太郎",
- "role": "employee",
- "created_at": "2024-01-01T18:00:00+09:00",
- "updated_at": "2024-01-01T18:00:00+09:00"
}全社員の申請一覧を取得します。
このエンドポイントはadminロールの社員のみ実行できます。
| status | string Enum: "PENDING" "APPROVED" "REJECTED" Example: status=PENDING ステータスでフィルタリング |
| page | integer >= 1 Default: 1 Example: page=1 ページ番号(1始まり) |
| per_page | integer [ 1 .. 100 ] Default: 20 Example: per_page=20 1ページあたりの件数 |
{- "applications": [
- {
- "id": "550e8400-e29b-41d4-a716-446655440001",
- "employee": {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "name": "山田太郎"
}, - "type": "ATTENDANCE_CORRECTION",
- "status": "PENDING",
- "reason": "電車の遅延により出勤時刻が遅れました",
- "created_at": "2024-01-15T09:00:00+09:00",
- "updated_at": "2024-01-15T09:00:00+09:00",
- "details": {
- "date": "2024-01-15",
- "requested_clock_in": "2024-01-15T09:30:00+09:00",
- "requested_clock_out": "2024-01-15T18:30:00+09:00"
}
}
], - "total": 42,
- "page": 1,
- "per_page": 20
}指定した申請の詳細を取得します。承認者情報や管理者コメントを含みます。
このエンドポイントはadminロールの社員のみ実行できます。
| id required | string <uuid> Example: 550e8400-e29b-41d4-a716-446655440001 申請ID |
{- "id": "550e8400-e29b-41d4-a716-446655440001",
- "employee": {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "name": "山田太郎"
}, - "type": "ATTENDANCE_CORRECTION",
- "status": "PENDING",
- "reason": "電車の遅延により出勤時刻が遅れました",
- "created_at": "2024-01-15T09:00:00+09:00",
- "updated_at": "2024-01-15T09:00:00+09:00",
- "details": {
- "date": "2024-01-15",
- "requested_clock_in": "2024-01-15T09:30:00+09:00",
- "requested_clock_out": "2024-01-15T18:30:00+09:00"
}, - "approved_by": {
- "id": "550e8400-e29b-41d4-a716-446655440099",
- "name": "鈴木管理者"
}, - "approved_at": "2024-01-16T10:00:00+09:00",
- "admin_comment": "確認しました。修正を承認します。"
}指定した申請を承認します。
PENDING(申請中)状態の申請のみ承認可能です。
このエンドポイントはadminロールの社員のみ実行できます。
| id required | string <uuid> Example: 550e8400-e29b-41d4-a716-446655440001 申請ID |
| admin_comment | string or null 管理者コメント(任意) |
{- "admin_comment": "確認しました。修正を承認します。"
}{- "id": "550e8400-e29b-41d4-a716-446655440001",
- "employee": {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "name": "山田太郎"
}, - "type": "ATTENDANCE_CORRECTION",
- "status": "APPROVED",
- "reason": "電車の遅延により出勤時刻が遅れました",
- "details": {
- "date": "2024-01-15",
- "requested_clock_in": "2024-01-15T09:30:00+09:00",
- "requested_clock_out": null
}, - "approved_by": {
- "id": "550e8400-e29b-41d4-a716-446655440099",
- "name": "鈴木管理者"
}, - "approved_at": "2024-01-16T10:00:00+09:00",
- "admin_comment": "確認しました。修正を承認します。",
- "created_at": "2024-01-15T09:00:00+09:00",
- "updated_at": "2024-01-16T10:00:00+09:00"
}指定した申請を却下します。
PENDING(申請中)状態の申請のみ却下可能です。
申請者に理由を伝えるため admin_comment の入力を推奨します。
このエンドポイントはadminロールの社員のみ実行できます。
| id required | string <uuid> Example: 550e8400-e29b-41d4-a716-446655440001 申請ID |
| admin_comment | string or null 却下理由 |
{- "admin_comment": "勤務実績と合致しないため却下します。再申請してください。"
}{- "id": "550e8400-e29b-41d4-a716-446655440001",
- "employee": {
- "id": "550e8400-e29b-41d4-a716-446655440000",
- "name": "山田太郎"
}, - "type": "ATTENDANCE_CORRECTION",
- "status": "REJECTED",
- "reason": "電車の遅延により出勤時刻が遅れました",
- "details": {
- "date": "2024-01-15",
- "requested_clock_in": "2024-01-15T09:30:00+09:00",
- "requested_clock_out": null
}, - "approved_by": {
- "id": "550e8400-e29b-41d4-a716-446655440099",
- "name": "鈴木管理者"
}, - "approved_at": "2024-01-16T10:00:00+09:00",
- "admin_comment": "勤務実績と合致しないため却下します。再申請してください。",
- "created_at": "2024-01-15T09:00:00+09:00",
- "updated_at": "2024-01-16T10:00:00+09:00"
}