Skip to content

Revoke Authentication Code



POST /api/v1/offline_token/temporary_auth_code/revoke

Overview

Revoke a one-time custom authentication code in the current workspace that has not yet been redeemed.

Before Calling and Usage Steps

Take the value of content.authCode exactly as returned by Create One-Time Authentication Code, and submit it using an API Key with permissions in the same workspace. You can revoke only an offline_custom_token code generated by this public creation process. This API is not used for other sharing, snapshot, or reusable authentication codes. After a successful response returns true, the unredeemed code is deleted and can no longer be redeemed. The code and the redemption process are serialized under a lock. If redemption has already succeeded first, revocation returns that the code does not exist and does not retroactively revoke the generated Token. Repeatedly revoking an expired, consumed, or revoked code returns NotFoundAuthCode; this is not an idempotent success. Currently, it is not verified that the Key must be from the same creator; the main boundary is the same workspace and the permissions for this API.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y The workspace's OpenAPI authentication credential.
Example: <DF-API-KEY>
How to obtain or enter: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace.

Body Request Parameters

Parameter Type Required Description
authCode string Y Required one-time authentication code; do not submit a redeemed Token, and do not trim the time suffix yourself.
Allowed null: False
Example: AUTH-CODE-EXAMPLE.1785430800
How to obtain or enter: Take content.authCode returned by Create One-Time Authentication Code.

Additional Parameter Notes

Revoking a code cannot stop access by a redeemed Token. If the redemption request times out, the integrator should first confirm whether the Token has been obtained; do not interpret "code not found during revocation" as the Token being invalid.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/offline_token/temporary_auth_code/revoke' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"authCode":"AUTH-CODE-EXAMPLE.1785430800"}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content boolean true if an unredeemed code is successfully deleted.
{
  "code": 200,
  "content": true,
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

See Common Error Definitions for authentication, rate limiting, and common request errors.

HTTP Status errorCode Trigger Condition Message or Response Description Resolution
406 ft.ParameterValidationFailed A request field is missing, or a field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError The request JSON syntax is invalid Request JSON format error Correct the JSON according to content.reason, line, and column.
400 ft.JsonFormatError The top level of the JSON is not an object Some JSON file format errors Submit a single JSON object.
400 ft.NotFoundAuthCode The code does not exist, has expired, has been consumed, is not a one-time custom code supported by this API, or concurrent processing did not acquire the lock Authentication code not found Confirm that the original authCode from the creation response is used; if it has been redeemed, it cannot be redeemed again or revoked through this code; recreate the unfinished authorization as needed for the business.
403 ft.WorkspaceForbidden The workspace cached for the code is different from the current API Key workspace No access permission for the current workspace Use the Key for the workspace that issued the code; do not revoke across workspaces.
500 ft.InternalServerError Cache or other internal processing failed Internal error Retain the traceId and contact the administrator to verify the result; avoid automatically repeating authorization or determining that revocation has completed based on the error.

Feedback

Is this page helpful?