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

EnvironmentHTTP MethodEndpoint
Sandbox testingDELETEhttps://api-sandbox.flex-charge.com/v1/api-keys/{id}
Production environmentDELETEhttps://api.flex-charge.com/v1/api-keys/{id}

Required Keys

ParameterDescription
{id}The unique identifier of the API key to be deleted.
bearer tokenThe authentication token returned by /oauth2/token.

Body

This API does not require body parameters.


Response

Field Definitions

Field NameTypeDescription
HTTP Status CodeIntegerReturns 200 for successful deletion.
statusStringStatus of the API request (SUCCESS, FAILED).
successBooleanIndicates if the API key deletion was successful.
resultStringA confirmation message for the deletion (e.g., "API key deleted successfully.").
errorsArray of StringsAny 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."
  ]
}