API clients enable OAuth2 Client Credentials authentication for service-to-service integrations. Unlike API keys (which use a static secret), API clients obtain short-lived JWT tokens, providing stronger security for production integrations.

When to Use API Clients vs API Keys

Use API clients for production service-to-service integrations where security is a priority. Use API keys for simpler automation, one-off scripts, and development.

Creating an API Client

API client management requires the admin role.

From the UI

Navigate to Admin > API Clients and click Create Client. Provide a name, description, and select the scopes.

From the API

Response:
The client_secret is shown only once in this response. Copy it immediately and store it securely. SoCMate cannot recover the secret — you would need to regenerate it.

Using an API Client

API clients authenticate using the OAuth2 Client Credentials flow:
1

Request an access token

Exchange the client credentials for a JWT access token:
Response:
2

Use the token

Pass the access token as a Bearer token in the Authorization header:
3

Refresh before expiration

Tokens expire after 30 minutes (configurable). Your integration should request a new token before the current one expires. There is no refresh token in the Client Credentials flow — simply request a new access token.

Scopes

API clients use the same scope system as API keys: Scopes are validated at creation time. Invalid scopes are rejected with a 400 error.

Listing API Clients

Response:
The client secret is never returned in list or detail responses.

Regenerating a Secret

If a client secret is compromised or lost, regenerate it:
Response:
Regenerating the secret immediately invalidates the old secret. Any integrations using the old secret will fail authentication. Unlike API key rotation, there is no grace period. Coordinate the update with your integration team.

Disabling a Client

Disable a client to revoke all access:
Response:
Disabled clients:
  • Cannot obtain new tokens
  • Existing tokens remain valid until they expire (up to 30 minutes)
  • Cannot be re-enabled — create a new client instead

Client Status

Best Practices

  • Use descriptive names — Name clients after the integration they serve
  • Minimize scopes — Only grant the scopes needed for the specific integration
  • Cache tokens — Reuse tokens until near expiration instead of requesting a new one per API call
  • Store secrets securely — Use Azure Key Vault or a similar secrets manager
  • Monitor last_used_at — Identify and disable unused clients
  • Separate clients per environment — Use different clients for dev, staging, and production