Authentication
The PortX ORCA API uses industry-standard authentication mechanisms to secure access to your data.
Authentication Methods
JWT Bearer Tokens
The primary authentication method is JWT (JSON Web Token) bearer tokens obtained via OAuth 2.0.
Obtaining a Token
Request an access token from the authorization server:
POST https://auth.portx.io/oauth/token
Content-Type: application/json
{
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"grant_type": "client_credentials",
"scope": "accounts:read accounts:write"
}
Response
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "accounts:read accounts:write"
}
Using the Token
Include the access token in the Authorization header:
curl https://api.portx.io/orca/v1/accounts \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
Scopes
Access is controlled through OAuth scopes. Request only the scopes your application needs:
| Scope | Description |
|---|---|
accounts:read |
Read account information |
accounts:write |
Create and modify accounts |
transactions:read |
View transaction history |
transactions:write |
Create transactions |
parties:read |
Read party (customer) data |
parties:write |
Create and modify parties |
cards:read |
View card information |
cards:write |
Issue and manage cards |
Token Expiration
Access tokens expire after 1 hour (3600 seconds). Implement token refresh logic in your application:
- Store the token expiration time
- Request a new token before the current one expires
- Handle
401 Unauthorizedresponses by refreshing the token
Security Best Practices
- Never expose credentials - Keep client secrets server-side
- Use HTTPS - All API calls must use TLS
- Rotate secrets - Periodically rotate your client credentials
- Minimal scopes - Request only necessary permissions
- Token storage - Store tokens securely, never in client-side code
OpenID Connect
For user-facing applications, we support OpenID Connect for delegated authentication. Contact support for OIDC configuration details.
Error Responses
Authentication failures return standard HTTP status codes:
| Status | Description |
|---|---|
401 Unauthorized |
Invalid or expired token |
403 Forbidden |
Valid token but insufficient permissions |
Example error response:
{
"error": "unauthorized",
"error_description": "The access token is invalid or has expired"
}