Pass the optional and required parameters as per the official API docs. See the DTO reference below for more information.
package com.example.myapp;
import com.unkey.unkeysdk.dto.KeyVerifyRequest;
import com.unkey.unkeysdk.dto.KeyVerifyResponse;
@RestController
public class APIController {
private static IKeyService keyService = new KeyService();
@PostMapping("/verify")
public KeyVerifyResponse verifyKey(
@RequestBody KeyVerifyRequest keyVerifyRequest) {
return keyService.verifyKey(keyVerifyRequest);
}
}
DTOs Reference
The DTOs used in the code for a better understanding of request and response bodies.
public class KeyVerifyResponse {
@NonNull
private Boolean valid;
private String code;
private String ownerId;
private Long expires;
private Object meta;
private KeyVerifyRateLimit ratelimit;
private Long remaining;
}
public class KeyVerifyRateLimit {
private Integer limit;
private Integer remaining;
private Long reset;
}
public class KeyVerifyRequest {
@NonNull
private String key;
private String apiId;
}