Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/rest-apis/devportal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Base URLs:

### [API Keys](api-keys.md)

- [List all API keys for the current user](api-keys.md#list-all-api-keys-for-the-current-user)
- [Generate an API key](api-keys.md#generate-an-api-key)
- [List API keys](api-keys.md#list-api-keys)
- [Regenerate an API key](api-keys.md#regenerate-an-api-key)
Expand Down
137 changes: 130 additions & 7 deletions docs/rest-apis/devportal/api-keys.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,135 @@
<h1 id="wso2-api-developer-portal-core-devportal-routes-api-keys">API Keys</h1>

## List all API keys for the current user

<a id="opIdlistAllApiKeys"></a>

`GET /api-keys`

> Code samples

```shell

curl -X GET https://localhost:3000/api/v0.9/api-keys \
-u {username}:{password} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'

```

Lists every API key created by the authenticated user across all APIs in the organization. Powers the Developer Portal's global "API Keys" page. Each item additionally carries the owning API's name, version, and type. Secret material is never returned.

### Authentication

<aside class="warning">
This operation requires <strong>Basic Auth</strong> authentication.

</aside>

<h3 id="list-all-api-keys-for-the-current-user-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|limit|query|integer|false|Maximum number of records to return.|
|offset|query|integer|false|Number of records to skip before returning results.|

> Example responses

> 200 Response

```json
{
"list": [
{
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"apiId": "weather-api-v1",
"appId": "my-weather-app",
"appDisplayName": "My Mobile App",
"status": "ACTIVE",
"expiresAt": "2026-12-31T23:59:59Z",
"createdAt": "2019-08-24T14:15:22Z",
"revokedAt": "2019-08-24T14:15:22Z"
}
],
"count": 1,
"pagination": {
"total": 42,
"limit": 20,
"offset": 0
}
}
```

> 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.

```json
{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
```

```json
{
"message": "Missing or invalid fields in the request payload"
}
```

> 500 Response

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

<h3 id="list-all-api-keys-for-the-current-user-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|List of API key metadata records.|Inline|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|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.|Inline|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal server error.|[ErrorResponse](schemas.md#schemaerrorresponse)|

<h3 id="list-all-api-keys-for-the-current-user-responseschema">Response Schema</h3>

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» list|[[ApiKeyMetadataResponse](schemas.md#schemaapikeymetadataresponse)]|false|none|[API key metadata returned by list operations. Secret material is omitted.]|
|»» id|string|false|none|none|
|»» displayName|string|false|none|none|
|»» apiId|string|false|none|Developer Portal API ID the key belongs to.|
|»» appId|string¦null|false|none|ID of the application this key is associated with, if any. Analytics attribution only.|
|»» appDisplayName|string¦null|false|none|Display name of the associated application, if any.|
|»» status|string|false|none|none|
|»» expiresAt|string(date-time)¦null|false|none|none|
|»» createdAt|string(date-time)|false|none|none|
|»» revokedAt|string(date-time)¦null|false|none|none|
|» count|integer|false|none|Number of items returned in this page.|
|» pagination|[Pagination](schemas.md#schemapagination)|false|none|Standard pagination metadata returned with collection responses.|
|»» total|integer|true|none|Total number of records matching the query.|
|»» limit|integer|true|none|Maximum number of records returned in this response.|
|»» offset|integer|true|none|Number of records skipped before this page.|

#### Enumerated Values

|Property|Value|
|---|---|
|status|ACTIVE|
|status|REVOKED|

#### Enumerated Values

|Property|Value|
|---|---|
|status|error|

## Generate an API key

<a id="opIdgenerateApiKey"></a>
Expand Down Expand Up @@ -50,7 +180,6 @@ This operation requires <strong>Basic Auth</strong> authentication.

```json
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"key": "ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ",
Expand Down Expand Up @@ -172,7 +301,6 @@ This operation requires <strong>Basic Auth</strong> authentication.
{
"list": [
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"apiId": "weather-api-v1",
Expand Down Expand Up @@ -234,7 +362,6 @@ Status Code **200**
|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» list|[[ApiKeyMetadataResponse](schemas.md#schemaapikeymetadataresponse)]|false|none|[API key metadata returned by list operations. Secret material is omitted.]|
|»» keyId|string|false|none|Developer Portal key identifier.|
|»» id|string|false|none|none|
|»» displayName|string|false|none|none|
|»» apiId|string|false|none|Developer Portal API ID the key belongs to.|
Expand Down Expand Up @@ -317,7 +444,6 @@ This operation requires <strong>Basic Auth</strong> authentication.

```json
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"key": "ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ",
Expand Down Expand Up @@ -524,7 +650,6 @@ This operation requires <strong>Basic Auth</strong> authentication.

```json
{
"keyId": "key-12345",
"application": {
"id": "my-weather-app",
"displayName": "My Mobile App"
Expand Down Expand Up @@ -734,7 +859,6 @@ This operation requires <strong>Basic Auth</strong> authentication.
{
"list": [
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"apiId": "weather-api-v1",
Expand Down Expand Up @@ -790,7 +914,6 @@ Status Code **200**
|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» list|[[ApiKeyMetadataResponse](schemas.md#schemaapikeymetadataresponse)]|false|none|[API key metadata returned by list operations. Secret material is omitted.]|
|»» keyId|string|false|none|Developer Portal key identifier.|
|»» id|string|false|none|none|
|»» displayName|string|false|none|none|
|»» apiId|string|false|none|Developer Portal API ID the key belongs to.|
Expand Down
5 changes: 0 additions & 5 deletions docs/rest-apis/devportal/mcp-server-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ This operation requires <strong>Basic Auth</strong> authentication.

```json
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"key": "ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ",
Expand Down Expand Up @@ -172,7 +171,6 @@ This operation requires <strong>Basic Auth</strong> authentication.
{
"list": [
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"apiId": "weather-api-v1",
Expand Down Expand Up @@ -234,7 +232,6 @@ Status Code **200**
|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» list|[[ApiKeyMetadataResponse](schemas.md#schemaapikeymetadataresponse)]|false|none|[API key metadata returned by list operations. Secret material is omitted.]|
|»» keyId|string|false|none|Developer Portal key identifier.|
|»» id|string|false|none|none|
|»» displayName|string|false|none|none|
|»» apiId|string|false|none|Developer Portal API ID the key belongs to.|
Expand Down Expand Up @@ -317,7 +314,6 @@ This operation requires <strong>Basic Auth</strong> authentication.

```json
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"key": "ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ",
Expand Down Expand Up @@ -524,7 +520,6 @@ This operation requires <strong>Basic Auth</strong> authentication.

```json
{
"keyId": "key-12345",
"application": {
"id": "my-weather-app",
"displayName": "My Mobile App"
Expand Down
8 changes: 1 addition & 7 deletions docs/rest-apis/devportal/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,6 @@ xor

```json
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"apiId": "weather-api-v1",
Expand All @@ -1204,7 +1203,6 @@ API key metadata returned by list operations. Secret material is omitted.

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|keyId|string|false|none|Developer Portal key identifier.|
|id|string|false|none|none|
|displayName|string|false|none|none|
|apiId|string|false|none|Developer Portal API ID the key belongs to.|
Expand All @@ -1231,7 +1229,6 @@ API key metadata returned by list operations. Secret material is omitted.

```json
{
"keyId": "key-12345",
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"key": "ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ",
Expand All @@ -1241,13 +1238,12 @@ API key metadata returned by list operations. Secret material is omitted.

```

API key response returned by generate/regenerate only. Unlike ApiKeyMetadataResponse, this does not include apiId, appId, appDisplayName, createdAt, or revokedAt — generate/regenerate return only these six fields.
API key response returned by generate/regenerate only. Unlike ApiKeyMetadataResponse, this does not include apiId, appId, appDisplayName, createdAt, or revokedAt — generate/regenerate return only these five fields.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|keyId|string|false|none|Developer Portal key identifier.|
|id|string|false|none|none|
|displayName|string|false|none|none|
|key|string|false|none|One-time plaintext API key secret.|
Expand All @@ -1270,7 +1266,6 @@ API key response returned by generate/regenerate only. Unlike ApiKeyMetadataResp

```json
{
"keyId": "key-12345",
"application": {
"id": "my-weather-app",
"displayName": "My Mobile App"
Expand All @@ -1283,7 +1278,6 @@ API key response returned by generate/regenerate only. Unlike ApiKeyMetadataResp

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|keyId|string|false|none|none|
|application|object|false|none|none|
|» id|string|false|none|none|
|» displayName|string|false|none|none|
Expand Down
40 changes: 26 additions & 14 deletions portals/developer-portal/docs/devportal-openapi-spec-v0.9.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,31 @@ paths:
security:
- OAuth2Security:
- dp:subscription_manage
/api-keys:
get:
tags:
- API Keys
operationId: listAllApiKeys
summary: List all API keys for the current user
description: >-
Lists every API key created by the authenticated user across all APIs in the
organization. Powers the Developer Portal's global "API Keys" page. Each item
additionally carries the owning API's name, version, and type. Secret material
is never returned.
parameters:
- $ref: "#/components/parameters/limit"
- $ref: "#/components/parameters/offset"
responses:
"200":
$ref: "#/components/responses/ApiKeyListResponse"
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
security:
- OAuth2Security:
- dp:api_key_read
- dp:api_key_manage
/apis/{apiId}/api-keys/generate:
parameters:
- $ref: "#/components/parameters/apiId"
Expand Down Expand Up @@ -1109,7 +1134,6 @@ paths:
schema:
$ref: "#/components/schemas/ApiKeyResponse"
example:
keyId: key-12345
id: weather_prod_key
displayName: Weather Prod Key
key: ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ
Expand Down Expand Up @@ -3894,7 +3918,6 @@ components:
schema:
$ref: "#/components/schemas/ApiKeyResponse"
example:
keyId: key-12345
id: weather_prod_key
displayName: Weather Prod Key
key: ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ
Expand Down Expand Up @@ -4970,10 +4993,6 @@ components:
type: object
description: API key metadata returned by list operations. Secret material is omitted.
properties:
keyId:
type: string
description: Developer Portal key identifier.
example: key-12345
id:
type: string
example: weather_prod_key
Expand Down Expand Up @@ -5017,12 +5036,8 @@ components:
type: object
description: >-
API key response returned by generate/regenerate only. Unlike ApiKeyMetadataResponse, this does not include
apiId, appId, appDisplayName, createdAt, or revokedAt — generate/regenerate return only these six fields.
apiId, appId, appDisplayName, createdAt, or revokedAt — generate/regenerate return only these five fields.
properties:
keyId:
type: string
description: Developer Portal key identifier.
example: key-12345
id:
type: string
example: weather_prod_key
Expand All @@ -5048,9 +5063,6 @@ components:
ApiKeyApplicationResponse:
type: object
properties:
keyId:
type: string
example: key-12345
application:
type: object
properties:
Expand Down
Loading
Loading