API-Key API
This page provides routes for managing api-keys. The following routes are available:
GET/api-keyRetrieve a list of API keys based on query parametersGET/api-key/user/:userIdRetrieve a list of API keys for a specific userGET/api-key/:apiKeyIdRetrieve a specific API key by IDGET/api-key/myRetrieve a list of API keys for the authenticated userGET/api-key/my/organizationRetrieve a list of API keys for the authenticated user's organizationPOST/api-keyCreate a new API keyDELETE/api-key/:apiKeyIdDelete a specific API key by ID
Retrieve a list of API keys based on query parameters
This endpoint retrieves a list of API keys based on query parameters.
GET https://api.token.web3sandpit.com/api/v1/api-key
INFO
Authentication: Requires token for authentication.
Permissions: Requires OWNER role with api_key_management and read permissions.
Parameters
None
Example
{}[
{
"_id": "6731b24ce2c840500b6e5add",
"createdBy": "671b8bad65b5bb889dd83c84",
"key": "zgiqfcl8ylc6ehocg8smusklh21234",
"orgId": "671a3c8db86d5a1d46dff7ee",
"scopes": ["read"],
"createdAt": "2024-11-11T07:29:16.231Z",
"updatedAt": "2024-11-11T07:29:16.231Z",
"__v": 0,
"apiKey": "6731b24ce2c840500b6e5addzgiqfcl8ylc6ehocg8smusklh12345",
"id": "6731b24ce2c840500b6e5add"
},
{
"_id": "6731b24ce2c840500b6e5add",
"createdBy": "671b8bad65b5bb889dd83c84",
"key": "zgiqfcl8ylc6ehocg8smusklh21234",
"orgId": "671a3c8db86d5a1d46dff7eb",
"scopes": ["read"],
"createdAt": "2024-11-11T07:29:16.231Z",
"updatedAt": "2024-11-11T07:29:16.231Z",
"__v": 0,
"apiKey": "6731b24ce2c840500b6e5addzgiqfcl8ylc6ehocg8smusklh12345",
"id": "6731b24ce2c840500b6e5add"
}
]HTTP Response Codes
| Status Code | Text | Description |
|---|---|---|
| 200 | OK | With an array of apikey objects and pagination information. |
| 400 | Bad Request | The request was invalid or cannot be processed. |
| 401 | Unauthorized | Authentication is required or has failed. |
| 403 | Forbidden | The authenticated user is not authorized to perform the requested action. |
| 404 | Not Found | The requested resource could not be found. |
| 500 | Internal Server Error | An unexpected error occurred. |
Retrieve API Keys By User ID
This endpoint retrieves API keys for a specific user.
GET https://api.token.web3sandpit.com/api/v1/api-key/user/:userId
INFO
Authentication: Requires token for authentication.
Permissions: Requires USER or OWNER role with api_key_management and read permissions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | The ID of the user to retrieve API keys for |
Example
{}[
{
"_id": "673433b805edbee750b37795",
"createdBy": "671b8bad65b5bb889dd83c84",
"key": "bp8cs7najrcozahde5uj8kbr7w2mgp",
"orgId": "671a3c8db86d5a1d46dff7ee",
"scopes": ["read"],
"createdAt": "2024-11-13T05:06:00.217Z",
"updatedAt": "2024-11-13T05:06:00.217Z",
"__v": 0,
"apiKey": "673433b805edbee750b37795bp8cs7najrcozahde5uj8kbr7w2mgp",
"id": "673433b805edbee750b37795"
}
]HTTP Response Codes
| Status Code | Text | Description |
|---|---|---|
| 200 | OK | With an array of apikey objects and pagination information. |
| 400 | Bad Request | The request was invalid or cannot be processed. |
| 401 | Unauthorized | Authentication is required or has failed. |
| 403 | Forbidden | The authenticated user is not authorized to perform the requested action. |
| 404 | Not Found | The requested resource could not be found. |
| 500 | Internal Server Error | An unexpected error occurred. |
Retrieve API Key by ID
This endpoint retrieves a specific API key by ID.
GET https://api.token.web3sandpit.com/api/v1/api-key/:apiKeyId
INFO
Authentication: Requires token for authentication.
Permissions: Requires OWNER role with api_key_management and read permissions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKeyId | string | Yes | The ID of the api-key to retrieve |
Example
{}{
"_id": "673433b805edbee750b37795",
"createdBy": "671b8bad65b5bb889dd83c84",
"key": "bp8cs7najrcozahde5uj8kbr7w2mgp",
"orgId": "671a3c8db86d5a1d46dff7ee",
"scopes": ["read"],
"createdAt": "2024-11-13T05:06:00.217Z",
"updatedAt": "2024-11-13T05:06:00.217Z",
"__v": 0,
"apiKey": "673433b805edbee750b37795bp8cs7najrcozahde5uj8kbr7w2mgp",
"id": "673433b805edbee750b37795"
}HTTP Response Codes
| Status Code | Text | Description |
|---|---|---|
| 200 | OK | With an apikey object. |
| 400 | Bad Request | The request was invalid or cannot be processed. |
| 401 | Unauthorized | Authentication is required or has failed. |
| 403 | Forbidden | The authenticated user is not authorized to perform the requested action. |
| 404 | Not Found | The requested resource could not be found. |
| 500 | Internal Server Error | An unexpected error occurred. |
Retrieve My API Keys
This endpoint retrieves API keys for the authenticated user.
GET https://api.token.web3sandpit.com/api/v1/api-key/my
INFO
Authentication: Requires token for authentication.
Permissions: Requires USER role with api_key_management and read permissions.
Example
{}[
{
"_id": "673433b805edbee750b37795",
"createdBy": "671b8bad65b5bb889dd83c84",
"key": "bp8cs7najrcozahde5uj8kbr7w2mgp",
"orgId": "671a3c8db86d5a1d46dff7ee",
"scopes": ["read"],
"createdAt": "2024-11-13T05:06:00.217Z",
"updatedAt": "2024-11-13T05:06:00.217Z",
"__v": 0,
"apiKey": "673433b805edbee750b37795bp8cs7najrcozahde5uj8kbr7w2mgp",
"id": "673433b805edbee750b37795"
}
]HTTP Response Codes
| Status Code | Text | Description |
|---|---|---|
| 200 | OK | With an array of apikey objects and |
| 400 | Bad Request | The request was invalid or cannot be processed. |
| 401 | Unauthorized | Authentication is required or has failed. |
| 403 | Forbidden | The authenticated user is not authorized to perform the requested action. |
| 404 | Not Found | The requested resource could not be found. |
| 500 | Internal Server Error | An unexpected error occurred. |
Retrieve Organization API Keys
This endpoint retrieves API keys for a specific organization.
GET https://api.token.web3sandpit.com/api/v1/api-key/my/organization
INFO
Authentication: Requires token for authentication.
Permissions: Requires USER or OWNER role with api_key_management and read permissions.
Parameters
None
Example
{}[
{
"_id": "673433b805edbee750b37795",
"createdBy": "671b8bad65b5bb889dd83c84",
"key": "bp8cs7najrcozahde5uj8kbr7w2mgp",
"orgId": "671a3c8db86d5a1d46dff7ee",
"scopes": ["read"],
"createdAt": "2024-11-13T05:06:00.217Z",
"updatedAt": "2024-11-13T05:06:00.217Z",
"__v": 0,
"apiKey": "673433b805edbee750b37795bp8cs7najrcozahde5uj8kbr7w2mgp",
"id": "673433b805edbee750b37795"
}
]HTTP Response Codes
| Status Code | Text | Description |
|---|---|---|
| 200 | OK | With an array of apikey objects and pagination information. |
| 400 | Bad Request | The request was invalid or cannot be processed. |
| 401 | Unauthorized | Authentication is required or has failed. |
| 403 | Forbidden | The authenticated user is not authorized to perform the requested action. |
| 404 | Not Found | The requested resource could not be found. |
| 500 | Internal Server Error | An unexpected error occurred. |
Create API Key
This endpoint creates a new API key.
POST https://api.token.web3sandpit.com/api/v1/api-key
INFO
Authentication: Requires token for authentication.
Permissions: Requires USER or OWNER role with api_key_management and create permissions.
Parameters
None
Example
{}{
"createdBy": "671b8bad65b5bb889dd83c84",
"key": "dzy/CNsvct3mZFEwiSg6PQ==:eF1J8SytiqEhNhE0jWZj1kodxjxHiLGTnbAkX123",
"orgId": "671a3c8db86d5a1d46dff7ee",
"scopes": ["read"],
"_id": "673433b805edbee750b37795",
"createdAt": "2024-11-13T05:06:00.217Z",
"updatedAt": "2024-11-13T05:06:00.217Z",
"__v": 0,
"apiKey": "673433b805edbee750b37795bp8cs7najrcozahde5uj8kbr7w2123",
"id": "673433b805edbee750b37795"
}HTTP Response Codes
| Status Code | Text | Description |
|---|---|---|
| 200 | OK | With an array of apikey objects and pagination information. |
| 400 | Bad Request | The request was invalid or cannot be processed. |
| 401 | Unauthorized | Authentication is required or has failed. |
| 403 | Forbidden | The authenticated user is not authorized to perform the |
| 404 | Not Found | The requested resource could not be found. |
| 500 | Internal Server Error | An unexpected error occurred. |
Delete API Key
This endpoint deletes a specific API key.
DELETE https://api.token.web3sandpit.com/api/v1/api-key/:apiKeyId
INFO
Authentication: Requires token for authentication.
Permissions: Requires USER or OWNER role with api_key_management and delete permissions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKeyId | string | Yes | The ID of the api key to delete |
Example
{}{
"message": "Api key deleted successfully",
"status": "success"
}HTTP Response Codes
| Status Code | Text | Description |
|---|---|---|
| 200 | OK | With a success message. |
| 400 | Bad Request | The request was invalid or cannot be processed. |
| 401 | Unauthorized | Authentication is required or has failed. |
| 403 | Forbidden | The authenticated user is not authorized to perform the |
| 404 | Not Found | The requested resource could not be found. |
| 500 | Internal Server Error | An unexpected error occurred. |