v1.0
Beranda Overview Mulai Pakai API

Dokumentasi API SekolahKu

API RESTful untuk integrasi dan pengelolaan sistem sekolah. Standar OAuth2, response JSON.

Base URL: https://sekolahku.sains.dev/api/v1

Overview

API SekolahKu menggunakan OAuth2 untuk autentikasi. Semua request ke endpoint yang terproteksi harus menyertakan access token di header Authorization.

OAuth2 Grant Types

API ini mendukung 3 grant type OAuth2:

  • Client Credentials โ€” untuk server-to-server integration (paling umum)
  • Password โ€” untuk login via username/password (deprecated untuk third-party)
  • Authorization Code โ€” untuk OAuth2 web flow
  • Refresh Token โ€” untuk perpanjangan access token

Quick Start

bash โ€” 3 Langkah
# 1. Daftar sekolah di panel SekolahKu # 2. Dapatkan client_id & client_secret # 3. Tukar dengan access token curl -X POST https://sekolahku.sains.dev/api/v1/oauth/token \ -H "Content-Type: application/json" \ -d '{ "grant_type": "client_credentials", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" }'
๐Ÿงช Try It โ€” Client Credentials Grant

Token Endpoint

POST
/oauth/token
Dapatkan Access Token
โ–ถ

Menukar kredensial klien dengan access token OAuth2. Mendukung client_credentials, password, dan authorization_code grant types.

Request Body (client_credentials)

FieldTypeRequiredDescription
grant_type string required Tipe grant: client_credentials, password, authorization_code
client_id string required Client ID yang diberikan saat registrasi
client_secret string required Client Secret yang diberikan saat registrasi
scope string optional Scope yang diminta (default: semua)

Request Body (password)

FieldTypeRequiredDescription
grant_typestringrequiredpassword
usernamestringrequiredEmail user
passwordstringrequiredPassword user
client_idstringrequiredClient ID
client_secretstringrequiredClient Secret

Response

200 OK โ€” JSON
{ "access_token": "eyJ0eXAiOiJKV1...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2g...", "scope": "*" }
๐Ÿงช Try It

Refresh Token

POST
/oauth/token/refresh
Perpanjang Access Token
โ–ถ

Gunakan refresh token untuk mendapatkan access token baru tanpa login ulang.

FieldTypeRequiredDescription
refresh_tokenstringrequiredRefresh token dari response token sebelumnya
๐Ÿงช Try It

Revoke Token

POST
/oauth/revoke
Cabut Access Token
โ–ถ

Cabut access token atau refresh token sebelum expired.

FieldTypeRequiredDescription
tokenstringrequiredToken yang akan dicabut

Get Current Token Info

GET
/me
Info User & Token
โ–ถ

Dapatkan informasi user dan scope yang terkait dengan access token saat ini.

Authorization: Bearer {token}
curl -X GET https://sekolahku.sains.dev/api/v1/me \ -H "Authorization: Bearer {access_token}"