Skip to main content
This page maps the HiddenLayer SDKs side by side: Python (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 use camelCase (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 leading String arguments 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 hiddenlayer in Python, read them from the HiddenLayerApi namespace in TypeScript (a type that belongs to one resource is nested under it, such as HiddenLayerApi.scans.StartUploadResponse), and import them from com.hiddenlayer.api.types (or a resource’s requests or types package) in Java.
  • Async clients. Python’s AsyncHiddenLayer and Java’s AsyncHiddenLayerClient have the same methods as the synchronous clients. Python methods are coroutines; Java methods return a CompletableFuture. Every TypeScript method returns a promise.
  • Pages. “Page of T” means a paginated return: SyncPager (Python; AsyncPager on the async client), Page (TypeScript), or SyncPagingIterable (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

A default in the form 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

Module-level exports

hiddenlayer
  • Clients: HiddenLayer, AsyncHiddenLayer, HiddenLayerEnvironment.
  • Every request and response type, such as ScanReportOfRecordV3 and InteractionEvaluationRequestMetadata.
  • The typed errors, such as NotFoundError.
  • Scanners: ModelScanner, AsyncModelScanner, CommunityScanner, AsyncCommunityScanner.
  • Beta warnings: BetaWarning and warn_beta.
  • HTTP clients for the async client: DefaultAioHttpClient and DefaultAsyncHttpxClient.
  • __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

All evaluations.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 Beta evaluations.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

The response includes verdict, categories, results, policy, frameworks, model, provider, and elapsed_ms.

Interactions (v1)

The v1 Interactions endpoint remains available for existing integrations. New integrations use the v2 evaluation endpoints under Runtime, which accept provider-native payloads and agentic content such as tool calls.

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

Each method also takes an optional include_threat_types flag, which adds threat types to the findings.

Scans: jobs

The list’s response envelope, 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.
The S3, Azure Blob Storage, and Hugging Face helpers need extra packages, which the SDK doesn’t install: 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.