Required setup
The API uses Laravel Passport for OAuth2. Before the API is functional, you need to generate RSA encryption keys and store them in your environment. Run the following command to generate the keys and write them directly to your.env:
PASSPORT_PRIVATE_KEY and PASSPORT_PUBLIC_KEY in your .env file. Storing the keys in the environment (rather than as files on disk) is required for cloud deployments where the filesystem is ephemeral.
Run this once per environment (local, staging, production). Use
--force to regenerate existing keys. The command removes the key files from storage/ after writing them to .env.Authentication flows
Two authentication flows are available:Client Credentials
App-to-app authentication. The app client authenticates directly with its own identity and permissions. Best for integrations, automated systems, and admin APIs.
Authorization Code
User-authenticated OAuth. Users authorize the app via a consent screen, and the resulting token acts on their behalf. Best for external customer portals.
Managing app clients
App clients are managed in Developer → Apps. You need themanage_system permission to access this section.
Creating an app client
Configure the client
Fill in the following fields:
- Name — A human-readable name for the client (e.g.
Schoolsoft Integration). - Description — Optional. Describes the purpose of this client.
- Grant types — Select one or both:
Client credentials— For app-to-app authentication.Authorization code— For user OAuth flows.
- Redirect URIs — Required when using the authorization code grant. One URI per line.
Assigning roles and permissions
For client credentials (app-to-app) flows, the app client’s own Spatie roles and permissions apply — not a user’s. You can configure these on the client’s Permissions tab. This lets you control exactly what data an integration can access, independent of any user account.Revoking or deleting a client
- Delete the client from the Danger zone section on its detail page. All access tokens are immediately invalidated.
- Deleted clients are soft-deleted and can be recovered by a developer if needed.
Client credentials (client ID and secret)
Every app client has a Client ID (UUID) and a Client Secret (random string). These are used to obtain access tokens.| Field | Description |
|---|---|
| Client ID | Unique identifier for the client. Safe to expose publicly. |
| Client Secret | Used together with Client ID to authenticate. Keep secret. |