Skip to main content

io.enterpriseai.resources.ApiKeysClient

Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/resources/ApiKeysClient.java. Back to the Java SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class ApiKeysClient​

Tenant API keys (secret shown once).

Constructor ApiKeysClient​

ApiKeysClient(Transport transport)

Creates the client on the shared transport; EnterpriseAIClient builds it and exposes it through the accessor of the same name.

NameTypeDefaultRequiredDescription
transportTransportyesTransport shared by the sub-clients of one client.

ApiKeysClient.create​

JsonNode create(Object body)

Create an API key. Creates an API key for scripts and services. Needs tenant_admin or developer. The answer (201) carries the full secret in key, shown only once: store it in a secret store right away.

Route: /v1/api-keys (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesName, rights, binding and expiry of the new key.

Returns: JsonNode. Decoded JSON answer of the operation "Create an API key".

Raises: the typed errors of the transport (Errors).

ApiKeysClient.create​

JsonNode create(Object body, RequestOptions options)

Create an API key. Creates an API key for scripts and services. Needs tenant_admin or developer. The answer (201) carries the full secret in key, shown only once: store it in a secret store right away.

Route: /v1/api-keys (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesName, rights, binding and expiry of the new key.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Create an API key".

Raises: the typed errors of the transport (Errors).

ApiKeysClient.delete​

void delete(String id)

Revoke an API key. Revokes the key at once: every later request made with it answers 401 api_key_revoked. Revoking a key already revoked succeeds without change. Allowed to tenant_admin, security_officer and developer; a developer only revokes the keys they created, any other key answers 404 not_found. Writes the audit event api_key.revoke. Answers 204 without body.

Route: /v1/api-keys/{key_id} (DELETE).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the API key.

Returns: void.

Raises: the typed errors of the transport (Errors).

ApiKeysClient.list​

Page<JsonNode> list()

List the API keys. Lists the API keys of the tenant, paginated by limit and cursor, ordered by identifier. Each item gives the name, the public prefix, roles, scopes, clearance, project, environment, creator, expiry and revocation state; never the secret nor its hash. tenant_admin and security_officer see every key, a developer only the keys they created.

Route: /v1/api-keys (GET).

This element takes no parameter.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: the typed errors of the transport (Errors).

ApiKeysClient.list​

Page<JsonNode> list(Map<String, ?> query)

List the API keys. Lists the API keys of the tenant, paginated by limit and cursor, ordered by identifier. Each item gives the name, the public prefix, roles, scopes, clearance, project, environment, creator, expiry and revocation state; never the secret nor its hash. tenant_admin and security_officer see every key, a developer only the keys they created.

Route: /v1/api-keys (GET).

NameTypeDefaultRequiredDescription
queryMap<String, ?>yesQuery string parameters of the route.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: the typed errors of the transport (Errors).

ApiKeysClient.rotate​

JsonNode rotate(String id)

Rotate an API key. Issues a replacement key with the same name, roles, scopes, clearance, project and environment, and retires the old one. The new secret is in key of the 201 answer, shown once.

Route: /v1/api-keys/{key_id}/rotate (POST).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the API key.

Returns: JsonNode. Decoded JSON answer of the operation "Rotate an API key".

Raises: the typed errors of the transport (Errors).

ApiKeysClient.rotate​

JsonNode rotate(String id, Object body)

Rotate an API key. Issues a replacement key with the same name, roles, scopes, clearance, project and environment, and retires the old one. The new secret is in key of the 201 answer, shown once.

Route: /v1/api-keys/{key_id}/rotate (POST).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the API key.
bodyObjectyesOptional grace period of the old key. An empty body revokes the old key at once.

Returns: JsonNode. Decoded JSON answer of the operation "Rotate an API key".

Raises: the typed errors of the transport (Errors).