Programmatic API Credentials¶
FlexGalaxy.ai supports two types of programmatic credentials for API access, mirroring the AWS IAM and STS model.
Overview¶
Type |
Realm |
Prefix |
Lifecycle |
Management |
|---|---|---|---|---|
Static credentials |
|
|
Long-lived, manually rotated |
AdminCenter UI or API |
STS temporary credentials |
|
|
15 min – 12 hours, auto-expires |
STS API |
Both types produce the same credential format (access key ID + secret key) and use the same authentication mechanism for API calls.
1. Static Credentials (acc-* Users)¶
Static credentials are long-lived access key / secret key pairs for tenant IAM users. They are analogous to AWS IAM access keys.
Creating via AdminCenter UI¶
Navigate to AdminCenter → Users → select a user
Click the Security Credentials tab
Click Create access key
Optionally enter a description
Copy the secret key immediately — it is shown only once and cannot be retrieved later
Each user can have a maximum of 2 access keys
Creating via API¶
curl -X POST https://api.flexgalaxy.com/iam/v1/accounts/{accountId}/credentials \
-H "Authorization: Bearer <jwt>" \
-H "Content-Type: application/json" \
-d '{
"principal_id": "<keycloak-user-id>",
"description": "CI/CD pipeline"
}'
Response (201):
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"access_key_id": "AKIA1A2B3C4D5E6F7G8H",
"secret_key": "wJalrXUtnFEMI_K7MDENG_bPxRfiCYEXAMPLEKEY...",
"status": "ACTIVE",
"principal_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"description": "CI/CD pipeline",
"created_at": "2026-03-17T10:00:00Z",
"expires_at": null
}
Warning: The
secret_keyis returned only in this response. It is stored as a SHA-256 hash and cannot be retrieved later. If lost, delete the credential and create a new one.
Managing credentials¶
Operation |
Method |
Path |
|---|---|---|
List |
|
|
Get |
|
|
Update (activate/deactivate) |
|
|
Delete |
|
|
Update example (deactivate):
curl -X PUT https://api.flexgalaxy.com/iam/v1/accounts/{accountId}/credentials/{credentialId} \
-H "Authorization: Bearer <jwt>" \
-H "Content-Type: application/json" \
-d '{"status": "INACTIVE"}'
2. STS Temporary Credentials (idc-* Users)¶
Identity Center users can obtain short-lived credentials by exchanging their JWT for temporary access key / secret key / session token credentials.
Obtaining temporary credentials¶
curl -X POST https://api.flexgalaxy.com/iam/v1/sts/get-session-token \
-H "Authorization: Bearer <idc-realm-jwt>" \
-H "Content-Type: application/json" \
-d '{
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"duration_seconds": 3600
}'
Response (200):
{
"access_key_id": "ASIA9X8Y7Z6W5V4U3T2S",
"secret_key": "wJalrXUtnFEMI_K7MDENG_bPxRfiCYTEMPKEY...",
"session_token": "FwoGZXIvYXdzEBYaDHqa0AP...",
"expiration": "2026-03-17T11:00:00Z"
}
Parameters¶
Parameter |
Type |
Required |
Default |
Range |
|---|---|---|---|---|
|
UUID |
Yes |
— |
Target account |
|
Integer |
No |
3600 (1 hour) |
900 – 43200 (15 min – 12 hours) |
Restrictions¶
Only available for users authenticated via
idc-*Keycloak realmsRequests from
acc-*orflexgalaxyrealm JWTs are rejected (400)Expired credentials are automatically cleaned up hourly
Managing STS sessions¶
Unlike AWS STS, FlexGalaxy supports individual session revocation.
List active sessions:
curl https://api.flexgalaxy.com/iam/v1/sts/sessions?accountId={accountId} \
-H "Authorization: Bearer <idc-realm-jwt>" \
-H "X-Account-Id: {accountId}"
Response (200):
[
{
"id": "uuid",
"access_key_id": "ASIA7348AA4A62E56A33",
"status": "ACTIVE",
"principal_id": "keycloak-user-uuid",
"principal_type": "federated",
"description": "STS temporary credential",
"created_at": "2026-03-17T18:37:37.941Z",
"last_used_at": "2026-03-17T18:37:39.518Z",
"expires_at": "2026-03-17T18:52:37.938Z"
}
]
Returns all active (non-expired) STS credentials for the calling user in the specified account.
Revoke a single session:
curl -X POST https://api.flexgalaxy.com/iam/v1/sts/revoke-session \
-H "Authorization: Bearer <idc-realm-jwt>" \
-H "Content-Type: application/json" \
-H "X-Account-Id: {accountId}" \
-d '{"access_key_id": "ASIA9X8Y7Z6W5V4U3T2S"}'
Response (200):
{"message": "Session revoked", "access_key_id": "ASIA9X8Y7Z6W5V4U3T2S"}
The specified temporary credential is immediately deleted. Any subsequent API call using it will fail with 401.
Revoke all sessions:
curl -X POST https://api.flexgalaxy.com/iam/v1/sts/revoke-all-sessions \
-H "Authorization: Bearer <idc-realm-jwt>" \
-H "Content-Type: application/json" \
-H "X-Account-Id: {accountId}" \
-d '{"account_id": "550e8400-e29b-41d4-a716-446655440000"}'
Response (200):
{"message": "All sessions revoked", "revoked_count": 3}
All active temporary credentials for the calling user in the specified account are immediately deleted.
Operation |
Method |
Path |
Auth |
|---|---|---|---|
List sessions |
|
|
JWT (idc-*) |
Revoke one |
|
|
JWT (idc-*) |
Revoke all |
|
|
JWT (idc-*) |
3. Using Credentials for API Authentication¶
Both static and temporary credentials use the same authentication scheme.
Authentication header format¶
Authorization: FGAI Base64(<access_key_id>:<secret_key>)
For temporary credentials (ASIA prefix), also include:
X-Session-Token: <session_token>
Example: Static credential¶
# Encode credentials
CREDS=$(echo -n "AKIA1A2B3C4D5E6F7G8H:wJalrXUtnFEMI_K7MDENG_bPxRfiCYEXAMPLEKEY" | base64)
# Make API call
curl https://api.flexgalaxy.com/iam/v1/accounts/{accountId}/users \
-H "Authorization: FGAI ${CREDS}"
Example: Temporary credential¶
# Encode credentials
CREDS=$(echo -n "ASIA9X8Y7Z6W5V4U3T2S:wJalrXUtnFEMI_K7MDENG_bPxRfiCYTEMPKEY" | base64)
# Make API call with session token
curl https://api.flexgalaxy.com/iam/v1/accounts/{accountId}/users \
-H "Authorization: FGAI ${CREDS}" \
-H "X-Session-Token: FwoGZXIvYXdzEBYaDHqa0AP..."
Authentication flow¶
Client sends request with
Authorization: FGAI <encoded>headerThe platform decodes and extracts the access key ID and secret key
Credential is looked up by access key ID
Status (ACTIVE), expiry, and secret key hash are verified
For
ASIAprefix: session token is also verifiedOn success: the request is authenticated with the credential's principal and account
Error responses¶
Status |
Reason |
|---|---|
401 |
Invalid credential format |
401 |
Credential not found |
401 |
Credential is inactive |
401 |
Credential has expired |
401 |
Invalid secret key |
401 |
Missing or invalid session token (ASIA only) |
4. Access Key Format¶
Component |
Static |
Temporary |
|---|---|---|
Prefix |
|
|
Random part |
16 hex chars (8 bytes) |
16 hex chars (8 bytes) |
Total length |
20 characters |
20 characters |
Example |
|
|
Secret key: 54 characters, Base64url-encoded (40 random bytes, no padding).
Session token (STS only): 43 characters, Base64url-encoded (32 random bytes).
5. Security Considerations¶
Storage¶
Secret keys are never stored in plaintext. Only the SHA-256 hash is persisted.
Session tokens are similarly hashed before storage.
Verification¶
Secret key comparison uses constant-time
MessageDigest.isEqual()to prevent timing attacks.
Limits¶
Maximum 2 static credentials per IAM user per account.
No limit on concurrent STS sessions (they auto-expire).
Best practices¶
Rotate static keys regularly — create a new key, update your applications, then deactivate/delete the old key.
Prefer STS credentials for interactive or short-lived workloads.
Never embed credentials in source code — use environment variables or secret managers.
Deactivate keys before deleting — allows rollback if something breaks.
Monitor
last_used_at— inactive keys that haven't been used should be reviewed for deletion.
6. API Reference Summary¶
Static Credential CRUD¶
Method |
Path |
Auth |
Description |
|---|---|---|---|
|
|
JWT |
Create access key |
|
|
JWT |
List credentials |
|
|
JWT |
Get credential |
|
|
JWT |
Update status/description |
|
|
JWT |
Delete credential |
STS¶
Method |
Path |
Auth |
Description |
|---|---|---|---|
|
|
JWT (idc-* only) |
Get temporary credentials |
|
|
JWT (idc-*) |
List active sessions |
|
|
JWT (idc-*) |
Revoke one session by access key ID |
|
|
JWT (idc-*) |
Revoke all sessions for caller in account |
API Authentication¶
Header |
Required |
Description |
|---|---|---|
|
Yes |
Base64-encoded |
|
ASIA only |
Session token from STS response |