Skip to main content

Application Keys

Map an OAuth client_id to an API Portal application​

POST /applications/{applicationId}/generate-keys

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/applications/{applicationId}/generate-keys \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Maps an OAuth client_id — created directly in the selected key manager — to the specified application. The portal does not create or register OAuth clients; it only stores the client_id reference and later proxies token requests for it.

Payload

{
"keyManager": "Resident Key Manager",
"type": "PRODUCTION",
"consumerKey": "consumer-key-123"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:application_key:create`, `dp:application_key:manage`

Parameters​

NameInTypeRequiredDescription
bodybodyAppKeyMappingRequesttrueMaps an OAuth client_id — created directly in the key manager — to this application. The application is identified by the applicationId path parameter.
applicationIdpathstringtrueThe application's handle (unique per org).

Example responses

200 Response

{
"keyMappingId": "km-12345",
"keyManager": "Resident Key Manager",
"type": "PRODUCTION",
"consumerKey": "consumer-key-123",
"tokenEndpoint": "https://api.asgardeo.io/t/myorg/oauth2/token"
}

Bad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.

{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
{
"message": "Missing or invalid fields in the request payload"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

409 Response

{
"status": "error",
"code": "CONFLICT",
"message": "Conflict"
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKApplication OAuth key mapping response.ApplicationOAuthKeyResponse
400Bad RequestBad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.Inline
404Not FoundResource not found.ErrorResponse
409ConflictThe request conflicts with an existing resource.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Enumerated Values​

PropertyValue
statuserror

Generate an OAuth access token​

POST /applications/{applicationId}/oauth-keys/{keyMappingId}/generate-token

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/applications/{applicationId}/oauth-keys/{keyMappingId}/generate-token \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Generates an access token for an existing application OAuth key mapping. The portal calls the Authorization Server token endpoint directly using the client appKeyMappings supplied in consumerSecret.

Payload

{
"consumerSecret": "my-consumer-secret",
"scopes": [
"weather.read"
],
"validityPeriod": 3600
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:application_key:create`, `dp:application_key:manage`

Parameters​

NameInTypeRequiredDescription
bodybodyOAuthGenerateTokenRequestfalseOAuth token generation payload. The portal calls the Authorization Server token endpoint directly.
applicationIdpathstringtrueThe application's handle (unique per org).
keyMappingIdpathstringtruenone

Example responses

200 Response

{
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.example",
"validityTime": 3600,
"tokenScopes": [
"weather.read"
]
}

Bad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.

{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
{
"message": "Missing or invalid fields in the request payload"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKOAuth access token response.OAuthTokenResponse
400Bad RequestBad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.Inline
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Enumerated Values​

PropertyValue
statuserror

Remove an OAuth client_id mapping​

DELETE /applications/{applicationId}/oauth-keys/{keyMappingId}

Code samples


curl -X DELETE https://localhost:9543/api-portal/api/v0.9/applications/{applicationId}/oauth-keys/{keyMappingId} \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Removes the local client_id mapping for an application. This does not affect the OAuth client in the key manager — that client is owned and managed externally.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:application_key:revoke`

Parameters​

NameInTypeRequiredDescription
applicationIdpathstringtrueThe application's handle (unique per org).
keyMappingIdpathstringtruenone

Example responses

200 Response

{
"message": "Operation completed successfully"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKMessage or generic response payload.Inline
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Was this page helpful?