post__organization_{orgId}_key
POST /organization/{idOrg}/key
Generate Organization Key
Generate a new RSA key pair for organization authentication and node registration.
This endpoint creates a new RSA key pair (2048-bit) for the specified organization. The public key is stored securely in the database, while the private key is returned as a downloadable PEM file for immediate use by bridge nodes.
Key Features:
Generates 2048-bit RSA key pairs for secure authentication
Private key returned as downloadable PEM file
Public key stored securely in the database
Automatic key-node association for registered nodes
System event logging for audit trails
Access Control:
Requires ADMINISTRATOR or OWNER role within the organization
Users can only manage keys for their own organization
Maximum key limit enforced per organization (default: 5 keys)
Security:
Private keys are only returned once during generation
Public keys are stored encrypted in the database
All operations are logged for security auditing
Quota Limits:
Maximum keys per organization: 5 (configurable via
ORGKEYS_MAX
environment variable)Returns 400 error when quota exceeded
TypeScript Client Library
public generateOrgKey = async (idOrg: string): Promise<string> => {
return this.makeRequest<string>(`organization/${idOrg}/key`, 'POST');
};
Code Samples
# You can also use wget
curl -X POST https://backend.flashback.tech/organization/{idOrg}/key \
-H 'Accept: application/x-pem-file' \
-H 'Authorization: Bearer {access-token}' \
--output private_key.pem
Parameters
idOrg
path
string
true
Organization ID for which to generate the key
Example responses
200 Response
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA7VJTUt9Us8cKBwT1L6O5VfwlrP0xP2B5iZvr5Xq5BwL1K2Y3
...
-----END RSA PRIVATE KEY-----
400 Response
{
"success": false,
"message": "Maximum number of organization keys (5) has been reached. Please delete existing keys before creating new ones."
}
403 Response
{
"success": false,
"message": "Access denied: you can only manage keys for your own organization"
}
Responses
Response Schema
Status Code 200
Body
string
false
none
RSA private key in PEM format
Status Code 400
» success
boolean
false
none
Operation success status
» message
string
false
none
Error message describing the issue
Status Code 403
» success
boolean
false
none
Operation success status
» message
string
false
none
Error message describing the permission issue
Status Code 500
» success
boolean
false
none
Operation success status
» message
string
false
none
Error message describing the internal error
To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth
Last updated
Was this helpful?