Skip to content

API-Key API

This page provides routes for managing api-keys. The following routes are available:

Retrieve API Keys By User ID

This endpoint retrieves API keys for a specific user.

GET https://nft-platform.azurewebsites.net/api/v1/api-keys/user/:userId

INFO

Authentication: Requires token for authentication.

Permissions: Requires USER or OWNER role with api_key_management and read permissions.

Parameters

ParameterTypeRequiredDescription
userIdstringYesThe ID of the user to retrieve API keys for

Example

json
{}
json
[
  {
    "_id": "67aaf3d7ac6656e91a4a9845",
    "createdBy": "67a98689bc4810c0e57b07d7",
    "expiresAt": "2025-03-08T00:00:00.000Z",
    "key": <secret key>,
    "orgId": "674ecdcc923de3913822c5fe",
    "scopes": ["read"],
    "createdAt": "2025-02-11T06:53:11.624Z",
    "updatedAt": "2025-02-11T06:53:11.624Z",
    "__v": 0,
    "apiKey": <secret key>,
    "id": "67aaf3d7ac6656e91a4a9845"
  }
]

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Retrieve API Key by ID

This endpoint retrieves a specific API key by ID.

GET https://nft-platform.azurewebsites.net/api/v1/api-keys/:apiKeyId

INFO

Authentication: Requires token for authentication.

Permissions: Requires OWNER role with api_key_management and read permissions.

Parameters

ParameterTypeRequiredDescription
apiKeyIdstringYesThe ID of the api-key to retrieve

Example

json
{}
json
{
  "_id": "673433b805edbee750b37795",
  "createdBy": "671b8bad65b5bb889dd83c84",
  "key": <secret key>,
  "orgId": "671a3c8db86d5a1d46dff7ee",
  "scopes": ["read"],
  "createdAt": "2024-11-13T05:06:00.217Z",
  "updatedAt": "2024-11-13T05:06:00.217Z",
  "__v": 0,
  "apiKey": <secret key>,
  "id": "673433b805edbee750b37795"
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an apikey object.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Retrieve User API Keys

This endpoint retrieves API keys for the authenticated user.

GET https://nft-platform.azurewebsites.net/api/v1/api-keys/my

INFO

Authentication: Requires token for authentication.

Permissions: Requires USER role with api_key_management and read permissions.

Example

json
{}
json
[
  {
    "_id": "673433b805edbee750b37795",
    "createdBy": "671b8bad65b5bb889dd83c84",
    "key": <secret key>,
    "orgId": "671a3c8db86d5a1d46dff7ee",
    "scopes": ["read"],
    "createdAt": "2024-11-13T05:06:00.217Z",
    "updatedAt": "2024-11-13T05:06:00.217Z",
    "__v": 0,
    "apiKey": <secret key>,
    "id": "673433b805edbee750b37795"
  }
]

HTTP Response Codes

Status CodeTextDescription
200OKWith an array of apikey objects and
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the requested action.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Create API Key

This endpoint creates a new API key.

POST https://nft-platform.azurewebsites.net/api/v1/api-keys

INFO

Authentication: Requires token for authentication.

Permissions: Requires USER or OWNER role with api_key_management and create permissions.

Parameters

None

Example

json
{
  "expiresAT": "2025-01-01T00:00:00.000Z"
}
json
{
  "createdBy": "671b8bad65b5bb889dd83c84",
  "key": <secret key>,
  "orgId": "671a3c8db86d5a1d46dff7ee",
  "scopes": ["read"],
  "_id": "673433b805edbee750b37795",
  "createdAt": "2024-11-13T05:06:00.217Z",
  "updatedAt": "2024-11-13T05:06:00.217Z",
  "__v": 0,
  "apiKey": <secret key>,
  "id": "673433b805edbee750b37795"
}

HTTP Response Codes

Status CodeTextDescription
200OKWith an array of apikey objects and pagination information.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

Delete API Key

This endpoint deletes a specific API key.

DELETE https://nft-platform.azurewebsites.net/api/v1/api-keys/:apiKeyId

INFO

Authentication: Requires token for authentication.

Permissions: Requires USER or OWNER role with api_key_management and delete permissions.

Parameters

ParameterTypeRequiredDescription
apiKeyIdstringYesThe ID of the api key to delete

Example

json
{}
json
{
  "message": "Api key deleted successfully",
  "status": "success"
}

HTTP Response Codes

Status CodeTextDescription
200OKWith a success message.
400Bad RequestThe request was invalid or cannot be processed.
401UnauthorizedAuthentication is required or has failed.
403ForbiddenThe authenticated user is not authorized to perform the
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn unexpected error occurred.

API Documentation created with ❤️ by TrackGenesis