⚠️ Porta is in beta — APIs and features may change before v1.0
Skip to content

Clients API

Manage OIDC clients. Each client belongs to an organization and an application.

Base path: /api/admin/clients

Create Client

http
POST /api/admin/clients
FieldTypeRequiredDescription
client_namestringHuman-readable client name
organization_iduuidOwning organization
application_iduuidAssociated application
client_typestringconfidential or public
application_typestringweb, native, or spa (default: web)
redirect_urisstring[]Allowed redirect URIs
grant_typesstring[]Grant types (defaults based on client type)
response_typesstring[]Response types
scopestringSpace-separated scopes
token_endpoint_auth_methodstringclient_secret_post or none
cors_originsstring[]Allowed CORS origins (for SPAs)
require_pkcebooleanRequire PKCE (default: true for public clients)
login_methodsstring[]Override org default login methods
json
{
  "client_name": "ERP Web App",
  "organization_id": "org-uuid",
  "application_id": "app-uuid",
  "client_type": "public",
  "application_type": "spa",
  "redirect_uris": ["https://erp.example.com/callback"],
  "scope": "openid profile email roles custom_claims",
  "cors_origins": ["https://erp.example.com"]
}

Response: 201 Created — Returns the client object with the generated client_id. For confidential clients, the initial secret is included in the response (shown only once).

List Clients

http
GET /api/admin/clients

Supports page, pageSize, search, status, sort, order, and organization_id filter.

Response: 200 OK — Paginated list with effectiveLoginMethods computed for each client.

Get Client

http
GET /api/admin/clients/:id

Response: 200 OK — Full client object including effectiveLoginMethods.

Update Client

http
PUT /api/admin/clients/:id

Updatable fields: client_name, redirect_uris, grant_types, response_types, scope, cors_origins, login_methods.

Response: 200 OK

Status Management

http
POST /api/admin/clients/:id/revoke
POST /api/admin/clients/:id/activate
POST /api/admin/clients/:id/deactivate

Response: 200 OK

WARNING

Revoking a client immediately invalidates all its tokens and prevents new authentication flows.

Client Secrets

Confidential clients can have multiple active secrets for zero-downtime rotation.

Generate Secret

http
POST /api/admin/clients/:id/secrets
FieldTypeDescription
labelstringOptional label for the secret

Response: 201 Created

json
{
  "id": "secret-uuid",
  "clientId": "client-uuid",
  "label": "production-2024",
  "secret": "the-plaintext-secret",
  "createdAt": "2024-01-15T10:30:00.000Z"
}

DANGER

The plaintext secret is shown only once in this response. Store it securely.

List Secrets

http
GET /api/admin/clients/:id/secrets

Returns metadata only (no plaintext secrets).

Revoke Secret

http
POST /api/admin/clients/:id/secrets/:secretId/revoke

Response: 200 OK

Released under the MIT License.