Revoke an API key
Permanently revoke an API key to prevent it from being used for authentication. Once revoked, any requests made with this key will be rejected. This is useful when:
- An API key has been compromised
- You're rotating old API keys as part of security best practices
- An employee with access to the key leaves your organization
The revocation takes effect immediately and cannot be undone. If you need to restore access, you'll need to create a new API key.
The endpoint returns true if the key was successfully revoked.
key_id
string
Required. The unique identifier of the API key to revoke. This is the key_id value returned when the key was created.
NOT_FOUND
The API key with the provided ID could not be found in your merchant account. Verify that you're using the correct key_id.
ALREADY_REVOKED
The API key has already been revoked. No action is needed.
UNHANDLED_ERROR
This error occurs when the server encounters an unexpected internal error that it cannot handle gracefully. This typically happens due to bugs, infrastructure issues, or edge cases that weren't anticipated during development.
INVALID_ARGUMENTS
This error occurs when the request contains invalid or missing parameters. Common cases include missing required fields, or values that don't match the expected format or type.
BAD_VERSION
This error occurs when making requests to an API version that does not exist. This commonly happens when using an outdated SDK or when the API version specified in the request URL is incorrect.
curl "https://api.reservepay.com/merchants/revoke-key" \
-X POST
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer $(RESERVEPAY_API_KEY)" \
-d '{
"key_id": "key_OtjnE29kU1"
}'
