hiddenlayer-sdk 6.0.0), TypeScript (@hiddenlayerai/hiddenlayer-sdk 5.0.0), and Java (com.hiddenlayer.api:hiddenlayer-java 6.0.0). It covers the client, the module-level exports, the resources the workflow guides use, the high-level helpers, and the exceptions.
Use it to find a method’s name in your language, the endpoint it calls, and what it returns. For explanations and complete examples, see Core concepts and API usage examples. For REST request and response field details, see the HiddenLayer Developer Portal.
How to read this page
- Language tabs. Choose Python, TypeScript, or Java in any tab, and every tab on the page switches to it.
- Resource sections. Each one starts with a table of operations, the endpoint each calls, and what it returns, followed by the method calls in your language, in the same order.
- Method names. Python uses
snake_case(retrieve_summary), TypeScript and Java usecamelCase(retrieveSummary). Java reaches resources through accessor methods:client.scans().results(). - Arguments. Python takes path parameters positionally and everything else as keyword arguments. TypeScript takes one request object whose fields keep the API’s names, with path parameters and headers as fields (
{ scan_id },"HL-Project-Id"). Java takes path parameters as leadingStringarguments and the body and query fields in a request object built with a builder. - Types. Request and response types are named after the API specification’s schemas and have the same name in every language. Import them from
hiddenlayerin Python, read them from theHiddenLayerApinamespace in TypeScript (a type that belongs to one resource is nested under it, such asHiddenLayerApi.scans.StartUploadResponse), and import them fromcom.hiddenlayer.api.types(or a resource’srequestsortypespackage) in Java. - Async clients. Python’s
AsyncHiddenLayerand Java’sAsyncHiddenLayerClienthave the same methods as the synchronous clients. Python methods are coroutines; Java methods return aCompletableFuture. Every TypeScript method returns a promise. - Pages. “Page of
T” means a paginated return:SyncPager(Python;AsyncPageron the async client),Page(TypeScript), orSyncPagingIterable(Java). See Pagination. - Beta endpoints can change without notice and emit a warning on first use. Deprecated endpoints should not be used in new code.
Full method reference
The SDKs cover every public operation in the HiddenLayer API, many more than this page lists. Each SDK’s repository has a reference with every method, its parameters, and an example:Clients
Use the clients in the first two rows. The base clients have no model or community scanner, do not read
HIDDENLAYER_TOKEN, and emit no Beta warnings. In Java, HiddenLayerClient.builder() still compiles but is deprecated: it returns the base client.
Constructor options
- Python
- TypeScript
- Java
HIDDENLAYER_... is the environment variable read when you don’t pass the option. Credentials resolve in this order: token, then the client ID and secret, then HIDDENLAYER_TOKEN, then HIDDENLAYER_CLIENT_ID and HIDDENLAYER_CLIENT_SECRET. With no credentials at all, Python and TypeScript build the client but fail each request with an error that names what to set, and Java’s build() throws an IllegalStateException. See Authentication and configuration.
Client members
- Python
- TypeScript
- Java
Module-level exports
- Python
- TypeScript
- Java
hiddenlayer- Clients:
HiddenLayer,AsyncHiddenLayer,HiddenLayerEnvironment. - Every request and response type, such as
ScanReportOfRecordV3andInteractionEvaluationRequestMetadata. - The typed errors, such as
NotFoundError. - Scanners:
ModelScanner,AsyncModelScanner,CommunityScanner,AsyncCommunityScanner. - Beta warnings:
BetaWarningandwarn_beta. - HTTP clients for the async client:
DefaultAioHttpClientandDefaultAsyncHttpxClient. __version__, the installed version.
hiddenlayer.core: ApiError, ParsingError, RequestOptions, SyncPager, AsyncPager, HttpResponse, AsyncHttpResponse, LogConfig, LogLevel, ILogger.hiddenlayer.errors: the typed errors, also exported from hiddenlayer.hiddenlayer.lib: CommunityScanSource, the scanner classes, check_beta_endpoint, and the red_team_exceptions module.hiddenlayer.<resource>: types that only one resource uses, such as hiddenlayer.scans.StartUploadResponse.Per-request options
Every resource method takes optional per-request options as its last argument:request_options={...} in Python, a second options object in TypeScript, and RequestOptions.builder()...build() in Java. The high-level helpers do not take them.
See Set per-request options for examples.
Models
Evaluations: red team
Allevaluations.red_team endpoints are Beta. Python users can drive a workflow with the session helper instead. See Attack simulation.
Evaluation sessions: red team (Python)
Beta (wraps the Betaevaluations.red_team endpoints). Python only: the TypeScript and Java SDKs have no session helper. Access it through client.evaluation_sessions.red_team. See Attack simulation for a walkthrough.
execution_strategy_type must be "single", "random", or "static_prompt_set"; any other value raises ValueError. "static_prompt_set" requires prompt_set_id.
The session that start_session and resume_session return has these members:
Prompt Analyzer
verdict, categories, results, policy, frameworks, model, provider, and elapsed_ms.
Interactions (v1)
Runtime
The AI Runtime Security v2 evaluation endpoints. See Runtime security.interaction takes either the canonical form (CanonicalInteraction, with messages and optional tools_available) or a provider-native payload: OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, TypeSafe System One, or OpenAI Decisions. metadata requires model, requester_id, and provider, and accepts an optional external_session_id. The response includes outcome (action, threat_level, detections, effective_interaction), evaluated_interaction, and metadata.
The request-evaluations and response-evaluations endpoints return 200 whether or not the policy blocks the payload. Read the hl-runtime-action response header with a raw response to detect a block.
Sensors
Deprecated. The API states that each sensors endpoint “will be removed after April 13, 2026”. Do not use these methods in new code.Scans: results
include_threat_types flag, which adds threat types to the findings.
Scans: jobs
ListJobsResponse with total, is the page’s response. The community scanner wraps the request method.
Scans: upload
These methods implement the multipart upload the model scanner uses. Most users should call the model scanner instead.Model scanner
High-level helper that uploads model files, starts the scan, and by default waits for it to finish. Each method returns the scan report,ScanReportOfRecordV3 (exported as ScanReport in TypeScript). See Model scanning.
Java’s
AsyncModelScanner has the same methods, returning a CompletableFuture; the ScanUtils methods also have Async variants.
The request source defaults to "API Upload" and also accepts "Hybrid Upload", "Integration", "UI Upload", and "AI Asset Discovery". When the helper waits for results, it polls until the scan status is done, failed, or canceled, with no overall time limit. A failed scan is returned, not raised, so check the report’s status.
Community scanner
High-level helper that asks HiddenLayer to fetch and scan a model from a remote location, so nothing is downloaded to your machine. It returns the scan report.CommunityScanSource
The model source takes one of these values: LOCAL, AWS_PRESIGNED, AWS_IAM_ROLE, AZURE_BLOB_SAS, AZURE_BLOB_AD, GOOGLE_SIGNED, GOOGLE_OAUTH, or HUGGING_FACE. Use the CommunityScanSource constants from hiddenlayer.lib (Python), @hiddenlayerai/hiddenlayer-sdk (TypeScript), or com.hiddenlayer.api.lib (Java), or pass the string.
For HUGGING_FACE, the model path is the repository ID, for example "drhyrum/bert-tiny-torch-vuln".
Exceptions
The typed errors have the same names in all three SDKs:
BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, GoneError, PreconditionFailedError, ContentTooLargeError, UnsupportedMediaTypeError, UnprocessableEntityError, InternalServerError, NotImplementedError, BadGatewayError, and ServiceUnavailableError. The Python red team session raises RedTeamSessionError, PollTimeoutError, WorkflowNotFoundError, and InvalidSessionError.
A method raises a typed error only for the statuses its endpoint declares; any other status raises the base class. See Error handling for the full hierarchy and patterns.
