Delete an API key
This endpoint allows you to delete a specific API key, identified by its unique API Key ID ({id}). Once deleted, the API key will no longer be valid for authentication.
Request
Details
Environment | HTTP Method | Endpoint |
---|---|---|
Sandbox testing | DELETE | https://api-sandbox.flex-charge.com/v1/api-keys/{id} |
Production environment | DELETE | https://api.flex-charge.com/v1/api-keys/{id} |
Required Keys
Parameter | Description |
---|---|
{id} | The unique identifier of the API key to be deleted. |
bearer token | The authentication token returned by /oauth2/token . |
Body
This API does not require body parameters.
Response
Field Definitions
Field Name | Type | Description |
---|---|---|
HTTP Status Code | Integer | Returns 200 for successful deletion. |
status | String | Status of the API request (SUCCESS , FAILED ). |
success | Boolean | Indicates if the API key deletion was successful. |
result | String | A confirmation message for the deletion (e.g., "API key deleted successfully."). |
errors | Array of Strings | Any errors encountered during the deletion process. |
Notes
- Deleted API keys cannot be recovered. Use this endpoint with caution.
- Ensure proper handling of key deletions to avoid disrupting active integrations.
- This endpoint requires the API Key ID to be valid; otherwise, an error will be returned.
Payload Examples
Request
cURL Request Example
curl --request DELETE \
--url https://api-sandbox.flex-charge.com/v1/api-keys/{id} \
--header 'Authorization: bearer {the token returned by /oauth2}' \
--header 'accept: application/json'
Response
JSON Example for a Successful Deletion
{
"status": "SUCCESS",
"success": true,
"result": "API key deleted successfully.",
"errors": []
}
JSON Example for a Failed Deletion
{
"status": "FAILED",
"success": false,
"result": null,
"errors": [
"API key not found.",
"You do not have permission to delete this key."
]
}
Example for Handling Errors
- If the API Key ID is invalid, the API will return an error.
- If the bearer token is unauthorized, the API will respond with an Unauthorized error.
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"errors": [
"API key not found."
]
}
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"errors": [
"Authentication failed. Invalid bearer token."
]
}
Updated 1 day ago